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.
- package/dist/chunks/{attachment-content-CE3GMWTS.js → attachment-content-MCXQBD6N.js} +3 -3
- package/dist/chunks/{chunk-VIMCY4DI.js → chunk-4RWS2YYL.js} +2 -2
- package/dist/chunks/{chunk-4EXOIQDI.js → chunk-6AXKWFKG.js} +4 -14
- package/dist/chunks/{chunk-JWWTI63L.js → chunk-6V5ZPKHV.js} +2 -8
- package/dist/chunks/{chunk-3ZMAQQ3W.js → chunk-76H3IKH6.js} +39 -26
- package/dist/chunks/{chunk-LGKWL4OH.js → chunk-AD46OMQK.js} +86 -25
- package/dist/chunks/{chunk-3WBIQLMB.js → chunk-GSZTA43P.js} +2 -2
- package/dist/chunks/{chunk-OAE3AZBQ.js → chunk-IP4CWQCF.js} +6 -6
- package/dist/chunks/{chunk-77YP6I52.js → chunk-IRMIEDXN.js} +1 -1
- package/dist/chunks/{chunk-LRCPNDZA.js → chunk-J2VEB5K3.js} +11 -9
- package/dist/chunks/{chunk-T4MWQAQB.js → chunk-JFAWZX53.js} +128 -9
- package/dist/chunks/{chunk-GR76ZDDX.js → chunk-LIEQJIGM.js} +3 -0
- package/dist/chunks/{chunk-DGMYACGJ.js → chunk-OXHHJWNC.js} +1 -1
- package/dist/chunks/{chunk-LXFVWZLM.js → chunk-PSOMGA3U.js} +3 -3
- package/dist/chunks/{conflict-IYJETSGT.js → conflict-H7EHQXYY.js} +2 -2
- package/dist/chunks/{create-flow-7JLC7UID.js → create-flow-VRVJEOBX.js} +6 -6
- package/dist/chunks/{ehr-MYRDCHZ4.js → ehr-SH2LM3NK.js} +528 -40
- package/dist/chunks/{env-3MBHAWBL.js → env-66FPSJDV.js} +2 -2
- package/dist/chunks/{factory-TZEVU4DU.js → factory-UH2TZBVA.js} +1 -1
- package/dist/chunks/{group-chat-KL3HFKRM.js → group-chat-CAKMMV7K.js} +3 -3
- package/dist/chunks/{invoice-OQP3TMKQ.js → invoice-UEAHSYAE.js} +279 -1
- package/dist/chunks/{lazy-dispatch-UH6HGK2I.js → lazy-dispatch-25XGTXLM.js} +2 -2
- package/dist/chunks/{meeting-C67EHQ4Z.js → meeting-VTBFW4HI.js} +10 -10
- package/dist/chunks/{recruit-stage-AHY5QAMF.js → recruit-stage-CAKZTUA7.js} +917 -85
- package/dist/chunks/{registry-XPWPGHYE.js → registry-JVQBLFQ5.js} +10 -10
- package/dist/chunks/{room-recommend-CNWE5WQK.js → room-recommend-5U55FMXZ.js} +4 -4
- package/dist/chunks/{schedule-YYNYBQIE.js → schedule-IDETODCA.js} +4 -4
- package/dist/cmd/action.js +14 -10
- package/dist/index.js +7 -7
- package/dist/shortcuts/ehr/host.js +2 -2
- package/dist/shortcuts/ehr/index.js +14 -3
- package/dist/shortcuts/ehr/manifest.js +5 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +40 -10
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +10 -8
- package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +137 -18
- package/dist/shortcuts/ehr/operations/recruit.js +180 -8
- package/dist/shortcuts/ehr/operations/registry.js +4 -0
- package/dist/shortcuts/ehr/operations.js +24 -0
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
- package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
- package/dist/shortcuts/invoice/host.js +3 -0
- package/dist/shortcuts/invoice/manifest.js +61 -0
- package/dist/shortcuts/invoice/operations/registry.js +2 -0
- package/dist/shortcuts/invoice/operations/reim-subsidy.js +233 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +93 -18
- package/dist/shortcuts/meeting/operations/eb/factory.js +5 -8
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +2 -13
- package/dist/shortcuts/meeting/operations/invitation.js +27 -4
- package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +277 -20
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +31 -7
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +106 -16
- package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +273 -6
- package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
- package/dist/shortcuts/recruit-stage/shared.js +60 -6
- package/docs/invoice.md +1 -0
- package/package.json +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +2 -2
- package/skills/weaver-e10-jucailin/SKILL.md +12 -3
- package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
- package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -93
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
- package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +53 -9
- package/skills/weaver-e10-meeting/SKILL.md +48 -4
- package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +8 -5
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +16 -6
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +20 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +21 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +4 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +7 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +9 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +68 -6
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +3 -3
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +8 -15
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +6 -5
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +206 -92
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +26 -21
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +35 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量任务的暂存清单(2026-11-06)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用 continuation 直接携带:
|
|
5
|
+
* 批量简历导入的每一项都带 `structured`(整份简历 JSON),几十份时 token 会膨胀到几十万字符,
|
|
6
|
+
* Agent 传参不现实。这里把清单落到本机 `~/.weaver-work-cli/batch/`,token 只带文件路径 + 指纹;
|
|
7
|
+
* apply 时重算指纹,不一致即拒绝(防止清单被中途改写)。
|
|
8
|
+
*
|
|
9
|
+
* 安全:
|
|
10
|
+
* - 目录 0700、文件 0600;
|
|
11
|
+
* - 只允许读 batch 目录内的文件(防越权读任意路径);
|
|
12
|
+
* - 24 小时以上的旧清单在下次写入时清理。
|
|
13
|
+
*/
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
15
|
+
import { chmodSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { homedir } from 'node:os';
|
|
17
|
+
import { join, resolve, sep } from 'node:path';
|
|
18
|
+
import { rsValidationError } from './errors.js';
|
|
19
|
+
function batchDir() {
|
|
20
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
|
|
21
|
+
const dir = join(home, 'batch');
|
|
22
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
function digest(value) {
|
|
26
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
27
|
+
}
|
|
28
|
+
function cleanup(dir) {
|
|
29
|
+
try {
|
|
30
|
+
const now = Date.now();
|
|
31
|
+
for (const f of readdirSync(dir)) {
|
|
32
|
+
if (!f.endsWith('.json'))
|
|
33
|
+
continue;
|
|
34
|
+
const p = join(dir, f);
|
|
35
|
+
try {
|
|
36
|
+
if (now - statSync(p).mtimeMs > 24 * 3600 * 1000)
|
|
37
|
+
unlinkSync(p);
|
|
38
|
+
}
|
|
39
|
+
catch { /* 单文件清理失败忽略 */ }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch { /* 目录不可读忽略 */ }
|
|
43
|
+
}
|
|
44
|
+
/** 落盘批量清单,返回文件路径与内容指纹。 */
|
|
45
|
+
export function saveBatchItems(kind, items) {
|
|
46
|
+
const dir = batchDir();
|
|
47
|
+
cleanup(dir);
|
|
48
|
+
const fingerprint = digest(items);
|
|
49
|
+
const file = join(dir, `${kind}-${fingerprint.slice(0, 16)}.json`);
|
|
50
|
+
writeFileSync(file, JSON.stringify(items), { mode: 0o600 });
|
|
51
|
+
try {
|
|
52
|
+
chmodSync(file, 0o600);
|
|
53
|
+
}
|
|
54
|
+
catch { /* Windows 上可能不支持 */ }
|
|
55
|
+
return { file, fingerprint };
|
|
56
|
+
}
|
|
57
|
+
/** 读取并校验批量清单(路径必须在 batch 目录内,内容指纹必须与 token 一致)。 */
|
|
58
|
+
export function loadBatchItems(file, expectedFingerprint) {
|
|
59
|
+
const dir = resolve(batchDir());
|
|
60
|
+
const target = resolve(String(file || ''));
|
|
61
|
+
if (!target.startsWith(dir + sep)) {
|
|
62
|
+
throw rsValidationError('batch_file_invalid', '批量清单路径非法(必须位于 CLI 的 batch 目录内)');
|
|
63
|
+
}
|
|
64
|
+
let items;
|
|
65
|
+
try {
|
|
66
|
+
items = JSON.parse(readFileSync(target, 'utf8'));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw rsValidationError('batch_file_missing', '批量清单已失效(文件被移动或删除),请重新 prepare');
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(items)) {
|
|
72
|
+
throw rsValidationError('batch_file_invalid', '批量清单格式不正确,请重新 prepare');
|
|
73
|
+
}
|
|
74
|
+
if (digest(items) !== String(expectedFingerprint || '')) {
|
|
75
|
+
throw rsValidationError('batch_file_tampered', '批量清单与确认时不一致(文件被修改),已拒绝执行,请重新 prepare');
|
|
76
|
+
}
|
|
77
|
+
return items;
|
|
78
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量简历导入的本地文件枚举(2026-11-06)。
|
|
3
|
+
*
|
|
4
|
+
* 职责边界:
|
|
5
|
+
* - 只做「把用户给的文件夹 / zip 包变成待处理文件清单」,不解析简历内容;
|
|
6
|
+
* - 解压走 Node 内置 zlib(不引第三方依赖,不调系统 unzip),Windows/macOS/Linux 一致;
|
|
7
|
+
* - 文件名编码:zip 通用标志位 bit 11 = UTF-8,否则按 GBK 尝试(Windows 中文系统常见);
|
|
8
|
+
* - 路径安全:拒绝绝对路径与 `..`(zip-slip),跳过 `__MACOSX/` 与目录项。
|
|
9
|
+
*/
|
|
10
|
+
import { mkdtempSync, readdirSync, readFileSync, statSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { tmpdir } from 'node:os';
|
|
12
|
+
import { basename, dirname, extname, join, resolve } from 'node:path';
|
|
13
|
+
import { inflateRawSync } from 'node:zlib';
|
|
14
|
+
export const RESUME_EXTS = new Set(['.pdf', '.doc', '.docx', '.rtf', '.txt', '.wps']);
|
|
15
|
+
function decodeName(bytes, utf8Flag) {
|
|
16
|
+
if (utf8Flag)
|
|
17
|
+
return bytes.toString('utf8');
|
|
18
|
+
try {
|
|
19
|
+
return new TextDecoder('gbk').decode(bytes);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return bytes.toString('utf8');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** 解压 zip 到系统临时目录,返回目录路径。只支持 store/deflate(覆盖常规压缩方式)。 */
|
|
26
|
+
export function extractZip(zipPath) {
|
|
27
|
+
const buf = readFileSync(zipPath);
|
|
28
|
+
let eocd = -1;
|
|
29
|
+
const floor = Math.max(0, buf.length - 22 - 65535);
|
|
30
|
+
for (let i = buf.length - 22; i >= floor; i--) {
|
|
31
|
+
if (buf.readUInt32LE(i) === 0x06054b50) {
|
|
32
|
+
eocd = i;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (eocd < 0)
|
|
37
|
+
throw new Error('不是有效的 zip 文件(找不到中央目录结尾标记)');
|
|
38
|
+
const count = buf.readUInt16LE(eocd + 10);
|
|
39
|
+
let off = buf.readUInt32LE(eocd + 16);
|
|
40
|
+
if (count === 0xffff || off === 0xffffffff) {
|
|
41
|
+
throw new Error('暂不支持 ZIP64(超大压缩包),请拆分成多个普通 zip 后重试');
|
|
42
|
+
}
|
|
43
|
+
const dest = mkdtempSync(join(tmpdir(), 'e10-resume-'));
|
|
44
|
+
let written = 0;
|
|
45
|
+
for (let i = 0; i < count; i++) {
|
|
46
|
+
if (off + 46 > buf.length || buf.readUInt32LE(off) !== 0x02014b50)
|
|
47
|
+
break;
|
|
48
|
+
const flags = buf.readUInt16LE(off + 8);
|
|
49
|
+
const method = buf.readUInt16LE(off + 10);
|
|
50
|
+
const compSize = buf.readUInt32LE(off + 20);
|
|
51
|
+
const nameLen = buf.readUInt16LE(off + 28);
|
|
52
|
+
const extraLen = buf.readUInt16LE(off + 30);
|
|
53
|
+
const commentLen = buf.readUInt16LE(off + 32);
|
|
54
|
+
const localOff = buf.readUInt32LE(off + 42);
|
|
55
|
+
const rawName = buf.subarray(off + 46, off + 46 + nameLen);
|
|
56
|
+
const name = decodeName(rawName, (flags & 0x800) !== 0);
|
|
57
|
+
off += 46 + nameLen + extraLen + commentLen;
|
|
58
|
+
if (!name || name.endsWith('/') || name.startsWith('__MACOSX/'))
|
|
59
|
+
continue;
|
|
60
|
+
const rawParts = name.replace(/\\/g, '/').split('/');
|
|
61
|
+
// zip-slip 防护:路径里出现 .. 直接丢弃整个条目(不做"剥离后落盘",避免歧义)
|
|
62
|
+
if (rawParts.some((s) => s === '..'))
|
|
63
|
+
continue;
|
|
64
|
+
const parts = rawParts.filter((s) => s && s !== '.' && !/^[a-zA-Z]:$/.test(s));
|
|
65
|
+
if (!parts.length)
|
|
66
|
+
continue;
|
|
67
|
+
if (method !== 0 && method !== 8)
|
|
68
|
+
continue; // 只处理 store/deflate
|
|
69
|
+
const lNameLen = buf.readUInt16LE(localOff + 26);
|
|
70
|
+
const lExtraLen = buf.readUInt16LE(localOff + 28);
|
|
71
|
+
const dataStart = localOff + 30 + lNameLen + lExtraLen;
|
|
72
|
+
if (dataStart + compSize > buf.length)
|
|
73
|
+
continue;
|
|
74
|
+
const raw = buf.subarray(dataStart, dataStart + compSize);
|
|
75
|
+
let out;
|
|
76
|
+
try {
|
|
77
|
+
out = method === 0 ? raw : inflateRawSync(raw);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
continue; // 单个条目损坏不影响其他文件
|
|
81
|
+
}
|
|
82
|
+
const target = join(dest, ...parts);
|
|
83
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
84
|
+
writeFileSync(target, out);
|
|
85
|
+
written++;
|
|
86
|
+
}
|
|
87
|
+
if (!written)
|
|
88
|
+
throw new Error('zip 内没有可读取的文件(可能为空包或使用了不支持的压缩方式)');
|
|
89
|
+
return dest;
|
|
90
|
+
}
|
|
91
|
+
function walk(dir, root, out, warnings, depth) {
|
|
92
|
+
if (depth > 4)
|
|
93
|
+
return;
|
|
94
|
+
let entries;
|
|
95
|
+
try {
|
|
96
|
+
entries = readdirSync(dir);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
warnings.push(`目录不可读:${dir}(${e?.message || '未知原因'})`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
for (const name of entries) {
|
|
103
|
+
const p = join(dir, name);
|
|
104
|
+
let st;
|
|
105
|
+
try {
|
|
106
|
+
st = statSync(p);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (st.isDirectory()) {
|
|
112
|
+
if (name === '__MACOSX' || name.startsWith('.'))
|
|
113
|
+
continue;
|
|
114
|
+
walk(p, root, out, warnings, depth + 1);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!RESUME_EXTS.has(extname(name).toLowerCase()))
|
|
118
|
+
continue;
|
|
119
|
+
out.push({ path: p, name, size: st.size });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** 扫描文件夹或 zip,返回按文件名排序的简历文件清单。 */
|
|
123
|
+
export function scanResumeSource(source) {
|
|
124
|
+
const warnings = [];
|
|
125
|
+
const abs = resolve(source);
|
|
126
|
+
let st;
|
|
127
|
+
try {
|
|
128
|
+
st = statSync(abs);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
throw new Error(`路径不存在或不可读:${source}`);
|
|
132
|
+
}
|
|
133
|
+
let root = abs;
|
|
134
|
+
let tempDir;
|
|
135
|
+
if (st.isFile()) {
|
|
136
|
+
if (extname(abs).toLowerCase() !== '.zip') {
|
|
137
|
+
throw new Error('source 只支持文件夹或 .zip 压缩包');
|
|
138
|
+
}
|
|
139
|
+
tempDir = extractZip(abs);
|
|
140
|
+
root = tempDir;
|
|
141
|
+
}
|
|
142
|
+
else if (!st.isDirectory()) {
|
|
143
|
+
throw new Error('source 只支持文件夹或 .zip 压缩包');
|
|
144
|
+
}
|
|
145
|
+
const files = [];
|
|
146
|
+
walk(root, root, files, warnings, 0);
|
|
147
|
+
files.sort((a, b) => a.name.localeCompare(b.name, 'zh-Hans-CN'));
|
|
148
|
+
return { root, files, warnings, tempDir };
|
|
149
|
+
}
|
|
150
|
+
/** 为某个简历文件找同名结构化 JSON(同目录或指定目录)。 */
|
|
151
|
+
export function findStructuredJson(file, structuredDir) {
|
|
152
|
+
const base = basename(file.name, extname(file.name));
|
|
153
|
+
const candidates = [
|
|
154
|
+
join(dirname(file.path), base + '.json'),
|
|
155
|
+
...(structuredDir ? [join(resolve(structuredDir), base + '.json')] : []),
|
|
156
|
+
];
|
|
157
|
+
for (const c of candidates) {
|
|
158
|
+
try {
|
|
159
|
+
if (statSync(c).isFile())
|
|
160
|
+
return c;
|
|
161
|
+
}
|
|
162
|
+
catch { /* 继续找下一个 */ }
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
@@ -300,7 +300,11 @@ async function buildPlan(opts) {
|
|
|
300
300
|
// 真正 await 时若失败再抛原错,保持与串行完全一致的错误语义。
|
|
301
301
|
const interviewerTask = (async () => {
|
|
302
302
|
if (interviewer) {
|
|
303
|
-
|
|
303
|
+
// 指定了姓名但人员库里查不到时,报"找不到",不要落到下面"未指定"的兜底文案(会误导成没传参数)。
|
|
304
|
+
const id = await resolvePersonId(host, fid('interviewer'), interviewer);
|
|
305
|
+
if (!id)
|
|
306
|
+
throw rsFail(`面试官「${interviewer}」在人员库中查不到(可能姓名写错、不在本租户,或不是在职人员)`);
|
|
307
|
+
return { id, name: interviewer };
|
|
304
308
|
}
|
|
305
309
|
const cu = await resolveCurrentUser(host);
|
|
306
310
|
return cu ? { id: cu.id, name: cu.name } : { id: null, name: interviewer };
|
|
@@ -411,6 +415,10 @@ async function buildPlan(opts) {
|
|
|
411
415
|
aiPlanPicked, aiPlanOptions,
|
|
412
416
|
summary: {
|
|
413
417
|
action: '安排面试',
|
|
418
|
+
talentId,
|
|
419
|
+
// 单独给一个纯姓名字段:batch 结果表必须用人名,不能拿 talentId 充当「候选人」
|
|
420
|
+
// (W8:旧版 batch.apply 的 resultTable 显示 100005840000020214,同条 viewLink 却写「李伟」)
|
|
421
|
+
candidateName: cand.name,
|
|
414
422
|
talent: cand.name + '(talentId=' + talentId + ')',
|
|
415
423
|
position: cand.positionName, type, session,
|
|
416
424
|
time: start + ' ~ ' + end, interviewer: interviewerName,
|
|
@@ -530,6 +538,11 @@ async function resolveInterviewListUrl(ctx) {
|
|
|
530
538
|
return null;
|
|
531
539
|
return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
|
|
532
540
|
}
|
|
541
|
+
// 🔴 面试方式默认值(2026-11-07 统一):四个入口此前三种默认——prefill 用「AI面试」、prepare/apply/batch 用
|
|
542
|
+
// 「现场面试」、而表单 defaultValues.interview_type 又是「视频面试」,同一件事三份摘要互相打脸。
|
|
543
|
+
// 现统一为「现场面试」:它不需要邮箱与 AI 方案,缺省路径不会因必填缺失而中途失败。
|
|
544
|
+
// 表单默认值仍在 prepare 的 requiredHint.defaultValues 中原样保留,用户要别的就显式传 type。
|
|
545
|
+
const DEFAULT_INTERVIEW_TYPE = '现场面试';
|
|
533
546
|
// 默认时间:与页面「选 AI面试」联动一致 —— AI=当前时间~+7天,其它=1小时。分钟精度。
|
|
534
547
|
function nowAndEnd(type) {
|
|
535
548
|
const isAI = /AI|人工智能/i.test(String(type || ''));
|
|
@@ -588,20 +601,22 @@ const baseInput = {
|
|
|
588
601
|
email: { type: 'string', description: '候选人邮箱(AI 面试必填;补录值优先于人才资料)' },
|
|
589
602
|
aiPlan: { type: 'string', description: 'AI 面试方案名或 id(AI 面试必填;不传则 prepare 列出候选)' },
|
|
590
603
|
};
|
|
591
|
-
async function prepare(args, env) {
|
|
604
|
+
async function prepare(args, env, opts = {}) {
|
|
592
605
|
const ctx = await makeCtx(env);
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
606
|
+
if (!opts.skipPermissionProbe) {
|
|
607
|
+
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, 'interview_plan'));
|
|
608
|
+
if (perm === 'denied')
|
|
609
|
+
throw rsFail('当前账号没有「面试计划」表单的创建权限,已阻断(未写入任何数据)');
|
|
610
|
+
}
|
|
596
611
|
const talentId = await locateTalentId(ctx, args);
|
|
597
|
-
const auto = nowAndEnd(args.type ||
|
|
612
|
+
const auto = nowAndEnd(String(args.type || DEFAULT_INTERVIEW_TYPE));
|
|
598
613
|
const startTime = args.start || auto.s;
|
|
599
614
|
const endTime = args.end || (args.start ? (shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : auto.e);
|
|
600
615
|
const plan = await buildPlan({
|
|
601
616
|
ctx, talentId,
|
|
602
617
|
positionId: args.positionId ? String(args.positionId) : undefined,
|
|
603
618
|
interviewer: args.interviewer ? String(args.interviewer) : undefined,
|
|
604
|
-
type: String(args.type ||
|
|
619
|
+
type: String(args.type || DEFAULT_INTERVIEW_TYPE), session: String(args.session || '初试'),
|
|
605
620
|
start: String(startTime), end: String(endTime),
|
|
606
621
|
email: args.email ? String(args.email) : undefined,
|
|
607
622
|
mobile: args.mobile ? String(args.mobile) : undefined,
|
|
@@ -630,7 +645,21 @@ async function prepare(args, env) {
|
|
|
630
645
|
const { createHash } = await import('node:crypto');
|
|
631
646
|
const fp = createHash('sha256').update(JSON.stringify(willSubmit)).digest('hex');
|
|
632
647
|
const continuation = await env.continuation.issue({ operation: 'recruit-stage.interview.arrange.apply', fingerprint: fp,
|
|
633
|
-
enumMaps: await dsOptionsSnapshot(), timeWindow: { start: String(startTime), end: String(endTime) }
|
|
648
|
+
enumMaps: await dsOptionsSnapshot(), timeWindow: { start: String(startTime), end: String(endTime) },
|
|
649
|
+
// 🔴 参数快照(2026-11-07 修复):协议文档写的是「apply 带 confirm:true + continuation」,
|
|
650
|
+
// 但 applyCore 原来只从 args 取 talentId/type/session…,Agent 少传任一项就直接报 talent_required。
|
|
651
|
+
// 现把 prepare 用过的参数一并签进 continuation,apply 可只带 confirm + continuation;
|
|
652
|
+
// 若 apply 显式传了同名字段,仍以显式值为准(batch 场景每人 talentId 不同,靠这条生效)。
|
|
653
|
+
argsSnapshot: {
|
|
654
|
+
talentId, type: String(args.type || DEFAULT_INTERVIEW_TYPE), session: String(args.session || '初试'),
|
|
655
|
+
positionId: args.positionId ? String(args.positionId) : undefined,
|
|
656
|
+
interviewer: args.interviewer ? String(args.interviewer) : undefined,
|
|
657
|
+
aiPlan: args.aiPlan ? String(args.aiPlan) : undefined,
|
|
658
|
+
email: args.email ? String(args.email) : undefined,
|
|
659
|
+
mobile: args.mobile ? String(args.mobile) : undefined,
|
|
660
|
+
rounds: args.rounds ? String(args.rounds) : undefined,
|
|
661
|
+
},
|
|
662
|
+
});
|
|
634
663
|
return rsSuccess('recruit-stage.interview.arrange.prepare', {
|
|
635
664
|
mode: 'prepare', ...plan.summary,
|
|
636
665
|
needAiPlan: plan.isAI && !plan.aiPlanPicked,
|
|
@@ -640,7 +669,25 @@ async function prepare(args, env) {
|
|
|
640
669
|
? 'AI面试方案为必填:请把 aiPlans 列给用户选择(isDefault=true 为页面默认方案),确认后带 aiPlan 重跑 apply'
|
|
641
670
|
: undefined,
|
|
642
671
|
requiredHint,
|
|
672
|
+
// 面试方式来源透明化:不传 type 时用 CLI 统一默认,同时把表单默认值一并给出,
|
|
673
|
+
// 两者不同就给 typeNote,避免"摘要说现场面试、表单默认写视频面试"这种自相矛盾没人发现。
|
|
674
|
+
typeSource: args.type ? 'explicit' : 'default',
|
|
675
|
+
formDefaultInterviewType: requiredHint?.defaultValues?.interview_type?.content,
|
|
676
|
+
typeNote: (!args.type
|
|
677
|
+
&& requiredHint?.defaultValues?.interview_type?.content
|
|
678
|
+
&& String(requiredHint.defaultValues.interview_type.content) !== DEFAULT_INTERVIEW_TYPE)
|
|
679
|
+
? `本次未指定 type,按 CLI 默认「${DEFAULT_INTERVIEW_TYPE}」提交;页面表单默认是「${requiredHint.defaultValues.interview_type.content}」,如需与该默认一致请显式传 type`
|
|
680
|
+
: undefined,
|
|
643
681
|
willSubmit,
|
|
682
|
+
// 🔴 2026-11-07:prepare 协议约定 preview(人类可读确认摘要),本 op 此前未提供,
|
|
683
|
+
// 确认链只剩 willSubmit 明细。这里用 summary 全量 + 两处需用户裁决的提示拼出预览。
|
|
684
|
+
preview: {
|
|
685
|
+
...plan.summary,
|
|
686
|
+
needAiPlan: plan.isAI && !plan.aiPlanPicked,
|
|
687
|
+
note: plan.isAI && !plan.aiPlanPicked
|
|
688
|
+
? 'AI 面试方案未选定:apply 会逐人阻断,需先选 aiPlan 重新 prepare'
|
|
689
|
+
: '确认姓名、职位、面试方式、轮次、面试官与时间窗后再 apply',
|
|
690
|
+
},
|
|
644
691
|
}, {
|
|
645
692
|
continuation,
|
|
646
693
|
fingerprint: fp,
|
|
@@ -653,23 +700,30 @@ async function apply(args, env) {
|
|
|
653
700
|
if (!args.continuation)
|
|
654
701
|
throw rsValidationError('continuation_required', '缺少 continuation(来自 prepare 的 meta)');
|
|
655
702
|
const payload = await env.continuation.verify(String(args.continuation), 'recruit-stage.interview.arrange.apply');
|
|
703
|
+
return applyCore(args, env, payload);
|
|
704
|
+
}
|
|
705
|
+
/** 单个候选人的落库执行体(供单条 apply 与批量 apply 复用;payload 由调用方校验)。 */
|
|
706
|
+
async function applyCore(args, env, payload) {
|
|
656
707
|
restoreDsOptions(payload.enumMaps);
|
|
657
708
|
const ctx = await makeCtx(env);
|
|
658
|
-
|
|
659
|
-
|
|
709
|
+
// 合并 prepare 快照与 apply 显式参数:显式优先(batch 每个候选人的 talentId 各不相同)。
|
|
710
|
+
// 这样 apply 只带 confirm + continuation 也能跑完,与协议文档一致。
|
|
711
|
+
const merged = { ...(payload.argsSnapshot || {}), ...args };
|
|
712
|
+
const talentId = await locateTalentId(ctx, merged);
|
|
713
|
+
const auto = nowAndEnd(String(merged.type || DEFAULT_INTERVIEW_TYPE));
|
|
660
714
|
// prepare 已把时间窗口放进 continuation:apply 复用它,避免两次运行时刻不同导致 fingerprint 漂移
|
|
661
|
-
const startTime =
|
|
662
|
-
const endTime =
|
|
715
|
+
const startTime = merged.start || payload.timeWindow?.start || auto.s;
|
|
716
|
+
const endTime = merged.end || (merged.start ? (shiftTime(String(merged.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : (payload.timeWindow?.end || auto.e));
|
|
663
717
|
const plan = await buildPlan({
|
|
664
718
|
ctx, talentId,
|
|
665
|
-
positionId:
|
|
666
|
-
interviewer:
|
|
667
|
-
type: String(
|
|
719
|
+
positionId: merged.positionId ? String(merged.positionId) : undefined,
|
|
720
|
+
interviewer: merged.interviewer ? String(merged.interviewer) : undefined,
|
|
721
|
+
type: String(merged.type || DEFAULT_INTERVIEW_TYPE), session: String(merged.session || '初试'),
|
|
668
722
|
start: String(startTime), end: String(endTime),
|
|
669
|
-
email:
|
|
670
|
-
mobile:
|
|
671
|
-
aiPlan:
|
|
672
|
-
rounds:
|
|
723
|
+
email: merged.email ? String(merged.email) : undefined,
|
|
724
|
+
mobile: merged.mobile ? String(merged.mobile) : undefined,
|
|
725
|
+
aiPlan: merged.aiPlan ? String(merged.aiPlan) : undefined,
|
|
726
|
+
rounds: merged.rounds ? String(merged.rounds) : undefined,
|
|
673
727
|
});
|
|
674
728
|
plan.host = ctx.host;
|
|
675
729
|
// AI 面试方案必填:未选定直接阻断,不落库、不执行动作链
|
|
@@ -703,6 +757,15 @@ async function apply(args, env) {
|
|
|
703
757
|
return rsSuccess('recruit-stage.interview.arrange.apply', {
|
|
704
758
|
mode: 'apply', result: verification.mismatches.length ? 'partial' : 'success', interviewFormId: formDataId,
|
|
705
759
|
interviewCardUrl: detailUrl,
|
|
760
|
+
// 🔴 回填落库实际采用的关键值(W9):旧版 apply 输出里没有 time,Agent 无法核对
|
|
761
|
+
// 「输出时间 vs 落库时间」,曾出现差 2 分钟而无人发现。现在 time 直接取本次提交进表单的
|
|
762
|
+
// dataDetails 时间值(与回查同一来源),所以与落库一致。
|
|
763
|
+
time: plan.summary.time,
|
|
764
|
+
talent: plan.summary.talent,
|
|
765
|
+
position: plan.summary.position,
|
|
766
|
+
type: plan.summary.type,
|
|
767
|
+
session: plan.summary.session,
|
|
768
|
+
interviewer: plan.summary.interviewer,
|
|
706
769
|
viewLink: detailUrl ? `[查看 ${plan.cand.name || ''} 的面试安排详情](${detailUrl})` : null,
|
|
707
770
|
listLocateLink: listLocateUrl ? `[打开面试管理列表](${listLocateUrl})` : null,
|
|
708
771
|
agentNote: '产物 = 两个 Markdown 链接(平台实证可点击):① viewLink 面试安排详情单页 ② listLocateLink 面试管理列表(只打开列表,不打开详情)。按顺序原样放回答正文,缺哪个只给另一个、不输出半截。不要包 browsertool / <artifact> 标签。',
|
|
@@ -719,7 +782,7 @@ async function prefill(args, env) {
|
|
|
719
782
|
const objId = objIdOf(ctx.cache, 'interview_plan');
|
|
720
783
|
const formId = formIdOf(ctx.cache, 'interview_plan');
|
|
721
784
|
const fields = ctx.cache.fields[objId] || {};
|
|
722
|
-
const typeKey = String(args.type ||
|
|
785
|
+
const typeKey = String(args.type || DEFAULT_INTERVIEW_TYPE);
|
|
723
786
|
const typeFid = fields.interview_type;
|
|
724
787
|
if (!typeFid)
|
|
725
788
|
throw rsFail('面试计划缺少字段 interview_type(ds/fields 解析不到)');
|
|
@@ -752,6 +815,173 @@ async function prefill(args, env) {
|
|
|
752
815
|
],
|
|
753
816
|
});
|
|
754
817
|
}
|
|
818
|
+
// ── 批量约面(2026-11-06)──────────────────────────────────────────────────────
|
|
819
|
+
// 后端没有批量端点:assignedInterview 只收单个 formDataId,页面「多选约面」也是前端弹窗 + 循环。
|
|
820
|
+
// 这里做的是「一次确认、逐人执行」的编排:先逐人 prepare 出摘要与指纹,用户确认一次,
|
|
821
|
+
// 再逐人走完整的保存 + 动作链 + 回查,最后汇总成功/失败。非原子,结果可能是 partial。
|
|
822
|
+
const BATCH_MAX = 30;
|
|
823
|
+
function normalizeCandidateList(raw) {
|
|
824
|
+
if (!Array.isArray(raw) || !raw.length) {
|
|
825
|
+
throw rsValidationError('candidates_required', 'candidates 必须是非空数组,元素形如 {talentId} / {mobile} / {name}');
|
|
826
|
+
}
|
|
827
|
+
if (raw.length > BATCH_MAX) {
|
|
828
|
+
throw rsValidationError('candidates_too_many', `一次最多处理 ${BATCH_MAX} 人(当前 ${raw.length} 人);请分批执行`);
|
|
829
|
+
}
|
|
830
|
+
return raw.map((x, i) => {
|
|
831
|
+
const o = (x && typeof x === 'object') ? x : {};
|
|
832
|
+
if (!o.talentId && !o.mobile && !o.name) {
|
|
833
|
+
throw rsValidationError('candidate_invalid', `第 ${i + 1} 个候选人缺少 talentId/mobile/name`);
|
|
834
|
+
}
|
|
835
|
+
return o;
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
async function batchPrepare(args, env) {
|
|
839
|
+
const list = normalizeCandidateList(args.candidates);
|
|
840
|
+
const type = String(args.type || DEFAULT_INTERVIEW_TYPE);
|
|
841
|
+
const auto = nowAndEnd(type);
|
|
842
|
+
const startTime = String(args.start || auto.s);
|
|
843
|
+
const endTime = String(args.end || (args.start ? (shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : auto.e));
|
|
844
|
+
const shared = {};
|
|
845
|
+
for (const k of ['positionId', 'interviewer', 'type', 'session', 'rounds', 'aiPlan', 'email']) {
|
|
846
|
+
if (args[k] !== undefined && args[k] !== null && String(args[k]).trim() !== '')
|
|
847
|
+
shared[k] = String(args[k]);
|
|
848
|
+
}
|
|
849
|
+
shared.type = type;
|
|
850
|
+
shared.start = startTime;
|
|
851
|
+
shared.end = endTime;
|
|
852
|
+
const items = [];
|
|
853
|
+
const seen = new Set();
|
|
854
|
+
for (let i = 0; i < list.length; i++) {
|
|
855
|
+
const c = list[i];
|
|
856
|
+
const label = String(c.name || c.mobile || c.talentId || `第${i + 1}人`);
|
|
857
|
+
try {
|
|
858
|
+
const r = await prepare({ ...shared, ...c }, env, { skipPermissionProbe: i > 0 });
|
|
859
|
+
const d = r.data || {};
|
|
860
|
+
const talentId = String(d.talentId || '');
|
|
861
|
+
if (talentId && seen.has(talentId)) {
|
|
862
|
+
items.push({ index: i + 1, label, talentId, status: 'duplicate', message: '与前面的候选人重复,已跳过' });
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
if (talentId)
|
|
866
|
+
seen.add(talentId);
|
|
867
|
+
const meta = r.meta || {};
|
|
868
|
+
// 结果表里的人名:优先用 prepare 解析出的真实姓名(d.candidateName),
|
|
869
|
+
// 退而用调用方传的 name → mobile → talentId。旧版直接拿 talentId 当 label,
|
|
870
|
+
// 从列表勾选(只传 talentId)时整张结果表都是 id,看不出是谁(W8)。
|
|
871
|
+
const resolvedName = String(d.candidateName || '').trim();
|
|
872
|
+
items.push({
|
|
873
|
+
index: i + 1, label: resolvedName || label, talentId, status: 'ready',
|
|
874
|
+
args: { ...shared, ...c },
|
|
875
|
+
fingerprint: String(meta.fingerprint || ''),
|
|
876
|
+
timeWindow: { start: startTime, end: endTime },
|
|
877
|
+
message: d.needAiPlan ? 'AI面试方案未选(apply 会阻断)' : undefined,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
catch (e) {
|
|
881
|
+
items.push({ index: i + 1, label, status: 'failed', message: e?.message || 'prepare 失败' });
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
const ready = items.filter((x) => x.status === 'ready');
|
|
885
|
+
if (!ready.length) {
|
|
886
|
+
return rsSuccess('recruit-stage.interview.arrange.batch.prepare', {
|
|
887
|
+
mode: 'batch-prepare', total: items.length, ready: 0, failed: items.length,
|
|
888
|
+
items: items.map(({ args, fingerprint, timeWindow, ...rest }) => rest),
|
|
889
|
+
hint: '没有任何候选人可执行,逐条看 items[].message 修正后重试',
|
|
890
|
+
preview: {
|
|
891
|
+
action: '批量安排面试 — 无可执行项',
|
|
892
|
+
total: items.length,
|
|
893
|
+
ready: 0,
|
|
894
|
+
failed: items.length,
|
|
895
|
+
reasons: items.map((x) => `${x.index}. ${x.label}:${x.message || x.status}`),
|
|
896
|
+
},
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
const { createHash } = await import('node:crypto');
|
|
900
|
+
const fp = createHash('sha256').update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest('hex');
|
|
901
|
+
const continuation = await env.continuation.issue({
|
|
902
|
+
operation: 'recruit-stage.interview.arrange.batch.apply',
|
|
903
|
+
fingerprint: fp,
|
|
904
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
905
|
+
items: ready.map((x) => ({ index: x.index, label: x.label, talentId: x.talentId, args: x.args, fingerprint: x.fingerprint, timeWindow: x.timeWindow })),
|
|
906
|
+
});
|
|
907
|
+
return rsSuccess('recruit-stage.interview.arrange.batch.prepare', {
|
|
908
|
+
mode: 'batch-prepare',
|
|
909
|
+
total: items.length,
|
|
910
|
+
ready: ready.length,
|
|
911
|
+
failed: items.filter((x) => x.status === 'failed').length,
|
|
912
|
+
duplicates: items.filter((x) => x.status === 'duplicate').length,
|
|
913
|
+
shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + ' ~ ' + endTime, aiPlan: shared.aiPlan },
|
|
914
|
+
items: items.map(({ args, fingerprint, timeWindow, ...rest }) => rest),
|
|
915
|
+
note: '确认摘要后带 confirm:true 与 meta.continuation 调 batch.apply;逐人执行,可能是 partial',
|
|
916
|
+
// 🔴 2026-11-07:本 op 此前无 preview。批量场景用户要看的是「这批到底谁会被约、谁被跳过、为什么」,
|
|
917
|
+
// 所以 preview 用逐行名单而不是数字汇总。
|
|
918
|
+
preview: {
|
|
919
|
+
action: '批量安排面试(逐人执行,结果可能 partial)',
|
|
920
|
+
total: items.length,
|
|
921
|
+
ready: ready.length,
|
|
922
|
+
failed: items.filter((x) => x.status === 'failed').length,
|
|
923
|
+
duplicates: items.filter((x) => x.status === 'duplicate').length,
|
|
924
|
+
shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + ' ~ ' + endTime, aiPlan: shared.aiPlan },
|
|
925
|
+
candidates: items.map((x) => `${x.index}. ${x.label} — ${x.status}${x.message ? ':' + x.message : ''}`),
|
|
926
|
+
},
|
|
927
|
+
}, {
|
|
928
|
+
continuation,
|
|
929
|
+
fingerprint: fp,
|
|
930
|
+
confirmHint: '用户明确确认整批名单后,携带 confirm:true 与本 continuation 调用 recruit-stage.interview.arrange.batch.apply',
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
async function batchApply(args, env) {
|
|
934
|
+
if (args.confirm !== true) {
|
|
935
|
+
throw rsConfirmationError('recruit-stage.interview.arrange.batch.apply', { hint: '批量写操作必须显式 confirm:true' });
|
|
936
|
+
}
|
|
937
|
+
if (!args.continuation)
|
|
938
|
+
throw rsValidationError('continuation_required', '缺少 continuation(来自 batch.prepare 的 meta)');
|
|
939
|
+
const batch = await env.continuation.verify(String(args.continuation), 'recruit-stage.interview.arrange.batch.apply');
|
|
940
|
+
const items = Array.isArray(batch.items) ? batch.items : [];
|
|
941
|
+
if (!items.length)
|
|
942
|
+
throw rsValidationError('batch_empty', 'continuation 中没有可执行的候选人');
|
|
943
|
+
const results = [];
|
|
944
|
+
for (const it of items) {
|
|
945
|
+
const payload = { fingerprint: it.fingerprint, timeWindow: it.timeWindow, enumMaps: batch.enumMaps };
|
|
946
|
+
try {
|
|
947
|
+
const r = await applyCore({ ...(it.args || {}), confirm: true }, env, payload);
|
|
948
|
+
const d = r.data || {};
|
|
949
|
+
results.push({
|
|
950
|
+
index: it.index,
|
|
951
|
+
talentId: it.talentId,
|
|
952
|
+
name: it.label,
|
|
953
|
+
candidateName: it.label,
|
|
954
|
+
status: d.result === 'partial' ? 'partial' : 'success',
|
|
955
|
+
interviewFormId: d.interviewFormId,
|
|
956
|
+
cardUrl: d.interviewCardUrl,
|
|
957
|
+
viewLink: d.viewLink,
|
|
958
|
+
warnings: d.warnings && d.warnings.length ? d.warnings : undefined,
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
catch (e) {
|
|
962
|
+
results.push({ index: it.index, talentId: it.talentId, name: it.label, candidateName: it.label, status: 'failed', message: e?.message || '执行失败' });
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
const ok = results.filter((x) => x.status === 'success').length;
|
|
966
|
+
const partial = results.filter((x) => x.status === 'partial').length;
|
|
967
|
+
const failed = results.filter((x) => x.status === 'failed').length;
|
|
968
|
+
const lines = [
|
|
969
|
+
'| # | 候选人 | 结果 | 说明 |',
|
|
970
|
+
'|---|---|---|---|',
|
|
971
|
+
...results.map((x) => `| ${x.index} | ${x.name} | ${x.status === 'success' ? '成功' : x.status === 'partial' ? '部分成功' : '失败'} | ${x.message || (x.warnings?.length ? x.warnings.join(';') : x.cardUrl ? '已创建面试安排' : '')} |`),
|
|
972
|
+
];
|
|
973
|
+
return rsSuccess('recruit-stage.interview.arrange.batch.apply', {
|
|
974
|
+
mode: 'batch-apply',
|
|
975
|
+
result: failed || partial ? 'partial' : 'success',
|
|
976
|
+
total: results.length,
|
|
977
|
+
succeeded: ok,
|
|
978
|
+
partial,
|
|
979
|
+
failed,
|
|
980
|
+
items: results,
|
|
981
|
+
resultTable: lines.join('\n'),
|
|
982
|
+
agentNote: '把 resultTable 原样放回答正文(这是本次批量约面的结果清单);失败/部分成功的条目要连同 message 一起说清楚,不要只报总数。',
|
|
983
|
+
});
|
|
984
|
+
}
|
|
755
985
|
export const interviewArrangeOperations = [
|
|
756
986
|
{
|
|
757
987
|
name: 'recruit-stage.interview.arrange.prepare',
|
|
@@ -788,5 +1018,32 @@ export const interviewArrangeOperations = [
|
|
|
788
1018
|
inputSchema: schemaOf(baseInput, {}),
|
|
789
1019
|
handler: prefill,
|
|
790
1020
|
},
|
|
1021
|
+
{
|
|
1022
|
+
name: 'recruit-stage.interview.arrange.batch.prepare',
|
|
1023
|
+
resource: 'recruit.interview',
|
|
1024
|
+
method: 'prepare',
|
|
1025
|
+
action: 'interview.arrange.batch.prepare',
|
|
1026
|
+
summary: '批量约面确认摘要:逐人定位候选人、解析面试方式/轮次与必填项,输出名单与失败原因(重复自动跳过),不写入;一次最多 30 人',
|
|
1027
|
+
capability: 'recruit.interview.arrange',
|
|
1028
|
+
risk: 'write',
|
|
1029
|
+
requiresConfirmation: true,
|
|
1030
|
+
inputSchema: schemaOf({
|
|
1031
|
+
candidates: { type: 'array', description: '候选人数组,元素为 {talentId} / {mobile} / {name} 之一;最多 30 人', items: { type: 'object' } },
|
|
1032
|
+
...baseInput,
|
|
1033
|
+
}, { required: ['candidates'] }),
|
|
1034
|
+
handler: batchPrepare,
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: 'recruit-stage.interview.arrange.batch.apply',
|
|
1038
|
+
resource: 'recruit.interview',
|
|
1039
|
+
method: 'apply',
|
|
1040
|
+
action: 'interview.arrange.batch.apply',
|
|
1041
|
+
summary: '用户确认名单后逐人安排面试(同一套保存+动作链+落库回查),返回逐人结果清单与 Markdown 表格;非原子批量,结果可能为 partial',
|
|
1042
|
+
capability: 'recruit.interview.arrange',
|
|
1043
|
+
risk: 'write',
|
|
1044
|
+
requiresConfirmation: true,
|
|
1045
|
+
inputSchema: schemaOf({ confirm: { type: 'boolean' }, continuation: { type: 'string' } }, { required: ['confirm', 'continuation'] }),
|
|
1046
|
+
handler: batchApply,
|
|
1047
|
+
},
|
|
791
1048
|
];
|
|
792
1049
|
void randomUUID;
|