weaver-work-cli 0.1.45 → 0.1.47

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 (129) hide show
  1. package/dist/chunks/{attachment-content-CE3GMWTS.js → attachment-content-MCXQBD6N.js} +3 -3
  2. package/dist/chunks/{chunk-VIMCY4DI.js → chunk-4RWS2YYL.js} +2 -2
  3. package/dist/chunks/{chunk-4EXOIQDI.js → chunk-6AXKWFKG.js} +4 -14
  4. package/dist/chunks/{chunk-JWWTI63L.js → chunk-6V5ZPKHV.js} +2 -8
  5. package/dist/chunks/{chunk-3ZMAQQ3W.js → chunk-76H3IKH6.js} +39 -26
  6. package/dist/chunks/{chunk-LGKWL4OH.js → chunk-AD46OMQK.js} +86 -25
  7. package/dist/chunks/{chunk-3WBIQLMB.js → chunk-GSZTA43P.js} +2 -2
  8. package/dist/chunks/{chunk-OAE3AZBQ.js → chunk-IP4CWQCF.js} +6 -6
  9. package/dist/chunks/{chunk-77YP6I52.js → chunk-IRMIEDXN.js} +1 -1
  10. package/dist/chunks/{chunk-LRCPNDZA.js → chunk-J2VEB5K3.js} +11 -9
  11. package/dist/chunks/{chunk-T4MWQAQB.js → chunk-JFAWZX53.js} +128 -9
  12. package/dist/chunks/{chunk-GR76ZDDX.js → chunk-LIEQJIGM.js} +3 -0
  13. package/dist/chunks/{chunk-DGMYACGJ.js → chunk-OXHHJWNC.js} +1 -1
  14. package/dist/chunks/{chunk-LXFVWZLM.js → chunk-PSOMGA3U.js} +3 -3
  15. package/dist/chunks/{conflict-IYJETSGT.js → conflict-H7EHQXYY.js} +2 -2
  16. package/dist/chunks/{create-flow-7JLC7UID.js → create-flow-VRVJEOBX.js} +6 -6
  17. package/dist/chunks/{ehr-MYRDCHZ4.js → ehr-SH2LM3NK.js} +528 -40
  18. package/dist/chunks/{env-3MBHAWBL.js → env-66FPSJDV.js} +2 -2
  19. package/dist/chunks/{factory-TZEVU4DU.js → factory-UH2TZBVA.js} +1 -1
  20. package/dist/chunks/{group-chat-KL3HFKRM.js → group-chat-CAKMMV7K.js} +3 -3
  21. package/dist/chunks/{invoice-OQP3TMKQ.js → invoice-UEAHSYAE.js} +279 -1
  22. package/dist/chunks/{lazy-dispatch-UH6HGK2I.js → lazy-dispatch-25XGTXLM.js} +2 -2
  23. package/dist/chunks/{meeting-C67EHQ4Z.js → meeting-VTBFW4HI.js} +10 -10
  24. package/dist/chunks/{recruit-stage-AHY5QAMF.js → recruit-stage-CAKZTUA7.js} +917 -85
  25. package/dist/chunks/{registry-XPWPGHYE.js → registry-JVQBLFQ5.js} +10 -10
  26. package/dist/chunks/{room-recommend-CNWE5WQK.js → room-recommend-5U55FMXZ.js} +4 -4
  27. package/dist/chunks/{schedule-YYNYBQIE.js → schedule-IDETODCA.js} +4 -4
  28. package/dist/cmd/action.js +14 -10
  29. package/dist/index.js +7 -7
  30. package/dist/shortcuts/ehr/host.js +2 -2
  31. package/dist/shortcuts/ehr/index.js +14 -3
  32. package/dist/shortcuts/ehr/manifest.js +5 -1
  33. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +40 -10
  34. package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
  35. package/dist/shortcuts/ehr/operations/recruit-position.js +10 -8
  36. package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
  37. package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
  38. package/dist/shortcuts/ehr/operations/recruit-write.js +137 -18
  39. package/dist/shortcuts/ehr/operations/recruit.js +180 -8
  40. package/dist/shortcuts/ehr/operations/registry.js +4 -0
  41. package/dist/shortcuts/ehr/operations.js +24 -0
  42. package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
  43. package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
  44. package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
  45. package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
  46. package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
  47. package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
  48. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
  49. package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
  50. package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
  51. package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
  52. package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
  53. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
  54. package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
  55. package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
  56. package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
  57. package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
  58. package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
  59. package/dist/shortcuts/invoice/host.js +3 -0
  60. package/dist/shortcuts/invoice/manifest.js +61 -0
  61. package/dist/shortcuts/invoice/operations/registry.js +2 -0
  62. package/dist/shortcuts/invoice/operations/reim-subsidy.js +233 -0
  63. package/dist/shortcuts/meeting/operations/eb/create-flow.js +93 -18
  64. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -8
  65. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +2 -13
  66. package/dist/shortcuts/meeting/operations/invitation.js +27 -4
  67. package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
  68. package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
  69. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +277 -20
  70. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +31 -7
  71. package/dist/shortcuts/recruit-stage/operations/jd-create.js +106 -16
  72. package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
  73. package/dist/shortcuts/recruit-stage/operations/resume-import.js +273 -6
  74. package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
  75. package/dist/shortcuts/recruit-stage/shared.js +60 -6
  76. package/docs/invoice.md +1 -0
  77. package/package.json +1 -1
  78. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +2 -2
  79. package/skills/weaver-e10-jucailin/SKILL.md +12 -3
  80. package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
  81. package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
  82. package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
  83. package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
  84. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
  85. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
  86. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
  87. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
  88. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
  89. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
  90. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
  91. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
  92. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
  93. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
  94. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
  95. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
  96. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
  97. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
  98. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
  99. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
  100. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
  101. package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
  102. package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
  103. package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -93
  104. package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
  105. package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
  106. package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
  107. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
  108. package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
  109. package/skills/weaver-e10-jucailin/references/recruit-write.md +53 -9
  110. package/skills/weaver-e10-meeting/SKILL.md +48 -4
  111. package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
  112. package/skills/weaver-e10-recruit-stage/SKILL.md +8 -5
  113. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +16 -6
  114. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
  115. package/skills/weaver-e10-recruit-stage/references/position-templates.md +20 -1
  116. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +21 -0
  117. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +4 -0
  118. package/skills/weaver-e10-yepiaotong/SKILL.md +7 -5
  119. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +1 -1
  120. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +9 -2
  121. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +2 -0
  122. package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +2 -0
  123. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +68 -6
  124. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +3 -3
  125. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +8 -15
  126. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +6 -5
  127. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +206 -92
  128. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +26 -21
  129. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +35 -0
