weaver-work-cli 0.1.48 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
- package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-EJYIOJPH.js} +3 -3
- package/dist/chunks/{chunk-FEP6ELMR.js → chunk-3NCFFHB2.js} +1 -1
- package/dist/chunks/chunk-5QYE52LG.js +223 -0
- package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
- package/dist/chunks/{chunk-NBEWUR7L.js → chunk-6T53BSWZ.js} +158 -44
- package/dist/chunks/{chunk-OCYRVZGN.js → chunk-7AYQJSFY.js} +2 -2
- package/dist/chunks/{chunk-5B5JXTY2.js → chunk-7ECB22G3.js} +221 -30
- package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
- package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-BFKLQLBK.js} +8 -8
- package/dist/chunks/{chunk-EFOUMXIX.js → chunk-HARQF5IP.js} +28 -28
- package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
- package/dist/chunks/chunk-JEQHNNSS.js +158 -0
- package/dist/chunks/{chunk-NK74RE5F.js → chunk-K67FODVC.js} +3 -3
- package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
- package/dist/chunks/{chunk-BCACE6VV.js → chunk-MCZG6HPM.js} +3 -3
- package/dist/chunks/{chunk-SVFG6EMV.js → chunk-RYFRGTUV.js} +5 -5
- package/dist/chunks/{chunk-PSPOFLSU.js → chunk-WNJUGI2F.js} +1 -1
- package/dist/chunks/{chunk-R2HHLJNN.js → chunk-YB3AJYPY.js} +4 -4
- package/dist/chunks/{conflict-APGSD5E7.js → conflict-C4UDHCWV.js} +2 -2
- package/dist/chunks/{contract-N6P2HIIE.js → contract-VUC6JOPG.js} +464 -9
- package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-6OG2LYBD.js} +6 -6
- package/dist/chunks/data-QO7QWOIV.js +2525 -0
- package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
- package/dist/chunks/{env-B6GKA2J3.js → env-WP57TF2S.js} +2 -2
- package/dist/chunks/{factory-MFCKLUT6.js → factory-VUXI7N5C.js} +1 -1
- package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
- package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-UQRGXILK.js} +3 -3
- package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
- package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
- package/dist/chunks/{invoice-FXWH5GPO.js → invoice-E7GOITEU.js} +1 -1
- package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-4BBLVAWM.js} +10 -10
- package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
- package/dist/chunks/org-NFE7X7FK.js +12 -0
- package/dist/chunks/{reception-VL6TKVAW.js → reception-QGPNTGHG.js} +526 -175
- package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
- package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
- package/dist/chunks/{registry-22O6UG4I.js → registry-5CRCN2TV.js} +10 -10
- package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
- package/dist/chunks/{registry-7VZ6YJUF.js → registry-V4CHRQDI.js} +1 -1
- package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-AYR3UG7R.js} +4 -4
- package/dist/chunks/{schedule-SPPAHER2.js → schedule-JZEFIXUS.js} +4 -4
- package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-3ZAF2J5E.js} +4 -4
- package/dist/index.js +16 -11
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
- package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
- package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
- package/dist/shortcuts/contract/host.js +11 -0
- package/dist/shortcuts/contract/index.js +13 -0
- package/dist/shortcuts/contract/manifest.js +53 -0
- package/dist/shortcuts/contract/operations/performance.js +58 -7
- package/dist/shortcuts/contract/operations/quote.js +283 -1
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
- package/dist/shortcuts/data/errors.js +64 -0
- package/dist/shortcuts/data/host.js +140 -0
- package/dist/shortcuts/data/index.js +429 -0
- package/dist/shortcuts/data/manifest.js +133 -0
- package/dist/shortcuts/data/operations/attend.js +62 -0
- package/dist/shortcuts/data/operations/conf.js +384 -0
- package/dist/shortcuts/data/operations/ds.js +686 -0
- package/dist/shortcuts/data/operations/field.js +68 -0
- package/dist/shortcuts/data/operations/index.js +65 -0
- package/dist/shortcuts/data/operations/module.js +383 -0
- package/dist/shortcuts/data/operations/noun.js +102 -0
- package/dist/shortcuts/data/operations/query.js +85 -0
- package/dist/shortcuts/data/operations/scene.js +235 -0
- package/dist/shortcuts/data/operations/shared.js +279 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/fna/host.js +4 -2
- package/dist/shortcuts/fna/manifest.js +14 -5
- package/dist/shortcuts/fna/operations/audit.js +334 -0
- package/dist/shortcuts/fna/operations/registry.js +2 -0
- package/dist/shortcuts/im/operations/at-mention.js +6 -3
- package/dist/shortcuts/im/operations/msg-parse.js +35 -5
- package/dist/shortcuts/im/operations/msg-sync.js +3 -1
- package/dist/shortcuts/im/operations/msg-write.js +57 -9
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/manifest.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/reception/constants.js +13 -6
- package/dist/shortcuts/reception/index.js +3 -1
- package/dist/shortcuts/reception/manifest.js +3 -2
- package/dist/shortcuts/reception/operations/ask.js +20 -2
- package/dist/shortcuts/reception/operations/compose.js +11 -0
- package/dist/shortcuts/reception/operations/doc.js +59 -0
- package/dist/shortcuts/reception/operations/docrender.js +25 -1
- package/dist/shortcuts/reception/operations/leads.js +31 -7
- package/dist/shortcuts/reception/operations/panels.js +86 -22
- package/dist/shortcuts/reception/operations/render.js +40 -0
- package/dist/shortcuts/reception/operations/restaurant.js +17 -4
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/workflow/operations/read.js +58 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
- package/docs/SKILL.md +2 -1
- package/docs/_catalog.md +4 -1
- package/docs/data.md +149 -0
- package/docs/fna.md +11 -4
- package/docs/reception.md +59 -5
- package/package.json +1 -1
- package/scripts/check-skill-sync.mjs +188 -0
- package/scripts/package-skill.mjs +17 -3
- package/skill-template/business-info.json +29 -1
- package/skill-template/domains/data.md +15 -0
- package/skill-template/domains/qiyecheng.md +4 -2
- package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
- package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
- package/skills/weaver-e10-data/SKILL.md +118 -0
- package/skills/weaver-e10-data/references/config-center.md +90 -0
- package/skills/weaver-e10-data/references/datasource.md +136 -0
- package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +219 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +50 -30
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +24 -15
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +43 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +265 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +83 -0
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
- package/skills/weaver-e10-meeting/SKILL.md +39 -7
- package/skills/weaver-e10-qiyecheng/SKILL.md +21 -7
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +104 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +17 -3
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +136 -30
- package/skills/weaver-e10-reception-flow/SKILL.md +70 -19
- package/skills/weaver-e10-reception-flow/references/guide.md +5 -4
- package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
- package/skills/weaver-e10-recruit-stage/SKILL.md +1 -1
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +6 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
- package/skills/weaver-e10-workflow/SKILL.md +2 -1
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +6 -45
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +5 -5
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +4 -37
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +22 -35
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
- package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
|
@@ -22,7 +22,7 @@ import path from 'node:path';
|
|
|
22
22
|
import schoolTiers from '../school-tiers.json';
|
|
23
23
|
import { rsSuccess, schemaOf } from './types.js';
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
|
-
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
25
|
+
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
26
|
import { scanResumeSource, findStructuredJson } from '../fs-scan.js';
|
|
27
27
|
import { saveBatchItems, loadBatchItems } from '../batch-store.js';
|
|
28
28
|
// 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
|
|
@@ -338,8 +338,13 @@ function makeBriefReader(ctx, formId, objId, fields) {
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
// 人才卡片 URL
|
|
342
|
-
function resolveTalentCardUrl(ctx, talentId) {
|
|
341
|
+
// 人才卡片 URL(装了人才库 ecode 页面就指向新卡片页;否则环境缓存 ebdDetailPageId,自用追加 recruitType=useSelf)
|
|
342
|
+
async function resolveTalentCardUrl(ctx, talentId) {
|
|
343
|
+
if (talentId) {
|
|
344
|
+
const ui = await talentUiCardUrl(ctx.host, ctx.cache, ctx.baseUrl, String(talentId));
|
|
345
|
+
if (ui)
|
|
346
|
+
return ui;
|
|
347
|
+
}
|
|
343
348
|
const pid = ctx.cache.ebdDetailPageId;
|
|
344
349
|
if (!pid || !talentId) {
|
|
345
350
|
// 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
|
|
@@ -350,12 +355,15 @@ function resolveTalentCardUrl(ctx, talentId) {
|
|
|
350
355
|
}
|
|
351
356
|
return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
|
|
352
357
|
}
|
|
353
|
-
//
|
|
358
|
+
// 人才库列表(只打开列表):装了人才库 ecode 页面就指向新页面,否则 {baseUrl}/sp/ebdfpage/list/{listId}
|
|
354
359
|
// 2026-11-06 用户定稿:列表链接不携带 /card/... 段,也不拼 talentId 等 query,
|
|
355
360
|
// 避免打开列表时一同滑出人才详情单页;人才卡片由 talentCardUrl 单独给出。
|
|
356
361
|
// listId 取环境缓存 lists.talent.listId(运行时解析,跨环境不写死)。
|
|
357
|
-
function resolveTalentListLocateUrl(ctx, _talentId) {
|
|
362
|
+
async function resolveTalentListLocateUrl(ctx, _talentId) {
|
|
358
363
|
const listId = ctx.cache.lists?.talent?.listId;
|
|
364
|
+
const preferred = await resolveTalentListUrl(ctx.host, ctx.cache, ctx.baseUrl, listId || '');
|
|
365
|
+
if (preferred)
|
|
366
|
+
return preferred;
|
|
359
367
|
if (!listId)
|
|
360
368
|
return null;
|
|
361
369
|
return `${ctx.baseUrl.replace(/\/+$/, '')}/sp/ebdfpage/list/${listId}`;
|
|
@@ -955,8 +963,8 @@ async function findExistingTalents(ctx, opts) {
|
|
|
955
963
|
talentId: b.talentId,
|
|
956
964
|
candidateId: b.candidateId,
|
|
957
965
|
talentViewUrl: b.candidateId ? buildTalentViewUrl(ctx.baseUrl, b.candidateId) : null,
|
|
958
|
-
talentCardUrl: b.talentId ? resolveTalentCardUrl(ctx, b.talentId) : null,
|
|
959
|
-
talentListLocateUrl: b.talentId ? resolveTalentListLocateUrl(ctx, b.talentId) : null,
|
|
966
|
+
talentCardUrl: b.talentId ? await resolveTalentCardUrl(ctx, b.talentId) : null,
|
|
967
|
+
talentListLocateUrl: b.talentId ? await resolveTalentListLocateUrl(ctx, b.talentId) : null,
|
|
960
968
|
};
|
|
961
969
|
}
|
|
962
970
|
}
|
|
@@ -976,8 +984,8 @@ async function findExistingTalents(ctx, opts) {
|
|
|
976
984
|
if (rec) {
|
|
977
985
|
formConflicts.existing.push({
|
|
978
986
|
talentId: id, ...rec,
|
|
979
|
-
talentCardUrl: resolveTalentCardUrl(ctx, id),
|
|
980
|
-
talentListLocateUrl: resolveTalentListLocateUrl(ctx, id),
|
|
987
|
+
talentCardUrl: await resolveTalentCardUrl(ctx, id),
|
|
988
|
+
talentListLocateUrl: await resolveTalentListLocateUrl(ctx, id),
|
|
981
989
|
recordCardUrl: buildCardUrl(ctx.baseUrl, objId, id),
|
|
982
990
|
});
|
|
983
991
|
}
|
|
@@ -1271,8 +1279,8 @@ async function applyCore(args, env, payload) {
|
|
|
1271
1279
|
talentId: updateTalentId,
|
|
1272
1280
|
afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
|
|
1273
1281
|
verifyWarnings: verifyWarnings.length ? verifyWarnings : undefined,
|
|
1274
|
-
talentCardUrl: resolveTalentCardUrl(ctx, updateTalentId),
|
|
1275
|
-
talentListLocateUrl: resolveTalentListLocateUrl(ctx, updateTalentId),
|
|
1282
|
+
talentCardUrl: await resolveTalentCardUrl(ctx, updateTalentId),
|
|
1283
|
+
talentListLocateUrl: await resolveTalentListLocateUrl(ctx, updateTalentId),
|
|
1276
1284
|
parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || '(空)' },
|
|
1277
1285
|
});
|
|
1278
1286
|
}
|
|
@@ -1375,8 +1383,8 @@ async function applyCore(args, env, payload) {
|
|
|
1375
1383
|
writeWarnings.push('落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual);
|
|
1376
1384
|
}
|
|
1377
1385
|
const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
|
|
1378
|
-
const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
|
|
1379
|
-
const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
|
|
1386
|
+
const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
1387
|
+
const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
|
|
1380
1388
|
return rsSuccess('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
|
*
|
|
@@ -52,8 +52,10 @@ export function assertPath(requestPath) {
|
|
|
52
52
|
}
|
|
53
53
|
if (!requestPath.startsWith('/api/fna/')
|
|
54
54
|
&& !requestPath.startsWith('/api/app/fna/')
|
|
55
|
-
&& !requestPath.startsWith('/api/secondev/fna/')
|
|
56
|
-
|
|
55
|
+
&& !requestPath.startsWith('/api/secondev/fna/')
|
|
56
|
+
// AI 规则预审挂在 ai/application 下(非 fna 命名空间),只放行该 Controller 的 rule/check 路径
|
|
57
|
+
&& !requestPath.startsWith('/api/ai/application/rule/check/')) {
|
|
58
|
+
throw fnaValidationError('path_not_allowed', 'FNA 费控中心只能调用 /api/fna/、/api/app/fna/、/api/secondev/fna/ 或 /api/ai/application/rule/check/ 路径');
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
function omitEmptyQueryValues(query) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { fnaOperationDefinitions } from './operations/registry.js';
|
|
2
2
|
/**
|
|
3
3
|
* FNA 费控中心(齐业成)模块禁用/暂缓边界。
|
|
4
|
-
*
|
|
4
|
+
* 13 个源接口全部落地;以下几类能力不在本 CLI,写入 manifest 供 Agent 判断,
|
|
5
5
|
* 不得编造 operation 或绕过 CLI 直连接口:
|
|
6
6
|
* - 姓名/流程名 → employeeId/workflowId 的人员与流程解析不在本模块;
|
|
7
7
|
* - 借款「确认已还 confirmRepay」、核销明细等页面按钮能力未随源资料提供接口,未实现;
|
|
8
|
-
* - 报销报表 AI 问答只暴露自然语言问题,不接受也不回传 AI 生成的 SQL
|
|
8
|
+
* - 报销报表 AI 问答只暴露自然语言问题,不接受也不回传 AI 生成的 SQL;
|
|
9
|
+
* - AI 规则预审只执行流程配置的规则,不支持增删改规则配置,也不回传 formDataList 明细。
|
|
9
10
|
*/
|
|
10
11
|
const FNA_WITHHELD = [
|
|
11
12
|
{
|
|
@@ -20,6 +21,14 @@ const FNA_WITHHELD = [
|
|
|
20
21
|
name: 'fna.expense.chart.raw.sql',
|
|
21
22
|
reason: '报销报表 AI 问答由服务端生成 SQL 并做租户隔离改写与安全校验;CLI 只接受 userInput,不暴露、不回传 SQL,也不允许调用方绕过安全校验自写 SQL。',
|
|
22
23
|
},
|
|
24
|
+
{
|
|
25
|
+
name: 'fna.audit.rule.configure',
|
|
26
|
+
reason: 'AI 规则预审只按流程已配置的规则执行(可传 ruleList/settingId 指定),不支持新增、编辑、删除规则配置或规则设置;源资料未提供规则维护接口。',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'fna.audit.formdata.raw',
|
|
30
|
+
reason: 'aiCheckAudit 返回的 data.formDataList 含完整主表/明细/发票数据,体积大且含业务敏感字段;CLI 只回传 id/refId/title 摘要,不把整段表单数据暴露给 Agent。',
|
|
31
|
+
},
|
|
23
32
|
];
|
|
24
33
|
function buildOperations() {
|
|
25
34
|
return fnaOperationDefinitions().map((definition) => ({
|
|
@@ -35,12 +44,12 @@ function buildOperations() {
|
|
|
35
44
|
export const fnaManifest = {
|
|
36
45
|
schemaVersion: 1,
|
|
37
46
|
name: 'fna',
|
|
38
|
-
title: '泛微E10
|
|
39
|
-
version: '0.1.
|
|
47
|
+
title: '泛微E10齐业成费控中心(预算查询/费用中心/报销报表/AI规则预审/借款管理/发票核销)',
|
|
48
|
+
version: '0.1.2',
|
|
40
49
|
host: 'e10-fna',
|
|
41
50
|
status: 'builtin',
|
|
42
51
|
sourceSkill: 'weaver-e10-qiyecheng',
|
|
43
|
-
capabilities: ['budget', 'expense', 'expense-chart', 'loan', 'invoice-writeoff'],
|
|
52
|
+
capabilities: ['budget', 'expense', 'expense-chart', 'audit', 'loan', 'invoice-writeoff'],
|
|
44
53
|
operations: buildOperations(),
|
|
45
54
|
withheldOperations: FNA_WITHHELD,
|
|
46
55
|
};
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { CONTINUATION_TTL_SECONDS } from '../../../core/continuation-ttl.js';
|
|
2
|
+
import { FnaCliError, fnaPartialError, fnaValidationError, isFnaNetworkError } from '../errors.js';
|
|
3
|
+
import { fnaSuccess, schemaOf, SCHEMA_ID, SCHEMA_STRING_NONEMPTY, WRITE } from './types.js';
|
|
4
|
+
import { compact, fingerprint, requireConfirm, unwrapData, verifyLease } from './shared.js';
|
|
5
|
+
/**
|
|
6
|
+
* aiCheckAudit 内部按 180s 轮询,single 模式逐条并发后整体更久,官方建议调用方 HTTP 超时 ≥ 10 分钟。
|
|
7
|
+
* 超时后不得自动重试:本次可能已生成预审记录并消耗模型额度。
|
|
8
|
+
*/
|
|
9
|
+
const AUDIT_TIMEOUT_MS = 600_000;
|
|
10
|
+
const CHECK_MODES = ['batch', 'single'];
|
|
11
|
+
const DIMENSIONS = ['user', 'node'];
|
|
12
|
+
/** 未显式传 dimension 时按节点维度:不记个人,动作流 RPC 走这条。 */
|
|
13
|
+
const DEFAULT_DIMENSION = 'node';
|
|
14
|
+
const AUDIT_PATH = '/api/ai/application/rule/check/aiCheckAudit';
|
|
15
|
+
/** 数字转 long 字符串:服务端统一按 long 解析,字符串可避免 > 2^53 精度丢失。 */
|
|
16
|
+
function toIdString(value, field, options = {}) {
|
|
17
|
+
if (value === undefined || value === null || value === '') {
|
|
18
|
+
throw fnaValidationError('id_required', `${field} 必填`);
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'number' && !Number.isFinite(value)) {
|
|
21
|
+
throw fnaValidationError('id_invalid', `${field} 必须是整数或数字字符串`);
|
|
22
|
+
}
|
|
23
|
+
const text = String(value).trim();
|
|
24
|
+
if (!/^\d+$/.test(text)) {
|
|
25
|
+
throw fnaValidationError('id_invalid', `${field} 必须是整数或数字字符串:${text}`);
|
|
26
|
+
}
|
|
27
|
+
if (!options.allowZero && text === '0') {
|
|
28
|
+
// 服务端不做必填校验,传 0 会静默返回空数据,必须在 CLI 侧拦掉。
|
|
29
|
+
throw fnaValidationError('id_invalid', `${field} 不能为 0(服务端会把 0 当空数据处理)`);
|
|
30
|
+
}
|
|
31
|
+
return text;
|
|
32
|
+
}
|
|
33
|
+
function optionalId(value, field, options = {}) {
|
|
34
|
+
if (value === undefined || value === null || value === '')
|
|
35
|
+
return undefined;
|
|
36
|
+
return toIdString(value, field, options);
|
|
37
|
+
}
|
|
38
|
+
function optionalEnum(value, allowed, field, subtype = `${field}_invalid`) {
|
|
39
|
+
if (value === undefined || value === null || value === '')
|
|
40
|
+
return undefined;
|
|
41
|
+
const text = String(value);
|
|
42
|
+
if (!allowed.includes(text)) {
|
|
43
|
+
throw fnaValidationError(subtype, `${field} 只能是 ${allowed.join(' / ')}:${text}`);
|
|
44
|
+
}
|
|
45
|
+
return text;
|
|
46
|
+
}
|
|
47
|
+
function requireRuleList(value) {
|
|
48
|
+
if (value === undefined || value === null || value === '')
|
|
49
|
+
return undefined;
|
|
50
|
+
if (typeof value !== 'string') {
|
|
51
|
+
throw fnaValidationError('rule_list_invalid', 'ruleList 必须是字符串:JSON 字符串数组(["规则1","规则2"])或 ## 分隔文本;数组请先序列化成字符串');
|
|
52
|
+
}
|
|
53
|
+
const text = value.trim();
|
|
54
|
+
if (!text)
|
|
55
|
+
return undefined;
|
|
56
|
+
if (text.startsWith('[')) {
|
|
57
|
+
try {
|
|
58
|
+
const parsed = JSON.parse(text);
|
|
59
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== 'string')) {
|
|
60
|
+
throw new Error('not a string array');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw fnaValidationError('rule_list_invalid', 'ruleList 以 [ 开头但不是合法的 JSON 字符串数组');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return text;
|
|
68
|
+
}
|
|
69
|
+
/** 组装 aiCheckAudit 请求体:ID 统一字符串,未提供的可选值不落 body。 */
|
|
70
|
+
function buildAuditBody(args) {
|
|
71
|
+
return compact({
|
|
72
|
+
workflowId: toIdString(args.workflowId, 'workflowId'),
|
|
73
|
+
requestId: toIdString(args.requestId, 'requestId'),
|
|
74
|
+
nodeId: toIdString(args.nodeId, 'nodeId'),
|
|
75
|
+
dimension: optionalEnum(args.dimension, DIMENSIONS, 'dimension') ?? DEFAULT_DIMENSION,
|
|
76
|
+
refId: optionalId(args.refId, 'refId'),
|
|
77
|
+
settingId: optionalId(args.settingId, 'settingId', { allowZero: true }),
|
|
78
|
+
ruleList: requireRuleList(args.ruleList),
|
|
79
|
+
pageType: args.pageType === undefined || args.pageType === '' ? undefined : String(args.pageType),
|
|
80
|
+
checkMode: optionalEnum(args.checkMode, CHECK_MODES, 'checkMode', 'check_mode_invalid'),
|
|
81
|
+
recordId: optionalId(args.recordId, 'recordId', { allowZero: true }),
|
|
82
|
+
userId: optionalId(args.userId, 'userId'),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const RISK_NAMES = { 0: '低风险', 1: '中风险', 2: '高风险' };
|
|
86
|
+
function asText(value) {
|
|
87
|
+
if (value === undefined || value === null)
|
|
88
|
+
return null;
|
|
89
|
+
const text = String(value);
|
|
90
|
+
return text === '' ? null : text;
|
|
91
|
+
}
|
|
92
|
+
function asCount(value) {
|
|
93
|
+
const numeric = Number(value);
|
|
94
|
+
return Number.isFinite(numeric) ? numeric : null;
|
|
95
|
+
}
|
|
96
|
+
function normalizeRuleResults(payload) {
|
|
97
|
+
const raw = Array.isArray(payload?.results) ? payload.results : [];
|
|
98
|
+
return raw.map((item) => {
|
|
99
|
+
const riskType = asCount(item?.riskType);
|
|
100
|
+
return {
|
|
101
|
+
id: asText(item?.id),
|
|
102
|
+
rule: asText(item?.rule),
|
|
103
|
+
result: asText(item?.result),
|
|
104
|
+
passed: typeof item?.passed === 'boolean' ? item.passed : null,
|
|
105
|
+
riskType,
|
|
106
|
+
riskName: asText(item?.riskName) ?? (riskType !== null ? RISK_NAMES[riskType] ?? null : null),
|
|
107
|
+
generated: typeof item?.generated === 'boolean' ? item.generated : null,
|
|
108
|
+
fieldId: asText(item?.fieldId),
|
|
109
|
+
auditResult: asText(item?.auditResult),
|
|
110
|
+
auditReason: asText(item?.auditReason),
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 归一化 aiCheckAudit 的 data。三种形态:
|
|
116
|
+
* - catResult 为 null:无数据源/无表单/无规则,属业务成功但没内容,按 empty 返回原因;
|
|
117
|
+
* - chatMessage.content 是 JSON 字符串,必须二次解析才能拿到 results;
|
|
118
|
+
* - content 解析失败时保留 recordId 与文本预览,标记 unparsed(接口已执行、记录可能已写入,不能当失败处理)。
|
|
119
|
+
* formDataList 体积可能很大,只取 id/refId/title。
|
|
120
|
+
*/
|
|
121
|
+
function normalizeAuditResult(data) {
|
|
122
|
+
const catResult = data?.catResult;
|
|
123
|
+
const recordId = asText(data?.recordId);
|
|
124
|
+
const firstForm = Array.isArray(data?.formDataList) ? data.formDataList[0] : undefined;
|
|
125
|
+
const form = firstForm
|
|
126
|
+
? { id: asText(firstForm.id), refId: asText(firstForm.refId), title: asText(firstForm.title) }
|
|
127
|
+
: null;
|
|
128
|
+
if (!catResult || typeof catResult !== 'object') {
|
|
129
|
+
return {
|
|
130
|
+
status: 'empty',
|
|
131
|
+
recordId,
|
|
132
|
+
formData: form,
|
|
133
|
+
emptyReason: asText(data?.msg),
|
|
134
|
+
conclusion: 'none',
|
|
135
|
+
totalRules: 0,
|
|
136
|
+
passedCount: 0,
|
|
137
|
+
failedCount: 0,
|
|
138
|
+
results: [],
|
|
139
|
+
suggestions: null,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const ruleRecordId = asText(catResult.otherParam?.ruleRecordId) ?? recordId;
|
|
143
|
+
const content = catResult.chatMessage?.content;
|
|
144
|
+
if (typeof content !== 'string' || !content.trim()) {
|
|
145
|
+
return {
|
|
146
|
+
status: 'unparsed',
|
|
147
|
+
recordId: ruleRecordId,
|
|
148
|
+
formData: form,
|
|
149
|
+
emptyReason: null,
|
|
150
|
+
conclusion: 'none',
|
|
151
|
+
totalRules: 0,
|
|
152
|
+
passedCount: 0,
|
|
153
|
+
failedCount: 0,
|
|
154
|
+
results: [],
|
|
155
|
+
suggestions: null,
|
|
156
|
+
contentPreview: typeof content === 'string' ? content.slice(0, 500) : null,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
let payload;
|
|
160
|
+
try {
|
|
161
|
+
payload = JSON.parse(content);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return {
|
|
165
|
+
status: 'unparsed',
|
|
166
|
+
recordId: ruleRecordId,
|
|
167
|
+
formData: form,
|
|
168
|
+
emptyReason: null,
|
|
169
|
+
conclusion: 'none',
|
|
170
|
+
totalRules: 0,
|
|
171
|
+
passedCount: 0,
|
|
172
|
+
failedCount: 0,
|
|
173
|
+
results: [],
|
|
174
|
+
suggestions: null,
|
|
175
|
+
contentPreview: content.slice(0, 500),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const results = normalizeRuleResults(payload);
|
|
179
|
+
const rawFailed = asCount(payload?.failedCount);
|
|
180
|
+
const failedCount = rawFailed ?? results.filter((item) => item.passed === false).length;
|
|
181
|
+
const rawPassed = asCount(payload?.passedCount);
|
|
182
|
+
const passedCount = rawPassed ?? results.filter((item) => item.passed === true).length;
|
|
183
|
+
return {
|
|
184
|
+
status: 'checked',
|
|
185
|
+
recordId: ruleRecordId,
|
|
186
|
+
formData: form,
|
|
187
|
+
emptyReason: null,
|
|
188
|
+
title: asText(payload?.title) ?? form?.title ?? null,
|
|
189
|
+
conclusion: failedCount > 0 ? 'failed' : 'passed',
|
|
190
|
+
totalRules: asCount(payload?.totalRules) ?? results.length,
|
|
191
|
+
passedCount,
|
|
192
|
+
failedCount,
|
|
193
|
+
results,
|
|
194
|
+
suggestions: payload?.suggestions ?? null,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/** 人员为空是服务端明确失败,单独成 subtype,避免和 AI 场景异常混在一起。 */
|
|
198
|
+
function mapAuditApiError(error) {
|
|
199
|
+
if (error instanceof FnaCliError && error.type === 'api' && error.subtype === 'business_error') {
|
|
200
|
+
const message = error.message || '';
|
|
201
|
+
if (message.includes('未获取当前人员信息') || message.includes('人员')) {
|
|
202
|
+
throw new FnaCliError('api', 'person_unavailable', message || '未获取当前人员信息', {
|
|
203
|
+
code: error.code,
|
|
204
|
+
retryable: false,
|
|
205
|
+
details: error.details,
|
|
206
|
+
exitCode: 1,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
async function requestAudit(env, body) {
|
|
213
|
+
let response;
|
|
214
|
+
try {
|
|
215
|
+
response = await env.host.request({
|
|
216
|
+
method: 'POST',
|
|
217
|
+
path: AUDIT_PATH,
|
|
218
|
+
body,
|
|
219
|
+
timeoutMs: AUDIT_TIMEOUT_MS,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
if (isFnaNetworkError(error)) {
|
|
224
|
+
throw fnaPartialError('预审请求发送后连接中断/超时,本次是否已生成预审记录不确定,禁止自动重试;请按 requestId + nodeId 回查预审记录后再决定是否重跑', { attempted: { requestId: body.requestId, nodeId: body.nodeId, recordId: body.recordId ?? null } }, { stage: 'aiCheckAudit' });
|
|
225
|
+
}
|
|
226
|
+
throw mapAuditApiError(error);
|
|
227
|
+
}
|
|
228
|
+
return normalizeAuditResult(unwrapData(response));
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* AI 规则预审(准备):本地校验 ID/枚举/规则文本,生成确认预览与 continuation。
|
|
232
|
+
* 不发请求、不消耗模型额度、不写预审记录。
|
|
233
|
+
*/
|
|
234
|
+
const fnaAuditCheckPrepare = {
|
|
235
|
+
name: 'fna.audit.check.prepare',
|
|
236
|
+
resource: 'audit',
|
|
237
|
+
method: 'audit.check.prepare',
|
|
238
|
+
action: 'fna.audit.check.prepare',
|
|
239
|
+
summary: 'AI 规则预审(准备):校验 workflowId/requestId/nodeId 等入参并生成确认预览与 continuation,不发送请求、不消耗模型额度',
|
|
240
|
+
capability: 'audit',
|
|
241
|
+
risk: WRITE,
|
|
242
|
+
requiresConfirmation: true,
|
|
243
|
+
inputSchema: schemaOf({
|
|
244
|
+
workflowId: { ...SCHEMA_ID, description: '流程 ID(必填,>0);与 requestId、nodeId 拼成数据源 ids' },
|
|
245
|
+
requestId: { ...SCHEMA_ID, description: '流程实例 ID,即预审单据 ID(必填,>0)' },
|
|
246
|
+
nodeId: { ...SCHEMA_ID, description: '流程节点 ID(必填,>0);取当前待办节点的 nodeId' },
|
|
247
|
+
dimension: { type: 'string', enum: [...DIMENSIONS], default: DEFAULT_DIMENSION, description: '预审记录维度:node(按节点,不记个人,动作流 RPC 用这个,默认)/ user(按人)' },
|
|
248
|
+
refId: { ...SCHEMA_ID, description: '规则配置关联 ID,默认取 workflowId;EB 流程传表单 ID' },
|
|
249
|
+
settingId: { ...SCHEMA_ID, description: '规则设置 ID;>0 时直接取该规则设置,0 等同不传' },
|
|
250
|
+
ruleList: { type: 'string', description: '追加规则:JSON 字符串数组或 ## 分隔文本(数组需先序列化成字符串)' },
|
|
251
|
+
pageType: { type: 'string', description: '页面类型,默认 flowPage,透传给规则查询' },
|
|
252
|
+
checkMode: { type: 'string', enum: [...CHECK_MODES], description: '检验模式:batch(一次 AI 审核)/ single(逐条审核后合并);传了会覆盖流程配置' },
|
|
253
|
+
recordId: { ...SCHEMA_ID, description: '已有预审记录 ID;传了则本次结果追加到该记录(0 等同不传)' },
|
|
254
|
+
userId: { ...SCHEMA_ID, description: '执行人 ID(>0);不传用当前登录人,传了人员不存在会直接失败,不回退' },
|
|
255
|
+
}, {
|
|
256
|
+
required: ['workflowId', 'requestId', 'nodeId'],
|
|
257
|
+
description: 'AI 规则预审(准备):只做输入归一化与确认,不触网',
|
|
258
|
+
}),
|
|
259
|
+
handler: async (args, env) => {
|
|
260
|
+
const body = buildAuditBody(args);
|
|
261
|
+
const session = await env.host.getSession();
|
|
262
|
+
const token = await env.continuation.issue({
|
|
263
|
+
operation: 'fna.audit.check.apply',
|
|
264
|
+
baseUrl: session.baseUrl,
|
|
265
|
+
profile: session.profile,
|
|
266
|
+
userId: session.userId,
|
|
267
|
+
body,
|
|
268
|
+
fingerprint: fingerprint(body),
|
|
269
|
+
}, CONTINUATION_TTL_SECONDS * 1000);
|
|
270
|
+
return fnaSuccess('fna.audit.check.prepare', {
|
|
271
|
+
status: 'AWAITING_CONFIRMATION',
|
|
272
|
+
preview: {
|
|
273
|
+
...body,
|
|
274
|
+
action: '按流程配置的 AI 规则对该单据做预审',
|
|
275
|
+
cost: '会消耗一次或多次大模型调用(single 模式逐条审核),通常数十秒到数分钟',
|
|
276
|
+
sideEffect: '会写入/更新预审记录 ai_check_audit_record;传 recordId 时追加到该记录',
|
|
277
|
+
appendToRecord: body.recordId ?? null,
|
|
278
|
+
hint: '向用户展示单据(requestId)、节点、检验模式与副作用后再确认;确认后调用 fna.audit.check.apply',
|
|
279
|
+
},
|
|
280
|
+
continuation: token,
|
|
281
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* AI 规则预审(执行):需 confirm=true 与 prepare 返回的 continuation,请求体指纹须与 prepare 一致。
|
|
287
|
+
* 逐条规则结果以 data.results 返回;接口已写入预审记录,超时/断网按「结果不确定」处理,禁止自动重试。
|
|
288
|
+
*/
|
|
289
|
+
const fnaAuditCheckApply = {
|
|
290
|
+
name: 'fna.audit.check.apply',
|
|
291
|
+
resource: 'audit',
|
|
292
|
+
method: 'audit.check.apply',
|
|
293
|
+
action: 'fna.audit.check.apply',
|
|
294
|
+
summary: 'AI 规则预审(执行):需 confirm=true 与 prepare 的 continuation,返回逐条规则的 passed/riskName 与汇总计数;会写预审记录并消耗大模型',
|
|
295
|
+
capability: 'audit',
|
|
296
|
+
risk: WRITE,
|
|
297
|
+
requiresConfirmation: true,
|
|
298
|
+
inputSchema: schemaOf({
|
|
299
|
+
workflowId: { ...SCHEMA_ID, description: '流程 ID(必填,>0);与 prepare 时一致' },
|
|
300
|
+
requestId: { ...SCHEMA_ID, description: '流程实例 ID(必填,>0);与 prepare 时一致' },
|
|
301
|
+
nodeId: { ...SCHEMA_ID, description: '流程节点 ID(必填,>0);与 prepare 时一致' },
|
|
302
|
+
dimension: { type: 'string', enum: [...DIMENSIONS], default: DEFAULT_DIMENSION, description: '预审记录维度:node(默认)/ user;不传按 prepare 默认值 node' },
|
|
303
|
+
refId: { ...SCHEMA_ID, description: '规则配置关联 ID,默认取 workflowId' },
|
|
304
|
+
settingId: { ...SCHEMA_ID, description: '规则设置 ID;>0 时直接取该规则设置' },
|
|
305
|
+
ruleList: { type: 'string', description: '追加规则:JSON 字符串数组或 ## 分隔文本' },
|
|
306
|
+
pageType: { type: 'string', description: '页面类型,默认 flowPage' },
|
|
307
|
+
checkMode: { type: 'string', enum: [...CHECK_MODES], description: '检验模式:batch / single' },
|
|
308
|
+
recordId: { ...SCHEMA_ID, description: '已有预审记录 ID;传了则追加到该记录' },
|
|
309
|
+
userId: { ...SCHEMA_ID, description: '执行人 ID(>0);不传用当前登录人' },
|
|
310
|
+
confirm: { const: true },
|
|
311
|
+
continuation: { ...SCHEMA_STRING_NONEMPTY, description: 'prepare 返回的 continuation' },
|
|
312
|
+
}, {
|
|
313
|
+
required: ['workflowId', 'requestId', 'nodeId', 'confirm', 'continuation'],
|
|
314
|
+
description: 'AI 规则预审(执行):写入预审记录并消耗大模型',
|
|
315
|
+
}),
|
|
316
|
+
handler: async (args, env) => {
|
|
317
|
+
requireConfirm(args, 'fna.audit.check.apply');
|
|
318
|
+
const body = buildAuditBody(args);
|
|
319
|
+
const lease = await verifyLease(args, 'fna.audit.check.apply', env);
|
|
320
|
+
if (fingerprint(body) !== lease.fingerprint) {
|
|
321
|
+
throw fnaValidationError('target_changed', '预审目标与 prepare 时的快照不一致,请重新执行 prepare');
|
|
322
|
+
}
|
|
323
|
+
const data = await requestAudit(env, body);
|
|
324
|
+
return fnaSuccess('fna.audit.check.apply', data, {
|
|
325
|
+
checkMode: body.checkMode ?? 'flow-config',
|
|
326
|
+
dimension: body.dimension ?? DEFAULT_DIMENSION,
|
|
327
|
+
timeoutMs: AUDIT_TIMEOUT_MS,
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
export const auditOperations = [
|
|
332
|
+
fnaAuditCheckPrepare,
|
|
333
|
+
fnaAuditCheckApply,
|
|
334
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fnaValidationError } from '../errors.js';
|
|
2
2
|
import { budgetOperations } from './budget.js';
|
|
3
|
+
import { auditOperations } from './audit.js';
|
|
3
4
|
import { expenseCenterOperations } from './expense-center.js';
|
|
4
5
|
import { expenseChartOperations } from './expense-chart.js';
|
|
5
6
|
import { loanOperations } from './loan.js';
|
|
@@ -8,6 +9,7 @@ function buildRegistry() {
|
|
|
8
9
|
const registry = new Map();
|
|
9
10
|
const definitions = [
|
|
10
11
|
...budgetOperations,
|
|
12
|
+
...auditOperations,
|
|
11
13
|
...expenseCenterOperations,
|
|
12
14
|
...expenseChartOperations,
|
|
13
15
|
...loanOperations,
|
|
@@ -8,6 +8,7 @@ import { extractGroupMembers, isSystemMember, str, unwrapInner } from './shared.
|
|
|
8
8
|
* `txt` 字段传 JSON 字符串会被服务端原样塞进 `dt[0].txt.v`,客户端直接显示 JSON 原文(踩坑确认)。
|
|
9
9
|
* - 原生结构:`{ bgc:'', cnt:'0', dev:5, display:'', dt:[{txt:{aus, ft:'china', next:'0', v}}],
|
|
10
10
|
* guid:'0', idx:'0', opb:['received','reply'], scid, sname, suid, sysId:'', type:'1', ver:'1.0', weaOaId:'' }`
|
|
11
|
+
* (markdown 消息外层 type 为 '26'——客户端仅对 type=26 按 markdown 解析——且 txt 段带 vt:'1')
|
|
11
12
|
* - `txt.aus` 条目:@具体人 `{ cid:<人cid>, fd:'@', id:<人uid>, nm:<姓名>, t:'1' }`;
|
|
12
13
|
* @所有人固定 `{ cid:'10000', fd:'@', id:'88', nm:'全体成员', t:'2' }`。
|
|
13
14
|
* - `txt.v` 中每个 @ 位置写占位符 `:@<id>;`(冒号+@+id+分号),其余文本原样保留;
|
|
@@ -104,14 +105,16 @@ export function buildAtText(text, entries) {
|
|
|
104
105
|
const aus = [...used, ...rest];
|
|
105
106
|
return { v, aus };
|
|
106
107
|
}
|
|
107
|
-
/** 组装 sendGroupMsg 的 `msg` 字段值(完整原生 msg JSON 字符串)。 */
|
|
108
|
-
export function buildAtMsgJson(v, aus, self, extra = {}
|
|
108
|
+
/** 组装 sendGroupMsg/sendSingleMsg 的 `msg` 字段值(完整原生 msg JSON 字符串)。 */
|
|
109
|
+
export function buildAtMsgJson(v, aus, self, extra = {},
|
|
110
|
+
/** txt 段附加字段(与 v 同级),如 markdown 的 `{ vt: '1' }`。 */
|
|
111
|
+
txtExtra = {}) {
|
|
109
112
|
return JSON.stringify({
|
|
110
113
|
bgc: '',
|
|
111
114
|
cnt: '0',
|
|
112
115
|
dev: 5,
|
|
113
116
|
display: '',
|
|
114
|
-
dt: [{ txt: { aus, ft: 'china', next: '0', v } }],
|
|
117
|
+
dt: [{ txt: { aus, ft: 'china', next: '0', v, ...txtExtra } }],
|
|
115
118
|
guid: '0',
|
|
116
119
|
idx: '0',
|
|
117
120
|
opb: ['received', 'reply'],
|