@@ -50,6 +50,7 @@ async function countModule(env, cache, key, pageSize, maxPages) {
50
50
  let scanned = 0;
51
51
  let total = null;
52
52
  let totalExact = false;
53
+ let countSource = 'unknown';
53
54
  let note = cfg.note;
54
55
  for (let current = 1; current <= maxPages; current++) {
55
56
  const page = await fetchListRows(env.host, objId, list.listId, { ...baseBody, current, pageSize });
@@ -57,6 +58,7 @@ async function countModule(env, cache, key, pageSize, maxPages) {
57
58
  if (current === 1 && page.total !== null && page.totalExact) {
58
59
  total = page.total;
59
60
  totalExact = true;
61
+ countSource = 'count-api';
60
62
  break;
61
63
  }
62
64
  scanned += page.rows.length;
@@ -64,15 +66,26 @@ async function countModule(env, cache, key, pageSize, maxPages) {
64
66
  if (page.rows.length < pageSize) {
65
67
  total = scanned;
66
68
  totalExact = true;
69
+ countSource = 'full-scan';
67
70
  break;
68
71
  }
69
72
  }
70
73
  // ③ 达上限仍未取完 → 总数不可知(不编造 0 或估计值)
71
74
  if (total === null) {
72
75
  totalExact = false;
76
+ countSource = 'unknown';
73
77
  note = `计数接口不可用且达扫描上限(${maxPages} 页 × ${pageSize} 行)仍未取完,总数不可知;可调大 pageSize/maxPages 重试`;
74
78
  }
75
- return { key, module: cfg.title, available: true, total, totalExact, scannedRows: scanned, ...(note ? { note } : {}) };
79
+ return {
80
+ key,
81
+ module: cfg.title,
82
+ available: true,
83
+ total,
84
+ totalExact,
85
+ scannedRows: scanned,
86
+ countSource,
87
+ ...(note ? { note } : {}),
88
+ };
76
89
  }
77
90
  const recruitStats = {
78
91
  name: 'ehr.recruit.stats',
@@ -0,0 +1,173 @@
1
+ import { READ, ehrSuccess, schemaOf, } from './types.js';
2
+ import { ehrValidationError } from '../errors.js';
3
+ /**
4
+ * 招聘标签检索(只读)。
5
+ *
6
+ * 背景(2026-11-07 实测,浏览器通道抓真实响应得出):
7
+ * - `POST /api/my/tag/query` 返回的是**全系统标签池**,不是招聘专属池。本环境 1911 条(type=0)+ 13 条(type=1)。
8
+ * - 请求体里的 `tagGroup` 参数**服务端不生效**(传 0/1/2/3/4 与传某个真实 groupId,total 都不变或直接返回空)。
9
+ * 真正生效的是 **`groupId`**(传 1209888460506972163 → 精确返回「可优化」1 条)。
10
+ * - 返回行自带 `groupId` 字段。本环境分布:groupId=1 有 1729 条、groupId=0 有 176 条,
11
+ * 另有 5 条 / 1 条挂在小众组 —— 即**标签池基本没做分组治理**,招聘标签散落在组 1 里。
12
+ * - `name` 参数服务端有效且为包含匹配("本科" → 1 条;"技术" → 8 条),
13
+ * 因此「按关键词精确定位正确标签」是当前环境下最可靠的可用手段。
14
+ *
15
+ * 本 op 的目标不是改标签池,而是让调用方**不必翻 1911 条**:
16
+ * ① 按 `keyword` 直查;② 按 `groupId` 收窄;③ 给出组分布,暴露"未分组"的实情。
17
+ */
18
+ const TAG_QUERY_PATH = '/api/my/tag/query';
19
+ const MAX_PAGE_SIZE = 100;
20
+ const DEFAULT_LIMIT = 100;
21
+ const MAX_LIMIT = 2000;
22
+ function normalizeTag(row) {
23
+ const tagId = String(row?.tagId ?? row?.id ?? '').trim();
24
+ const name = String(row?.name ?? row?.tagName ?? '').trim();
25
+ if (!tagId || !name)
26
+ return null;
27
+ return {
28
+ tagId,
29
+ name,
30
+ groupId: String(row?.groupId ?? '0'),
31
+ type: Number(row?.type ?? 0),
32
+ available: row?.available !== false,
33
+ };
34
+ }
35
+ async function queryPage(env, params) {
36
+ const body = {
37
+ type: params.type,
38
+ name: params.keyword,
39
+ order: 8,
40
+ pageSize: params.pageSize,
41
+ pageNo: params.pageNo,
42
+ search: 1,
43
+ tagGroup: 0,
44
+ tagModules: ['ebuilderform'],
45
+ };
46
+ // 🔴 groupId 才是服务端真认的过滤参数(tagGroup 不是),见文件头实测记录
47
+ if (params.groupId !== undefined)
48
+ body.groupId = params.groupId;
49
+ const res = (await env.host.request({
50
+ path: TAG_QUERY_PATH,
51
+ method: 'POST',
52
+ body,
53
+ operation: 'ehr.recruit.tag.list',
54
+ }));
55
+ const d = res?.data ?? {};
56
+ return {
57
+ total: typeof d.total === 'number' ? d.total : null,
58
+ rows: Array.isArray(d.data) ? d.data : [],
59
+ };
60
+ }
61
+ async function listTags(args, env) {
62
+ const keyword = args.keyword === undefined ? '' : String(args.keyword).trim();
63
+ const groupId = args.groupId === undefined || args.groupId === null ? undefined : String(args.groupId);
64
+ const limitRaw = Number(args.limit ?? DEFAULT_LIMIT);
65
+ const limit = Number.isFinite(limitRaw) ? Math.min(MAX_LIMIT, Math.max(1, Math.trunc(limitRaw))) : DEFAULT_LIMIT;
66
+ const includeUnavailable = args.includeUnavailable === true;
67
+ const withGroupStats = args.withGroupStats !== false;
68
+ const typeArg = args.type;
69
+ if (typeArg !== undefined && typeArg !== 'all' && typeArg !== 0 && typeArg !== 1) {
70
+ throw ehrValidationError('invalid_type', 'type 只能是 0(公共标签)、1(私有标签)或 "all"');
71
+ }
72
+ const types = typeArg === 'all' ? [0, 1] : [Number(typeArg ?? 0)];
73
+ const collected = [];
74
+ const seen = new Set();
75
+ let reportedTotal = 0;
76
+ for (const type of types) {
77
+ let pageNo = 1;
78
+ let total = null;
79
+ while (true) {
80
+ const page = await queryPage(env, { type, keyword, groupId, pageNo, pageSize: MAX_PAGE_SIZE });
81
+ if (page.total !== null)
82
+ total = page.total;
83
+ for (const raw of page.rows) {
84
+ const item = normalizeTag(raw);
85
+ if (!item)
86
+ continue;
87
+ // 服务端参数可能失效(尤其 groupId),此处再兜一层,保证 filter 语义可信
88
+ if (groupId !== undefined && item.groupId !== groupId)
89
+ continue;
90
+ if (!includeUnavailable && !item.available)
91
+ continue;
92
+ const key = `${item.type}:${item.tagId}`;
93
+ if (seen.has(key))
94
+ continue;
95
+ seen.add(key);
96
+ collected.push(item);
97
+ }
98
+ if (!page.rows.length)
99
+ break;
100
+ if (collected.length >= limit)
101
+ break;
102
+ if (total !== null && pageNo * MAX_PAGE_SIZE >= total)
103
+ break;
104
+ pageNo += 1;
105
+ if (pageNo > 30)
106
+ break; // 防御:服务端不回 total 时避免无限翻页
107
+ }
108
+ reportedTotal += total ?? 0;
109
+ }
110
+ const items = collected.slice(0, limit);
111
+ const groupStats = withGroupStats
112
+ ? [...new Map(items.reduce((m, x) => {
113
+ m.set(x.groupId, (m.get(x.groupId) ?? 0) + 1);
114
+ return m;
115
+ }, new Map()).entries())]
116
+ .map(([groupId, count]) => ({ groupId, count }))
117
+ .sort((a, b) => b.count - a.count)
118
+ : undefined;
119
+ // 诚实提示:当前环境下标签池基本未按业务分组,是否"混入非 HR 标签"取决于池子本身
120
+ const notes = [];
121
+ if (groupId === undefined && keyword === '' && groupStats && groupStats.length) {
122
+ const top = groupStats[0];
123
+ const topShare = items.length ? top.count / items.length : 0;
124
+ if (topShare >= 0.7) {
125
+ // 截断时组分布只覆盖本次返回的样本,必须点明范围,否则会被读成全量结论
126
+ const truncated = reportedTotal > 0 && items.length < reportedTotal;
127
+ const scope = truncated ? `本次返回的 ${items.length} 条样本(非全量)` : '全部结果';
128
+ notes.push(`标签池未按业务分组:groupId=${top.groupId} 占${scope}的 ${top.count}/${items.length}。` +
129
+ `招聘标签与客户/项目等其他业务标签混在同一池子里,要真正隔离需在 EB 侧新建招聘标签组,再按 groupId 过滤。` +
130
+ (truncated ? ' 想看全量组分布请调大 limit。' : ''));
131
+ }
132
+ }
133
+ if (keyword)
134
+ notes.push(`已按名称包含匹配「${keyword}」;服务端 name 参数实测有效。`);
135
+ if (groupId !== undefined)
136
+ notes.push(`已按 groupId=${groupId} 过滤(服务端参数实测有效,客户端再兜一层校验)。`);
137
+ if (reportedTotal && items.length < reportedTotal) {
138
+ notes.push(`命中 ${reportedTotal} 条,本次返回 ${items.length} 条(受 limit=${limit} 限制,可调大 limit 或用 keyword/groupId 收窄)。`);
139
+ }
140
+ return ehrSuccess('ehr.recruit.tag.list', {
141
+ keyword: keyword || null,
142
+ groupId: groupId ?? null,
143
+ types,
144
+ total: reportedTotal || null,
145
+ returned: items.length,
146
+ items,
147
+ groupStats,
148
+ note: notes.length ? notes.join(' ') : undefined,
149
+ });
150
+ }
151
+ export const recruitTagOperations = [
152
+ {
153
+ name: 'ehr.recruit.tag.list',
154
+ resource: 'recruit.tag',
155
+ method: 'list',
156
+ action: 'tag.list',
157
+ summary: '列招聘可用的平台标签(只读):支持按名称关键词、groupId 精确过滤,并给出组分布以便判断标签池是否已分组治理',
158
+ capability: 'recruit.tag.list',
159
+ risk: READ,
160
+ inputSchema: schemaOf({
161
+ keyword: { type: 'string', description: '标签名称关键词(服务端为包含匹配,实测有效)。如「本科」「技术」' },
162
+ groupId: { type: 'string', description: '标签组 id(服务端唯一生效的过滤参数;tagGroup 无效)。如 "1"' },
163
+ type: {
164
+ oneOf: [{ type: 'integer', enum: [0, 1] }, { type: 'string', enum: ['all'] }],
165
+ description: '0=公共标签(默认)、1=私有标签、"all"=两者都要',
166
+ },
167
+ limit: { type: 'integer', minimum: 1, maximum: MAX_LIMIT, description: `最多返回条数,默认 ${DEFAULT_LIMIT}` },
168
+ includeUnavailable: { type: 'boolean', description: '是否包含已停用标签,默认 false' },
169
+ withGroupStats: { type: 'boolean', description: '是否返回组分布,默认 true' },
170
+ }, { description: '只读查询,不创建、不修改任何标签' }),
171
+ handler: listTags,
172
+ },
173
+ ];
@@ -17,6 +17,17 @@ async function verifyLease(args, action, env) {
17
17
  if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
18
18
  throw ehrValidationError('context_mismatch', '确认上下文已变化(租户或登录账号不同),请重新执行 prepare');
19
19
  }
20
+ // 🔴 2026-11-07 修复(真机发现):prepare 早已把完整业务参数存进 payload({...args, formId, objId, dataDetails}),
21
+ // 但各 apply 处理器此前只从 args 取 talentId/type/...,导致 Agent 按协议文档「apply 只带 confirm + continuation」
22
+ // 必然报 talent_id_required —— 文档写法与实际行为冲突。这里把 payload 里的业务参数补回 args(显式传的优先),
23
+ // 使 apply 真正可以只带这两项;formId/objId/dataDetails 属内部产物,不回填以免覆盖。
24
+ const snap = (lease.payload && typeof lease.payload === 'object') ? lease.payload : {};
25
+ for (const [k, v] of Object.entries(snap)) {
26
+ if (k === 'formId' || k === 'objId' || k === 'dataDetails')
27
+ continue;
28
+ if (args[k] === undefined || args[k] === null || args[k] === '')
29
+ args[k] = v;
30
+ }
20
31
  return lease;
21
32
  }
22
33
  function isNetworkError(error) {
@@ -194,15 +205,72 @@ export async function getDsOptions(host, objId, fieldId, groupId) {
194
205
  }
195
206
  return map;
196
207
  }
197
- /** 人员名称 → userId(门户字段 browser/complete/resource) */
198
- export async function resolvePersonId(host, fieldId, keyword) {
208
+ /**
209
+ * 人员名称 → userId。
210
+ *
211
+ * 主通道:`POST /api/hrm/common/browser/data/resource`——真正按关键词过滤的人员搜索
212
+ * (2026-11-07 实测:搜「李伟」返回 4 人「李伟(上海)/李伟(北京)/李伟松(惠州)/李伟(TJ)」,
213
+ * 搜「顾梦瑶」返回 0 条,说明它确实按关键字过滤,而不是返回默认列表)。
214
+ *
215
+ * 不要再退回 `browser/complete/resource`:那个接口在没有完整选择器上下文时**不按关键词过滤**,
216
+ * 只返回默认人员前 10 位(第一条常为当前登录用户),旧实现取 list[0] 导致面试官一律被写成当前用户。
217
+ *
218
+ * 匹配规则:姓名完全相同且唯一 → 用它;无完全匹配时,包含匹配唯一 → 用它;
219
+ * 命中多个则抛 `person_ambiguous`(附候选,由调用方让用户选),**绝不静默取第一条**。
220
+ * 完全没有命中返回 null,由调用方报"找不到"。
221
+ */
222
+ export async function resolvePersonId(host, _fieldId, keyword) {
223
+ const kw = String(keyword || '').trim();
224
+ if (!kw)
225
+ return null;
226
+ const formDatas = {
227
+ status: [{ statusSelect: ['normal'] }],
228
+ subcompany: [{ subcompanyOpt: 'in' }],
229
+ department: [{ departmentOpt: 'in' }],
230
+ role: [{ roleOpt: 'in' }],
231
+ position: [{ positionOpt: 'in' }],
232
+ superior: [{ superiorOpt: 'in' }],
233
+ };
234
+ if (/@/.test(kw))
235
+ formDatas.email = [{ emailOpt: 'in', emailInput: kw }];
236
+ else if (/^\d{11}$/.test(kw))
237
+ formDatas.mobile = [{ mobileOpt: 'in', mobileInput: kw }];
238
+ else
239
+ formDatas.username = [{ usernameOpt: 'in', usernameInput: kw }];
199
240
  const response = (await host.request({
200
- path: '/api/ebuilder/form/common/browser/complete/resource',
201
- body: { formParam: { fieldId, searchValue: keyword }, 'formParam.fieldId': fieldId, 'formParam.searchValue': keyword },
241
+ path: '/api/hrm/common/browser/data/resource',
242
+ body: {
243
+ browserMultiple: true, authWecahtBook: false,
244
+ wxDepNeedConvertCount: 0, wxEmpNeedConvertCount: 0, wxTotalNeedConvertCount: 0,
245
+ ...formDatas,
246
+ cmd: 'all', formDatas, quickSearchDatas: {}, type: 'and', current: 1, pageSize: 200,
247
+ containsNoneAccount: false, containsPartTimeEmployee: false, containsDls: false,
248
+ },
202
249
  }));
203
- const list = response?.data?.data || response?.data || [];
204
- const first = list[0];
205
- return first ? String(first.id || first.value || '') || null : null;
250
+ const rows = (response?.data?.data ?? [])
251
+ .filter((r) => r && (r.id || r.value) && r.name);
252
+ if (!rows.length)
253
+ return null;
254
+ const nameOf = (x) => String(x.name || '').trim();
255
+ const idOf = (x) => String(x.id ?? x.value ?? '');
256
+ const exact = rows.filter((r) => nameOf(r) === kw);
257
+ if (exact.length === 1)
258
+ return idOf(exact[0]) || null;
259
+ if (exact.length > 1)
260
+ throw ambiguousPerson(kw, exact);
261
+ if (rows.length === 1)
262
+ return idOf(rows[0]) || null;
263
+ throw ambiguousPerson(kw, rows);
264
+ }
265
+ /** 多人命中:把候选摆出来让用户选,禁止自动取第一条。 */
266
+ function ambiguousPerson(keyword, rows) {
267
+ const candidates = rows.slice(0, 20).map((r) => ({
268
+ id: String(r.id ?? r.value ?? ''),
269
+ name: String(r.name ?? ''),
270
+ department: String(r.department ?? ''),
271
+ position: String(r.position ?? ''),
272
+ }));
273
+ return ehrValidationError('person_ambiguous', `人员「${keyword}」命中 ${rows.length} 人,请指明具体是哪一位:${candidates.map((c) => `${c.name}${c.department ? `(${c.department})` : ''}`).join('、')}`, { candidates });
206
274
  }
207
275
  /** saveFormData:新建(rightType 0)或更新(rightType 2,带 formDataId/updateTimeStamp/layoutId) */
208
276
  export async function saveFormData(host, params) {
@@ -444,11 +512,16 @@ const candidateCreateApply = {
444
512
  ...candidateCreateSchema,
445
513
  confirm: { const: true },
446
514
  continuation: { type: 'string', minLength: 1 },
447
- }, { required: ['name', 'mobile', 'confirm', 'continuation'] }),
515
+ },
516
+ // name/mobile 不再列入 required(2026-11-07):prepare 已把它们签进 continuation,
517
+ // apply 只带 confirm + continuation 即可;仍传则用于与快照比对防偷改。
518
+ { required: ['confirm', 'continuation'] }),
448
519
  handler: async (args, env) => {
449
520
  requireConfirm(args, 'ehr.recruit.candidate.create.apply');
450
- const { name, mobile } = validateNameMobile(args.name, args.mobile);
521
+ // 🔴 顺序很重要:先 verifyLease(把 payload 里的 name/mobile/channel 补回 args),再校验。
522
+ // 反过来写会导致「只带 continuation」时报 name_required——即文档写法和实现对不上。
451
523
  const lease = await verifyLease(args, 'ehr.recruit.candidate.create.apply', env);
524
+ const { name, mobile } = validateNameMobile(args.name, args.mobile);
452
525
  const payload = (lease.payload || {});
453
526
  // 指纹校验:apply 入参必须与 prepare 快照一致(防确认后偷改目标)
454
527
  const channelName = args.channel !== undefined && args.channel !== null && String(args.channel).trim() !== ''
@@ -545,11 +618,20 @@ const INTERVIEW_TYPES = ['现场面试', '视频面试', '电话面试', 'AI面
545
618
  const AI_DEFAULT_PLAN_NAME = '大模型面试';
546
619
  const INTERVIEW_DATAKEYS = ['subject', 'start_time', 'end_time', 'interview_type', 'interview_session', 'interviewer',
547
620
  'position_manage_id', 'talent_id', 'candidate_manage_id', 'mobile', 'email', 'interview_location', 'notice_mould'];
548
- function defaultInterviewWindow() {
621
+ /**
622
+ * 默认面试时间窗。
623
+ * 🔴 AI 面试的 end_time 语义是「面试截止时间」不是「结束时间」(2026-11-07 真机实测):
624
+ * 自用环境真实 AI 面试记录全部是 start ~ start+7 天,页面的 `aimszztznr` 通知文案也写着
625
+ * 「面试截止时间为:<start+7天>」。若按 1 小时写,候选人过了 1 小时就进不去 AI 面试。
626
+ * 落库后系统**不会**自动纠正成 7 天(已实测:技能建的 1335053505679089688 落库就是 1 小时)。
627
+ * stage 入口(recruit-stage/operations/interview-arrange.ts)本来就是 7 天,两入口必须一致。
628
+ */
629
+ function defaultInterviewWindow(isAI = false) {
549
630
  const pad = (n) => String(n).padStart(2, '0');
550
631
  const now = new Date();
551
632
  const fmt = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
552
- const end = new Date(now.getTime() + 60 * 60 * 1000);
633
+ const spanMs = isAI ? 7 * 24 * 60 * 60 * 1000 : 60 * 60 * 1000;
634
+ const end = new Date(now.getTime() + spanMs);
553
635
  return { start: fmt(now), end: fmt(end) };
554
636
  }
555
637
  /** 当前登录人(teamsCheck → currentUser.id/username):面试官未指定时的默认值。
@@ -762,7 +844,7 @@ async function buildInterviewPlan(env, cache, args) {
762
844
  if (interviewerInput) {
763
845
  interviewerId = await resolvePersonId(host, fieldIdOf('interviewer'), interviewerInput);
764
846
  if (!interviewerId) {
765
- throw ehrValidationError('interviewer_not_found', `面试官「${interviewerInput}」解析不到 userId(browser/complete/resource 无匹配)`);
847
+ throw ehrValidationError('interviewer_not_found', `面试官「${interviewerInput}」在人员库中查不到(可能姓名写错、不在本租户,或不是在职人员)`);
766
848
  }
767
849
  }
768
850
  else {
@@ -813,7 +895,7 @@ async function buildInterviewPlan(env, cache, args) {
813
895
  throw ehrValidationError('email_invalid', `候选人邮箱格式不正确:${email}`);
814
896
  }
815
897
  }
816
- const window = defaultInterviewWindow();
898
+ const window = defaultInterviewWindow(isAI);
817
899
  const start = typeof args.startTime === 'string' && args.startTime.trim() ? args.startTime.trim() : window.start;
818
900
  const end = typeof args.endTime === 'string' && args.endTime.trim() ? args.endTime.trim() : window.end;
819
901
  if (!/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(start) || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(end)) {
@@ -839,6 +921,7 @@ async function buildInterviewPlan(env, cache, args) {
839
921
  candidateName: candidate.name,
840
922
  positionName: candidate.positionName,
841
923
  interviewTime: `${start} ~ ${end}`,
924
+ timeFieldIds: { start: fieldIdOf('start_time'), end: fieldIdOf('end_time') },
842
925
  interviewer,
843
926
  email: email || undefined,
844
927
  mobile: mobile || undefined,
@@ -917,13 +1000,34 @@ const interviewArrangeApply = {
917
1000
  capability: 'recruit',
918
1001
  risk: WRITE,
919
1002
  requiresConfirmation: true,
920
- inputSchema: schemaOf({ ...interviewArrangeSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['talentId', 'interviewer', 'confirm', 'continuation'] }),
1003
+ inputSchema: schemaOf({ ...interviewArrangeSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } },
1004
+ // 业务参数(talentId/interviewer)已由 prepare 签进 continuation,apply 只需两项;
1005
+ // 显式传仍作数(与快照比对,用于防偷改)。
1006
+ { required: ['confirm', 'continuation'] }),
921
1007
  handler: async (args, env) => {
922
1008
  requireConfirm(args, 'ehr.recruit.candidate.interview.arrange.apply');
923
1009
  const lease = await verifyLease(args, 'ehr.recruit.candidate.interview.arrange.apply', env);
924
1010
  const payload = (lease.payload || {});
925
1011
  const cache = await requireRecruitCache(env);
1012
+ // 🔴 默认时间漂移修复(2026-11-07 实测):不加 startTime/endTime 时,prepare 与 apply 各自
1013
+ // 按「当前时刻 +1h」重算,两次执行必然差几分钟 → 指纹必然不一致 → apply 恒报 target_changed,
1014
+ // 真实「看摘要→确认→apply」流程根本无法完成。这里在调用方未显式传时间时复用 prepare 快照。
1015
+ const explicitTime = args.startTime !== undefined || args.endTime !== undefined;
926
1016
  const plan = await buildInterviewPlan(env, cache, args);
1017
+ if (!explicitTime && Array.isArray(payload.dataDetails) && payload.dataDetails.length) {
1018
+ const snap = payload.dataDetails;
1019
+ plan.dataDetails = snap;
1020
+ // 复用快照时同步修正输出时间:否则落库用快照时间、输出仍显示 apply 时刻重算的时间
1021
+ // (实测 2026-11-07:落库 14:44、apply 输出 14:46,差 2 分钟,Agent 会把错的时间回给用户)
1022
+ const pick = (fid) => {
1023
+ const hit = snap.find((d) => String(d?.formField?.id || '') === fid);
1024
+ return typeof hit?.content === 'string' ? hit.content : null;
1025
+ };
1026
+ const s = pick(plan.timeFieldIds.start);
1027
+ const e = pick(plan.timeFieldIds.end);
1028
+ if (s && e)
1029
+ plan.interviewTime = `${s} ~ ${e}`;
1030
+ }
927
1031
  if (fingerprint({ dataDetails: plan.dataDetails, notify: args.notify === true }) !== lease.fingerprint) {
928
1032
  throw ehrValidationError('target_changed', '输入与 prepare 时的快照不一致(候选人/面试官/时间等被修改),请重新执行 prepare');
929
1033
  }
@@ -979,6 +1083,18 @@ const interviewArrangeApply = {
979
1083
  return ehrSuccess('ehr.recruit.candidate.interview.arrange.apply', {
980
1084
  status: 'COMPLETE',
981
1085
  interviewFormId: planFormId,
1086
+ // 🔴 两入口产出不同质,必须显式标注(2026-11-07 实测):本入口只做「建面试单 + assignedInterview」,
1087
+ // 额外动作仅在 notify=true 时补跑「新建日程」esb;**不**执行页面那一整串按钮动作流。
1088
+ // 而 ehr.recruit.stage.interview.arrange.apply 会无条件跑 prepare 侧解析到的全部 saveActions
1089
+ // (含「新建EB日程」「安排面试后续动作API」「AI面试时发送提醒」等)。要完整页面效果就用 stage 入口。
1090
+ sideEffects: {
1091
+ executesFormButtonActions: false,
1092
+ onlyAction: 'assignedInterview',
1093
+ scheduleCreation: notify ? 'runEsb:新建日程' : 'skipped(notify=false)',
1094
+ },
1095
+ consistencyNote: '本入口写入的面试单不触发页面按钮动作流(无「新建EB日程/AI面试提醒/后续动作」);'
1096
+ + '落库的「状态(union_status)」也不由本入口设置。若需要与页面手工「安排面试」完全一致的副作用,'
1097
+ + '请改用 ehr.recruit.stage.interview.arrange.prepare/apply,并在摘要里核对 saveActions 列表。',
982
1098
  notify: notifyResult,
983
1099
  assigned: assigned?.data || {},
984
1100
  candidate: `${plan.candidateName}(talentId=${args.talentId})`,
@@ -1033,6 +1149,9 @@ async function resolveOfferTemplate(host, cache, templateName) {
1033
1149
  const allData = (await host.request({
1034
1150
  path: '/api/ebuilder/form/dataset/v2/getAllData',
1035
1151
  body: { datajson: { header: { objId: mouldObjId }, mainTable: {}, pageInfo: { pageNo: 1, pageSize: 200 } } },
1152
+ // EB OpenAPI 族顶层无 code/status(message.code 为 "0"),跳过通用业务判定;
1153
+ // 是否成功由下面读取 `data.datajson.datas` 的调用方按数据自身判断。
1154
+ skipBusinessCheck: true,
1036
1155
  }));
1037
1156
  const datas = allData?.data?.datajson?.datas || [];
1038
1157
  const hit = datas.find((item) => {
@@ -1161,7 +1280,7 @@ const offerSendApply = {
1161
1280
  capability: 'recruit',
1162
1281
  risk: WRITE,
1163
1282
  requiresConfirmation: true,
1164
- inputSchema: schemaOf({ ...offerSendSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['talentId', 'confirm', 'continuation'] }),
1283
+ inputSchema: schemaOf({ ...offerSendSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['confirm', 'continuation'] }),
1165
1284
  handler: async (args, env) => {
1166
1285
  requireConfirm(args, 'ehr.recruit.offer.send.apply');
1167
1286
  const lease = await verifyLease(args, 'ehr.recruit.offer.send.apply', env);
@@ -1438,7 +1557,7 @@ const entryProcessApply = {
1438
1557
  capability: 'recruit',
1439
1558
  risk: WRITE,
1440
1559
  requiresConfirmation: true,
1441
- inputSchema: schemaOf({ ...entryProcessSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['talentId', 'departmentId', 'positionRankId', 'confirm', 'continuation'] }),
1560
+ inputSchema: schemaOf({ ...entryProcessSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['confirm', 'continuation'] }),
1442
1561
  handler: async (args, env) => {
1443
1562
  requireConfirm(args, 'ehr.recruit.entry.process.apply');
1444
1563
  const lease = await verifyLease(args, 'ehr.recruit.entry.process.apply', env);
@@ -1673,7 +1792,7 @@ const feedbackEditApply = {
1673
1792
  capability: 'recruit',
1674
1793
  risk: WRITE,
1675
1794
  requiresConfirmation: true,
1676
- inputSchema: schemaOf({ ...feedbackEditSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['talentId', 'confirm', 'continuation'] }),
1795
+ inputSchema: schemaOf({ ...feedbackEditSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['confirm', 'continuation'] }),
1677
1796
  handler: async (args, env) => {
1678
1797
  requireConfirm(args, 'ehr.recruit.candidate.interview.feedback.edit.apply');
1679
1798
  const lease = await verifyLease(args, 'ehr.recruit.candidate.interview.feedback.edit.apply', env);
@@ -1853,7 +1972,7 @@ const feedbackUrgeApply = {
1853
1972
  capability: 'recruit',
1854
1973
  risk: WRITE,
1855
1974
  requiresConfirmation: true,
1856
- inputSchema: schemaOf({ ...feedbackUrgeSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['talentId', 'confirm', 'continuation'] }),
1975
+ inputSchema: schemaOf({ ...feedbackUrgeSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['confirm', 'continuation'] }),
1857
1976
  handler: async (args, env) => {
1858
1977
  requireConfirm(args, 'ehr.recruit.candidate.interview.feedback.urge.apply');
1859
1978
  const lease = await verifyLease(args, 'ehr.recruit.candidate.interview.feedback.urge.apply', env);