weaver-work-cli 0.1.76 → 0.1.78
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/README.md +3 -1
- package/dist/chunks/{attachment-content-24RL44SE.js → attachment-content-TFOC3Y3X.js} +3 -3
- package/dist/chunks/{chunk-FEZK536Z.js → chunk-4PBN7NJY.js} +353 -43
- package/dist/chunks/{chunk-SQFKBWTR.js → chunk-5VQ7JHV4.js} +132 -47
- package/dist/chunks/{chunk-KJA7CRES.js → chunk-7SQN5IZR.js} +1 -1
- package/dist/chunks/{chunk-MS7MKBGJ.js → chunk-BP7BONZO.js} +664 -75
- package/dist/chunks/{chunk-L5SCNJKX.js → chunk-DACQKJ6O.js} +1 -1
- package/dist/chunks/{chunk-T7HVQ2WP.js → chunk-E2EY3DMS.js} +2 -2
- package/dist/chunks/{chunk-WJQJ7YEX.js → chunk-FAC4IFGQ.js} +2 -2
- package/dist/chunks/{minute-doc-4BA2R5EA.js → chunk-IBTGXLOT.js} +99 -16
- package/dist/chunks/{chunk-OJ4JPD25.js → chunk-LQLIXBJF.js} +6 -8
- package/dist/chunks/{chunk-H6N6U2D6.js → chunk-SWFTWNWL.js} +7 -7
- package/dist/chunks/{chunk-SU6IJD6D.js → chunk-TD5IOEGN.js} +1 -1
- package/dist/chunks/{chunk-Q7RXCK2Y.js → chunk-USYFVIUR.js} +22 -7
- package/dist/chunks/{chunk-WHI6YAUE.js → chunk-UZ2E3VNI.js} +1 -1
- package/dist/chunks/{chunk-AZC53XSQ.js → chunk-VNEU7OUN.js} +1 -1
- package/dist/chunks/{chunk-5QUTQHXF.js → chunk-WNFDR5PC.js} +198 -80
- package/dist/chunks/{chunk-NZQRW4KL.js → chunk-Z44YFIN6.js} +2 -2
- package/dist/chunks/{chunk-R4PN3OFK.js → chunk-ZOTXXGUM.js} +7 -7
- package/dist/chunks/{cli-DFLV57LO.js → cli-WA7FOQKC.js} +10 -10
- package/dist/chunks/{conflict-72Q6DM4I.js → conflict-D4GVAURN.js} +2 -2
- package/dist/chunks/{contract-IRNRQ5FY.js → contract-GW7US3UF.js} +4399 -3547
- package/dist/chunks/{create-flow-UGTDI7SP.js → create-flow-ERDGW3FZ.js} +10 -6
- package/dist/chunks/{ehr-PHIBBUIG.js → ehr-P6T7OAAV.js} +1 -1
- package/dist/chunks/{entry-mode-5WOXFE67.js → entry-mode-SQU5WTX6.js} +3 -3
- package/dist/chunks/{env-H4ALHESA.js → env-DASBNSEM.js} +2 -2
- package/dist/chunks/{factory-COX6AVK7.js → factory-A3NAKZAA.js} +1 -1
- package/dist/chunks/{group-chat-ZIWQQO4G.js → group-chat-7SEAVAJR.js} +3 -3
- package/dist/chunks/{lazy-dispatch-MZ3EZYDL.js → lazy-dispatch-ZDKLS5MR.js} +3 -3
- package/dist/chunks/{meeting-XE6CTXYA.js → meeting-7AEQGBAT.js} +18 -12
- package/dist/chunks/minute-doc-REI6RUE4.js +20 -0
- package/dist/chunks/{project-XREEXFU2.js → project-6PRGBLO2.js} +38 -14
- package/dist/chunks/{recruit-stage-TSQWOGQD.js → recruit-stage-TLZJUFHD.js} +543 -463
- package/dist/chunks/{registry-F4YFZLOD.js → registry-KQ4TNUWO.js} +1 -1
- package/dist/chunks/{registry-7UDUWYB5.js → registry-UVTI323K.js} +12 -11
- package/dist/chunks/{room-recommend-FO3HLPNB.js → room-recommend-ELEJUYBN.js} +4 -4
- package/dist/chunks/{schedule-DHNNOHVS.js → schedule-XBKY7VEA.js} +4 -4
- package/dist/chunks/{update-AV5VOXGY.js → update-77ZUIYSG.js} +2 -2
- package/dist/chunks/{workflow-MAGCHWYZ.js → workflow-SYCBS5XD.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/internal/update/service.js +9 -8
- package/dist/shortcuts/contract/data/collection-ledger-html.js +109 -33
- package/dist/shortcuts/contract/data/collection-node-catalog.js +26 -2
- package/dist/shortcuts/contract/data/report-renderers.js +75 -31
- package/dist/shortcuts/contract/data/report-spec.js +17 -3
- package/dist/shortcuts/contract/manifest.js +20 -3
- package/dist/shortcuts/contract/operations/bizreview-report.js +23 -2
- package/dist/shortcuts/contract/operations/collection-node.js +116 -1
- package/dist/shortcuts/contract/operations/compare-report.js +27 -5
- package/dist/shortcuts/contract/operations/credit-page.js +11 -2
- package/dist/shortcuts/contract/operations/docx-slots.js +27 -2
- package/dist/shortcuts/contract/operations/draft-submit.js +9 -6
- package/dist/shortcuts/contract/operations/elements-build.js +162 -30
- package/dist/shortcuts/contract/operations/elements-spec.js +50 -0
- package/dist/shortcuts/contract/operations/generated-submit.js +35 -0
- package/dist/shortcuts/contract/operations/ledger-card.js +32 -2
- package/dist/shortcuts/contract/operations/ledger-stat.js +17 -5
- package/dist/shortcuts/contract/operations/ledger.js +88 -16
- package/dist/shortcuts/contract/operations/metrics.js +16 -3
- package/dist/shortcuts/contract/operations/ops-draft.js +359 -27
- package/dist/shortcuts/contract/operations/page.js +23 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +91 -13
- package/dist/shortcuts/contract/operations/quote-submit.js +16 -0
- package/dist/shortcuts/contract/operations/review-report.js +11 -3
- package/dist/shortcuts/contract/operations/save-recognize.js +62 -1
- package/dist/shortcuts/contract/operations/triage.js +18 -3
- package/dist/shortcuts/contract/operations/viewlink.js +17 -1
- package/dist/shortcuts/ehr/operations/recruit.js +255 -90
- package/dist/shortcuts/meeting/confirm-gate.js +42 -0
- package/dist/shortcuts/meeting/continuation.js +6 -2
- package/dist/shortcuts/meeting/minute-doc.js +119 -12
- package/dist/shortcuts/meeting/operations/attachment.js +19 -0
- package/dist/shortcuts/meeting/operations/compose-outcome.js +24 -2
- package/dist/shortcuts/meeting/operations/eb/conflict.js +2 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +162 -19
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +22 -3
- package/dist/shortcuts/meeting/operations/group-share.js +268 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +58 -1
- package/dist/shortcuts/meeting/operations/minute-export.js +295 -0
- package/dist/shortcuts/meeting/operations/registry.js +4 -0
- package/dist/shortcuts/project/operations/read.js +40 -15
- package/dist/shortcuts/recruit-stage/context.js +16 -81
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +89 -53
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +15 -5
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +46 -108
- package/dist/shortcuts/recruit-stage/operations/list.js +203 -74
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -85
- package/dist/shortcuts/recruit-stage/operations/search.js +113 -53
- package/dist/shortcuts/recruit-stage/shared.js +153 -4
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +11 -0
- package/dist/shortcuts/workflow/operations/read.js +24 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +2 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +28 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.node.js +198 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subordinate.js +70 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +15 -5
- package/docs/project.md +1 -1
- package/package.json +1 -1
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +64 -28
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +26 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +9 -8
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +47 -52
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +7 -1
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +44 -1
- package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +8 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +33 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +17 -3
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +18 -10
- package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +77 -37
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +7 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +55 -12
- package/skills/weaver-e10-jinchengda/references/contract-review-todo.md +102 -0
- package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +1 -17
- package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +11 -8
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +2 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +6 -6
- package/skills/weaver-e10-meeting/SKILL.md +203 -80
- package/skills/weaver-e10-meeting/references/create-quickstart.md +98 -0
- package/skills/weaver-e10-meeting/references/delivery-checklist.md +34 -0
- package/skills/weaver-e10-meeting/references/error-codes.md +44 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +56 -3
- package/skills/weaver-e10-meeting/references/room-recommend.md +2 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +61 -58
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +28 -25
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +20 -14
- package/skills/weaver-e10-recruit-stage/lib/recruit-attach-probe.mjs +127 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +71 -25
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +39 -7
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +2 -2
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +8 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +29 -31
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +4 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +6 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +10 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +2 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +1 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +10 -28
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +1 -1
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +2 -2
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +1 -1
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +14 -10
- package/skills/weaver-e10-shijingran/SKILL.md +2 -2
- package/skills/weaver-e10-shijingran/references/operations.md +5 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-workflow/SKILL.md +13 -9
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +33 -8
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +19 -14
- package/skills/weaver-e10-workflow/references/workflow-create.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +4 -2
- package/skills/weaver-e10-workflow/references/workflow-view.md +3 -3
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +132 -42
- package/templates/meeting/minute.docx +0 -0
- package/skills/weaver-e10-yepiaotong.zip +0 -0
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { E10_REAUTH_GUIDANCE } from '../../../internal/e10/auth/messages.js';
|
|
11
11
|
import { workflowSuccess, schemaOf, SCHEMA_REQUEST_ID, SCHEMA_CATEGORY, SCHEMA_INDEX, SCHEMA_PAGE_SIZE, } from './types.js';
|
|
12
12
|
import { asString, asInt, asStringArray, asBool, compact, responseData, detailDataOf, toArray, resolveMemoryAppId, withLeadingMeta, STDOUT_SAFE_BYTES, stdoutBytesOf, parseNameWithId, } from './shared.js';
|
|
13
|
+
import { resolveTodoNodeFilter } from './todoSmartConvert/todoSmartConvert.node.js';
|
|
13
14
|
import { workflowValidationError, WorkflowCliError, workflowClarificationError, CLARIFICATION_SUBTYPE, } from '../errors.js';
|
|
14
15
|
import { WORKFLOW_ENDPOINTS } from '../endpoints.js';
|
|
15
16
|
import { flowStatusCondition, FLOW_STATUS_HINT } from './flow-status.js';
|
|
@@ -476,7 +477,14 @@ async function resolveTerm(env, systemKey, rawValue, label, workflowNameMatch) {
|
|
|
476
477
|
return { id: parsed.id, name: parsed.name || text };
|
|
477
478
|
if (systemKey === 'creator' && CREATOR_SELF_TERMS.has(text))
|
|
478
479
|
return null;
|
|
479
|
-
|
|
480
|
+
let candidates = await resolveNameCandidates(env, SYSTEM_FIELDS[systemKey], text);
|
|
481
|
+
if (systemKey === 'workflowid' && workflowNameMatch === 'all' && candidates.length === 0) {
|
|
482
|
+
// 仅原词无命中时尝试用户确认的同义词,保留真实候选名称与后续澄清。
|
|
483
|
+
const synonym = text.includes('评估') ? text.replaceAll('评估', '评审')
|
|
484
|
+
: text.includes('评审') ? text.replaceAll('评审', '评估') : '';
|
|
485
|
+
if (synonym)
|
|
486
|
+
candidates = await resolveNameCandidates(env, SYSTEM_FIELDS[systemKey], synonym);
|
|
487
|
+
}
|
|
480
488
|
const clarificationType = SYSTEM_CLARIFICATION_TYPES[systemKey];
|
|
481
489
|
if (!candidates.length) {
|
|
482
490
|
// 0 命中:只有 --workflow 澄清,其余系统字段一律失败(V11.3 口径)
|
|
@@ -994,6 +1002,9 @@ async function resolveFilterFieldItem(env, raw, fields, workflowLabel, ordinal)
|
|
|
994
1002
|
+ '本次查询已停止。请改用文本/数值/日期/选项类字段。');
|
|
995
1003
|
}
|
|
996
1004
|
export async function buildSearchQuery(env, args, mode, options = {}) {
|
|
1005
|
+
// 节点浏览条件最终只接受 ID;名称在构造标准查询前统一精确解析,禁止退化成工作流名称匹配。
|
|
1006
|
+
const nodeFilter = await resolveTodoNodeFilter(args, env);
|
|
1007
|
+
args = nodeFilter.args;
|
|
997
1008
|
// 1. 原始 JSON 直传(--query-json / --query-file 透传;CLI 侧用 queryJson 字段承载)
|
|
998
1009
|
const rawJson = args.queryJson;
|
|
999
1010
|
let query;
|
|
@@ -1024,9 +1035,10 @@ export async function buildSearchQuery(env, args, mode, options = {}) {
|
|
|
1024
1035
|
}
|
|
1025
1036
|
// 2.5 legacy(低版本模式)恢复 V11.2 语义:todo 未显式指定子分类时默认查「待处理(7)」而非
|
|
1026
1037
|
// 「全部(0)」(来源:Python execute_workflow_search_legacy 的 legacy tab 恢复分支,L12612-12627)。
|
|
1027
|
-
//
|
|
1028
|
-
|
|
1029
|
-
|
|
1038
|
+
// 节点查询默认查全部,显式 subCategory/tabName/tabid 或 queryJson 自带 params.tabid 时保持原值。
|
|
1039
|
+
const hasNodeFilter = !!nodeFilter.resolution || Array.isArray(query.searchParams?.formDatas?.nodeid) &&
|
|
1040
|
+
query.searchParams.formDatas.nodeid.length > 0;
|
|
1041
|
+
if (!hasNodeFilter && asString(args.searchMode) === 'legacy' && category === 'todo' && tabid === DEFAULT_TABID.todo) {
|
|
1030
1042
|
const explicitTab = Boolean(asString(args.subCategory) || asString(args.tabName) ||
|
|
1031
1043
|
(args.tabid !== undefined && String(args.tabid).trim() !== ''));
|
|
1032
1044
|
const rawTabid = query?.params?.tabid;
|
|
@@ -1719,7 +1731,14 @@ const workflowSearch = {
|
|
|
1719
1731
|
requestLevel: { type: 'string', description: '紧急程度名称(CLI 按当前环境等级列表转 ID);纯名称多命中返回澄清候选,0 命中报错并列出可选等级(对齐 V11.3)' },
|
|
1720
1732
|
requestId: { type: 'string', description: '按 requestId 精确过滤,逗号分隔' },
|
|
1721
1733
|
exRequestId: { type: 'string', description: '排除 requestId,逗号分隔' },
|
|
1722
|
-
nodeId: {
|
|
1734
|
+
nodeId: {
|
|
1735
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
1736
|
+
description: '当前节点;支持 ID、节点名称、名称(ID),字符串数组或逗号分隔多值,名称按精确匹配解析全部同名节点定义。',
|
|
1737
|
+
},
|
|
1738
|
+
nodeName: {
|
|
1739
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
1740
|
+
description: '当前节点名称,精确匹配并合并全部同名节点定义;字符串数组或逗号分隔多值。',
|
|
1741
|
+
},
|
|
1723
1742
|
nodeIdTerm: { type: 'string', enum: ['in', 'notin'] },
|
|
1724
1743
|
flowStatus: { type: 'string', description: `流程状态(选项类,多选):${FLOW_STATUS_HINT}` },
|
|
1725
1744
|
flowStatusTerm: { type: 'string', enum: ['in', 'notin'] },
|
|
@@ -14,7 +14,7 @@ import { fetchDetailFacts, stampsOfRows } from './todoSmartConvert.detail.js';
|
|
|
14
14
|
import { GROUP_MIN_ITEMS_FOR_SUBGROUP, isExpiringTodayRow, isOverdueRow, runGroup, } from './todoSmartConvert.group.js';
|
|
15
15
|
import { COLLECT_FILTER_KEYS, COLLECT_ORDER_KEYS, DEFAULT_CATEGORY, DEFAULT_TABID, DEGRADE_TABID, FETCH_PAGE_SIZE, LIST_ENDPOINT_BY_CATEGORY, TIME_FILTER_KEYS, guardListOnlyHost, readBoundedInt, readCategory, readCollectPolicy, readPageSize, rowFromAny, totalEndpointFor, } from './todoSmartConvert.core.js';
|
|
16
16
|
const DEFAULT_REQUEST_SUMMARY_MAX = 50;
|
|
17
|
-
export async function collectRawTodos(args, env) {
|
|
17
|
+
export async function collectRawTodos(args, env, nodeResolution) {
|
|
18
18
|
const category = readCategory(args.category);
|
|
19
19
|
// 摘要按规则保留原始字段;普通查询还需保留一级优先组使用的原始截止时间。
|
|
20
20
|
const priorityFields = priorityRuleFields();
|
|
@@ -52,7 +52,7 @@ export async function collectRawTodos(args, env) {
|
|
|
52
52
|
if (!explicitTab)
|
|
53
53
|
searchArgs.tabid = DEFAULT_TABID;
|
|
54
54
|
const warnings = [];
|
|
55
|
-
if (searchArgs.isremarks === undefined) {
|
|
55
|
+
if (searchArgs.isremarks === undefined && !nodeResolution) {
|
|
56
56
|
const defaultIsremarks = generalRules()?.identityFilter?.defaultIsremarks?.trim();
|
|
57
57
|
if (defaultIsremarks) {
|
|
58
58
|
searchArgs.isremarks = defaultIsremarks;
|
|
@@ -187,9 +187,11 @@ export const ALLOWED_INPUT_KEYS = [
|
|
|
187
187
|
'limit',
|
|
188
188
|
'pageSize',
|
|
189
189
|
'category',
|
|
190
|
+
'subordinateName',
|
|
190
191
|
// originData(2026-11-24 用户定稿):摘要链路把 collect 各页 getTodoListData 原始响应体透出,
|
|
191
192
|
// 由 skill 的 tools 脚本落盘 <skill>/originData/,产物 data 里以 originDataId 引用。
|
|
192
193
|
'originData',
|
|
194
|
+
'nodeName',
|
|
193
195
|
...COLLECT_FILTER_KEYS,
|
|
194
196
|
...COLLECT_ORDER_KEYS,
|
|
195
197
|
// smartGroupAdd(2026-11-13):产物落库字段,与 E10 WflSmartGroupAddParamsDto 同名
|
|
@@ -5,6 +5,8 @@ import { planTodoOutput } from './todoOutputPlanner.js';
|
|
|
5
5
|
import { assertKnownKeys, buildSkillTiming, CATEGORY_VALUES, DEFAULT_CATEGORY, DEFAULT_TOP_N, FETCH_PAGE_SIZE, GROUP_BY_VALUES, OUTPUT_MODE_VALUES, readOutputMode, STAGE_VALUES, workflowSuccess, } from './todoSmartConvert.core.js';
|
|
6
6
|
import { collectRawTodos } from './todoSmartConvert.collect.js';
|
|
7
7
|
import { prepareTodoQuery } from './todoSmartConvert.prepareQuery.js';
|
|
8
|
+
import { resolveTodoSubordinate, scopeTodoSubordinate } from './todoSmartConvert.subordinate.js';
|
|
9
|
+
import { resolveTodoNodeFilter } from './todoSmartConvert.node.js';
|
|
8
10
|
import { enrichWorkflowClarification } from './workflowClarification.js';
|
|
9
11
|
import { runSmartConvert } from './todoSmartConvert.aggregate.js';
|
|
10
12
|
import { runGroup } from './todoSmartConvert.group.js';
|
|
@@ -97,6 +99,7 @@ const inputSchema = schemaOf({
|
|
|
97
99
|
description: '废弃兼容参数;页大小由 limit 推导,传入值只产生 warning。',
|
|
98
100
|
},
|
|
99
101
|
category: { type: 'string', enum: [...CATEGORY_VALUES], default: DEFAULT_CATEGORY },
|
|
102
|
+
subordinateName: { type: 'string', description: '仅普通待办 prepareQuery:直属下属完整姓名,重名确认后使用「姓名(ID)」。' },
|
|
100
103
|
tabid: { type: 'string' },
|
|
101
104
|
tabName: { type: 'string' },
|
|
102
105
|
subCategory: { type: 'string' },
|
|
@@ -120,7 +123,14 @@ const inputSchema = schemaOf({
|
|
|
120
123
|
requestLevel: { type: 'string', description: '紧急程度名称(CLI 按当前环境等级列表转 ID);0 命中报错并列出可选等级' },
|
|
121
124
|
requestId: { type: 'string', description: '按 requestId 精确过滤,逗号分隔' },
|
|
122
125
|
exRequestId: { type: 'string', description: '排除 requestId,逗号分隔' },
|
|
123
|
-
nodeId: {
|
|
126
|
+
nodeId: {
|
|
127
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
128
|
+
description: '当前节点;支持 ID、节点名称、名称(ID),字符串数组或逗号分隔多值,名称按精确匹配解析全部同名节点定义。',
|
|
129
|
+
},
|
|
130
|
+
nodeName: {
|
|
131
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
132
|
+
description: '当前节点名称,精确匹配并合并全部同名节点定义;字符串数组或逗号分隔多值。',
|
|
133
|
+
},
|
|
124
134
|
nodeIdTerm: { type: 'string', enum: ['in', 'notin'] },
|
|
125
135
|
flowStatus: { type: 'string', description: `流程状态(选项类,多选):${FLOW_STATUS_HINT}` },
|
|
126
136
|
flowStatusTerm: { type: 'string', enum: ['in', 'notin'] },
|
|
@@ -203,6 +213,10 @@ export const workflowTodoSmartConvertOperations = [{
|
|
|
203
213
|
const stage = args.stage === undefined || args.stage === null || args.stage === ''
|
|
204
214
|
? inferStage(args)
|
|
205
215
|
: readStage(args.stage);
|
|
216
|
+
if (args.subordinateName !== undefined && (stage !== 'prepareQuery' || outputMode === 'summary'
|
|
217
|
+
|| (args.category !== undefined && args.category !== DEFAULT_CATEGORY))) {
|
|
218
|
+
throw workflowValidationError('subordinate_query_only', '下属待办仅支持普通待办查询');
|
|
219
|
+
}
|
|
206
220
|
const hasItems = Array.isArray(args.items);
|
|
207
221
|
const resumed = stage === 'collect' && hasItems;
|
|
208
222
|
/**
|
|
@@ -229,12 +243,19 @@ export const workflowTodoSmartConvertOperations = [{
|
|
|
229
243
|
};
|
|
230
244
|
};
|
|
231
245
|
if (stage === 'prepareQuery') {
|
|
246
|
+
const subordinate = args.subordinateName === undefined ? undefined : await resolveTodoSubordinate(args.subordinateName, env);
|
|
247
|
+
const queryEnv = subordinate ? scopeTodoSubordinate(env, subordinate) : env;
|
|
232
248
|
try {
|
|
233
|
-
const
|
|
249
|
+
const nodeFilter = await resolveTodoNodeFilter(args, queryEnv);
|
|
250
|
+
const result = await prepareTodoQuery(nodeFilter.args, queryEnv, nodeFilter.resolution);
|
|
251
|
+
if (subordinate) {
|
|
252
|
+
result.query.subordinateId = subordinate.id;
|
|
253
|
+
result.query.subordinateName = subordinate.name;
|
|
254
|
+
}
|
|
234
255
|
return finish(env, args, startedAt, stage, result, { branch: 'todo-query', stage }, result.warnings);
|
|
235
256
|
}
|
|
236
257
|
catch (error) {
|
|
237
|
-
throw await enrichWorkflowClarification(error, args,
|
|
258
|
+
throw await enrichWorkflowClarification(error, args, queryEnv);
|
|
238
259
|
}
|
|
239
260
|
}
|
|
240
261
|
if (stage === 'view') {
|
|
@@ -355,7 +376,10 @@ export const workflowTodoSmartConvertOperations = [{
|
|
|
355
376
|
if (stage === 'collect' || !hasItems) {
|
|
356
377
|
let result;
|
|
357
378
|
try {
|
|
358
|
-
|
|
379
|
+
const nodeFilter = await resolveTodoNodeFilter(args, env);
|
|
380
|
+
result = await collectRawTodos(nodeFilter.args, env, nodeFilter.resolution);
|
|
381
|
+
if (nodeFilter.resolution)
|
|
382
|
+
Object.assign(result, { nodeResolution: nodeFilter.resolution });
|
|
359
383
|
}
|
|
360
384
|
catch (error) {
|
|
361
385
|
throw await enrichWorkflowClarification(error, args, env);
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { workflowApiError, workflowValidationError } from '../../errors.js';
|
|
2
|
+
import { WORKFLOW_ENDPOINTS } from '../../endpoints.js';
|
|
3
|
+
import { responseData } from '../shared.js';
|
|
4
|
+
const NODE_PAGE_SIZE = 200;
|
|
5
|
+
const NODE_ID = /^\d+$/u;
|
|
6
|
+
const NAME_WITH_ID = /^(.*?)\s*[((]\s*(\d+)\s*[))]\s*$/u;
|
|
7
|
+
function recordOf(value) {
|
|
8
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
9
|
+
? value : {};
|
|
10
|
+
}
|
|
11
|
+
function textOf(value) {
|
|
12
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '';
|
|
13
|
+
}
|
|
14
|
+
function tokensOf(value, field) {
|
|
15
|
+
if (value === undefined || value === null || value === '')
|
|
16
|
+
return [];
|
|
17
|
+
if (!Array.isArray(value) && typeof value !== 'string' && typeof value !== 'number') {
|
|
18
|
+
throw workflowValidationError('input_invalid', `${field} 必须是字符串或字符串数组`);
|
|
19
|
+
}
|
|
20
|
+
const values = Array.isArray(value) ? value : [value];
|
|
21
|
+
return values.flatMap(item => String(item).split(',')).map(item => item.trim()).filter(Boolean);
|
|
22
|
+
}
|
|
23
|
+
function browserRows(response) {
|
|
24
|
+
const root = recordOf(responseData(response));
|
|
25
|
+
const data = recordOf(root.data);
|
|
26
|
+
const nested = recordOf(data.data);
|
|
27
|
+
const page = { ...root, ...data, ...nested, ...recordOf(data.page ?? root.page ?? nested.page) };
|
|
28
|
+
const candidates = [nested.data, data.data, root.data, data.list, data.result, data.rows, page.result, root.list, root.result];
|
|
29
|
+
const list = candidates.find(Array.isArray);
|
|
30
|
+
if (!Array.isArray(list)) {
|
|
31
|
+
throw workflowApiError('node_metadata_invalid', '节点浏览接口返回结构异常,无法确认节点名称', {
|
|
32
|
+
details: { endpoint: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
rows: list.filter(item => item !== null && typeof item === 'object' && !Array.isArray(item)),
|
|
37
|
+
page,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function definitionOf(row, inherited = {}) {
|
|
41
|
+
const id = textOf(row.id ?? row.nodeId ?? row.nodeid);
|
|
42
|
+
const name = textOf(row.name ?? row.content ?? row.richContent ?? row.title ?? row.nodeName ?? row.nodename);
|
|
43
|
+
if (!id || !name)
|
|
44
|
+
return null;
|
|
45
|
+
const workflowId = textOf(row.workflowId ?? row.workflowid) || inherited.workflowId || '';
|
|
46
|
+
const workflowName = textOf(row.workflowName ?? row.workflowname) || inherited.workflowName || '';
|
|
47
|
+
return { id, name, ...(workflowId ? { workflowId } : {}), ...(workflowName ? { workflowName } : {}) };
|
|
48
|
+
}
|
|
49
|
+
function pageDefinitions(rows) {
|
|
50
|
+
const definitions = [];
|
|
51
|
+
const visit = (row, inherited) => {
|
|
52
|
+
const children = Array.isArray(row.children) ? row.children : Array.isArray(row.childs) ? row.childs : [];
|
|
53
|
+
const ownWorkflowId = textOf(row.workflowId ?? row.workflowid);
|
|
54
|
+
const ownWorkflowName = textOf(row.workflowName ?? row.workflowname);
|
|
55
|
+
const context = {
|
|
56
|
+
workflowId: ownWorkflowId || inherited.workflowId,
|
|
57
|
+
workflowName: ownWorkflowName || inherited.workflowName,
|
|
58
|
+
};
|
|
59
|
+
if (children.length) {
|
|
60
|
+
for (const child of children) {
|
|
61
|
+
if (child !== null && typeof child === 'object' && !Array.isArray(child)) {
|
|
62
|
+
visit(child, context);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const definition = definitionOf(row, context);
|
|
68
|
+
if (definition)
|
|
69
|
+
definitions.push(definition);
|
|
70
|
+
};
|
|
71
|
+
for (const row of rows)
|
|
72
|
+
visit(row, {});
|
|
73
|
+
return definitions;
|
|
74
|
+
}
|
|
75
|
+
async function exactNodeDefinitions(name, env) {
|
|
76
|
+
const found = new Map();
|
|
77
|
+
const related = new Map();
|
|
78
|
+
const seenPages = new Set();
|
|
79
|
+
let readCount = 0;
|
|
80
|
+
for (let pageNo = 1;; pageNo += 1) {
|
|
81
|
+
const response = await env.host.workflowRequest({
|
|
82
|
+
method: 'POST',
|
|
83
|
+
path: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER,
|
|
84
|
+
operation: 'workflow.todoSmartConvert.resolveNodeName',
|
|
85
|
+
body: {
|
|
86
|
+
showHistory: true,
|
|
87
|
+
belongType: 1,
|
|
88
|
+
workflowIdsCondition: 'in',
|
|
89
|
+
searchValue: name,
|
|
90
|
+
current: pageNo,
|
|
91
|
+
pageNo,
|
|
92
|
+
pageSize: NODE_PAGE_SIZE,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
const { rows, page } = browserRows(response);
|
|
96
|
+
const definitions = pageDefinitions(rows);
|
|
97
|
+
if (rows.length && !definitions.length) {
|
|
98
|
+
throw workflowApiError('node_metadata_invalid', '节点浏览接口返回了缺少节点 ID 或名称的记录', {
|
|
99
|
+
details: { endpoint: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER, nodeName: name, pageNo },
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
readCount += rows.length;
|
|
103
|
+
const signature = definitions.map(item => `${item.id}:${item.workflowId ?? ''}`).join('|');
|
|
104
|
+
if (pageNo > 1 && signature && seenPages.has(signature)) {
|
|
105
|
+
throw workflowApiError('node_metadata_pagination', '节点浏览接口未正确翻页,无法确认全部同名节点', {
|
|
106
|
+
details: { endpoint: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER, nodeName: name, pageNo },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (signature)
|
|
110
|
+
seenPages.add(signature);
|
|
111
|
+
for (const item of definitions) {
|
|
112
|
+
if (item.name.includes(name) || name.includes(item.name)) {
|
|
113
|
+
related.set(`${item.id}:${item.workflowId ?? ''}`, item);
|
|
114
|
+
}
|
|
115
|
+
if (item.name === name)
|
|
116
|
+
found.set(`${item.id}:${item.workflowId ?? ''}`, item);
|
|
117
|
+
}
|
|
118
|
+
const hasNext = typeof page.hasNext === 'boolean' ? page.hasNext : undefined;
|
|
119
|
+
const totalPages = Number(page.totalPages ?? page.pages);
|
|
120
|
+
const totalCount = Number(page.totalCount ?? page.total);
|
|
121
|
+
const responsePageSize = Number(page.pageSize);
|
|
122
|
+
const pageSize = Number.isSafeInteger(responsePageSize) && responsePageSize > 0 ? responsePageSize : NODE_PAGE_SIZE;
|
|
123
|
+
if (hasNext === false || (Number.isSafeInteger(totalPages) && totalPages > 0 && pageNo >= totalPages)
|
|
124
|
+
|| (Number.isSafeInteger(totalCount) && totalCount >= 0 && readCount >= totalCount))
|
|
125
|
+
break;
|
|
126
|
+
const expectsMore = hasNext === true || (Number.isSafeInteger(totalPages) && pageNo < totalPages)
|
|
127
|
+
|| (Number.isSafeInteger(totalCount) && readCount < totalCount);
|
|
128
|
+
if (expectsMore) {
|
|
129
|
+
if (!rows.length || pageNo >= 100) {
|
|
130
|
+
throw workflowApiError('node_metadata_pagination', '节点浏览接口分页数量与返回数据不一致,无法确认全部同名节点', {
|
|
131
|
+
details: { endpoint: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER, nodeName: name, pageNo, readCount, totalCount },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (rows.length < pageSize)
|
|
137
|
+
break;
|
|
138
|
+
if (pageNo >= 100) {
|
|
139
|
+
throw workflowApiError('node_metadata_pagination', '节点浏览接口分页超过安全上限,无法确认全部同名节点', {
|
|
140
|
+
details: { endpoint: WORKFLOW_ENDPOINTS.NODE_TREE_BROWSER, nodeName: name },
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { exact: [...found.values()], candidates: [...related.values()] };
|
|
145
|
+
}
|
|
146
|
+
/** 将节点 ID / 名称统一解析成标准列表只接受的节点 ID 条件。 */
|
|
147
|
+
export async function resolveTodoNodeFilter(args, env) {
|
|
148
|
+
const explicitIds = [];
|
|
149
|
+
const requestedNames = tokensOf(args.nodeName, 'nodeName');
|
|
150
|
+
if (args.nodeName !== undefined && !requestedNames.length) {
|
|
151
|
+
throw workflowValidationError('node_name_required', '请说明要查询的节点名称');
|
|
152
|
+
}
|
|
153
|
+
for (const token of tokensOf(args.nodeId, 'nodeId')) {
|
|
154
|
+
const withId = NAME_WITH_ID.exec(token);
|
|
155
|
+
if (withId)
|
|
156
|
+
explicitIds.push(withId[2]);
|
|
157
|
+
else if (NODE_ID.test(token))
|
|
158
|
+
explicitIds.push(token);
|
|
159
|
+
else
|
|
160
|
+
requestedNames.push(token);
|
|
161
|
+
}
|
|
162
|
+
const names = [...new Set(requestedNames)];
|
|
163
|
+
if (names.length && args.nodeIdTerm === 'notin') {
|
|
164
|
+
throw workflowValidationError('node_name_notin_unsupported', '按节点名称查询不支持 nodeIdTerm=notin,请改用明确的节点 ID 排除');
|
|
165
|
+
}
|
|
166
|
+
if (!names.length) {
|
|
167
|
+
if (!explicitIds.length)
|
|
168
|
+
return { args, named: false };
|
|
169
|
+
const nodeIds = [...new Set(explicitIds)];
|
|
170
|
+
const { nodeName: _nodeName, ...rest } = args;
|
|
171
|
+
const resolution = {
|
|
172
|
+
requestedNames: [], nodeIds, matchedDefinitions: [], nodeDefinitionCount: nodeIds.length,
|
|
173
|
+
};
|
|
174
|
+
return { args: { ...rest, nodeId: nodeIds.join(',') }, resolution, named: false };
|
|
175
|
+
}
|
|
176
|
+
const resolvedNames = await Promise.all(names.map(name => exactNodeDefinitions(name, env)));
|
|
177
|
+
const matchedDefinitions = resolvedNames.flatMap(item => item.exact);
|
|
178
|
+
const matchedNames = new Set(matchedDefinitions.map(item => item.name));
|
|
179
|
+
const missing = names.filter(name => !matchedNames.has(name));
|
|
180
|
+
if (missing.length) {
|
|
181
|
+
const candidates = [...new Map(resolvedNames.flatMap(item => item.candidates)
|
|
182
|
+
.map(item => [`${item.id}:${item.workflowId ?? ''}`, item])).values()].slice(0, 20);
|
|
183
|
+
throw workflowValidationError('node_name_not_found', `未找到节点:${missing.join('、')}`, {
|
|
184
|
+
nodeNames: missing,
|
|
185
|
+
...(candidates.length ? { candidates } : {}),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const uniqueDefinitions = [...new Map(matchedDefinitions.map(item => [`${item.id}:${item.workflowId ?? ''}`, item])).values()];
|
|
189
|
+
const nodeIds = [...new Set([...explicitIds, ...uniqueDefinitions.map(item => item.id)])];
|
|
190
|
+
const resolution = {
|
|
191
|
+
requestedNames: names,
|
|
192
|
+
nodeIds,
|
|
193
|
+
matchedDefinitions: uniqueDefinitions,
|
|
194
|
+
nodeDefinitionCount: nodeIds.length,
|
|
195
|
+
};
|
|
196
|
+
const { nodeName: _nodeName, ...rest } = args;
|
|
197
|
+
return { args: { ...rest, nodeId: nodeIds.join(',') }, resolution, named: true };
|
|
198
|
+
}
|
package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js
CHANGED
|
@@ -36,7 +36,7 @@ function displayRows(response) {
|
|
|
36
36
|
return rows;
|
|
37
37
|
}
|
|
38
38
|
/** 准备原生查询,并用同条件标准列表生成有界分布;不收窄时间、不生成摘要或汇总ID。 */
|
|
39
|
-
export async function prepareTodoQuery(args, env) {
|
|
39
|
+
export async function prepareTodoQuery(args, env, nodeResolution) {
|
|
40
40
|
const category = readCategory(args.category);
|
|
41
41
|
const requestedLimit = args.limit === undefined || args.limit === null || args.limit === '' ? QUERY_MAX_LIMIT : args.limit;
|
|
42
42
|
const policy = readCollectPolicy('query', requestedLimit);
|
|
@@ -50,7 +50,7 @@ export async function prepareTodoQuery(args, env) {
|
|
|
50
50
|
&& String(searchArgs[key]).trim() !== '');
|
|
51
51
|
if (!explicitTab)
|
|
52
52
|
searchArgs.tabid = DEFAULT_TABID;
|
|
53
|
-
if (searchArgs.isremarks === undefined) {
|
|
53
|
+
if (searchArgs.isremarks === undefined && !nodeResolution) {
|
|
54
54
|
const defaultIsremarks = generalRules()?.identityFilter?.defaultIsremarks?.trim();
|
|
55
55
|
if (defaultIsremarks)
|
|
56
56
|
searchArgs.isremarks = defaultIsremarks;
|
|
@@ -146,12 +146,14 @@ export async function prepareTodoQuery(args, env) {
|
|
|
146
146
|
category, requestedLimit: policy.limit, totalAvailable: total,
|
|
147
147
|
filters: Object.fromEntries(Object.entries(searchArgs).filter(([key]) => !['category', 'tabid', 'sort'].includes(key))),
|
|
148
148
|
listQuery,
|
|
149
|
+
...(nodeResolution ? { nodeResolution } : {}),
|
|
149
150
|
...(categoryCounts ? { categoryCounts } : {}),
|
|
150
151
|
...(sort ? { sort } : {}),
|
|
151
152
|
},
|
|
152
153
|
totalCount: total,
|
|
153
154
|
distribution: { items: [...counts.values()], readCount: seen.size, totalCount: total, complete, truncated: !complete },
|
|
154
155
|
markdown: total === null ? '查询条件已准备,数量待列表返回。' : `查询条件已准备,匹配${total}条待办。`,
|
|
156
|
+
...(nodeResolution ? { nodeResolution } : {}),
|
|
155
157
|
...(warnings?.length ? { warnings } : {}),
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { WORKFLOW_ENDPOINTS } from '../../endpoints.js';
|
|
2
|
+
import { workflowApiError, workflowClarificationError } from '../../errors.js';
|
|
3
|
+
import { asString, parseNameWithId, responseData } from '../shared.js';
|
|
4
|
+
/** 只从当前会话可访问的直属下属中匹配;确认重名候选后传入的 ID 也须重新校验。 */
|
|
5
|
+
export async function resolveTodoSubordinate(input, env) {
|
|
6
|
+
const { name, id } = parseNameWithId(asString(input) ?? '');
|
|
7
|
+
if (!name) {
|
|
8
|
+
throw workflowClarificationError('subordinate', '', '请问您要查询哪位下属的待办?', [], {
|
|
9
|
+
clarificationReason: 'subordinate_required', missingInput: ['subordinateName'],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const session = await env.host.getSession();
|
|
13
|
+
const employeeId = session.userId.trim();
|
|
14
|
+
if (!/^\d+$/u.test(employeeId)) {
|
|
15
|
+
throw workflowApiError('current_employee_missing', '当前会话无法确认您的人员 ID,无法查询下属待办');
|
|
16
|
+
}
|
|
17
|
+
const matches = new Map();
|
|
18
|
+
for (let pageNo = 1;; pageNo += 1) {
|
|
19
|
+
const response = await env.host.workflowRequest({
|
|
20
|
+
method: 'GET', path: `/api/bs/hrm/user/myDirectSubordinates/${employeeId}`,
|
|
21
|
+
operation: 'workflow.todoSmartConvert.subordinate',
|
|
22
|
+
query: { id: employeeId, pageNo, pageSize: 10, virtualId: '1', username: name, isMobile: false },
|
|
23
|
+
headers: { Referer: `${session.baseUrl.replace(/\/+$/u, '')}/sp/hrm/profileInfo/${employeeId}` },
|
|
24
|
+
});
|
|
25
|
+
const data = responseData(response);
|
|
26
|
+
if (data?.hasRight !== true) {
|
|
27
|
+
throw workflowApiError('subordinate_no_right', '当前会话没有查看直属下属的权限', { code: 403 });
|
|
28
|
+
}
|
|
29
|
+
const page = data.page;
|
|
30
|
+
if (!Array.isArray(page?.result)) {
|
|
31
|
+
throw workflowApiError('unexpected_response', '直属下属查询返回结构异常');
|
|
32
|
+
}
|
|
33
|
+
for (const row of page.result) {
|
|
34
|
+
if (asString(row?.username) !== name)
|
|
35
|
+
continue;
|
|
36
|
+
// 人员 ID 使用字符串,保留长整型精度。
|
|
37
|
+
const rowId = typeof row.employeeId === 'string' ? row.employeeId : row.id;
|
|
38
|
+
if (typeof rowId !== 'string' || !/^\d+$/u.test(rowId) || rowId === employeeId)
|
|
39
|
+
continue;
|
|
40
|
+
const candidate = { id: rowId, name, department: asString(row.department?.name) };
|
|
41
|
+
if (id === rowId)
|
|
42
|
+
return candidate;
|
|
43
|
+
matches.set(rowId, candidate);
|
|
44
|
+
}
|
|
45
|
+
if (page.result.length === 0 || !(page.hasNext || (page.totalPages ?? 0) > pageNo))
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
const candidates = [...matches.values()];
|
|
49
|
+
if (!id && candidates.length === 1)
|
|
50
|
+
return candidates[0];
|
|
51
|
+
if (!candidates.length || id) {
|
|
52
|
+
throw workflowClarificationError('subordinate', name, `未找到可查询的直属下属「${name}」,请确认姓名。`);
|
|
53
|
+
}
|
|
54
|
+
throw workflowClarificationError('subordinate', name, `有多位直属下属名为「${name}」,请确认具体人员。`, candidates.map(({ id: candidateId, name: candidateName, department }, index) => ({
|
|
55
|
+
id: candidateId, name: candidateName, index: index + 1,
|
|
56
|
+
label: department ? `${candidateName} · ${department}` : candidateName,
|
|
57
|
+
display: `${candidateName}(${candidateId})`,
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
/** 查询、分布和候选计数统一使用下属 ID 路径,保留原生查询报文。 */
|
|
61
|
+
export function scopeTodoSubordinate(env, subordinate) {
|
|
62
|
+
const { host } = env;
|
|
63
|
+
const paths = [WORKFLOW_ENDPOINTS.TODO_LIST, WORKFLOW_ENDPOINTS.TODO_TOTAL, WORKFLOW_ENDPOINTS.TODO_TREE];
|
|
64
|
+
return { ...env, host: {
|
|
65
|
+
workflowRequest: request => host.workflowRequest(paths.includes(request.path)
|
|
66
|
+
? { ...request, path: `${request.path}/${subordinate.id}` } : request),
|
|
67
|
+
workflowBinaryRequest: request => host.workflowBinaryRequest(request),
|
|
68
|
+
getSession: () => host.getSession(),
|
|
69
|
+
} };
|
|
70
|
+
}
|
|
@@ -5,6 +5,7 @@ import { responseData } from '../shared.js';
|
|
|
5
5
|
import { DEFAULT_TABID } from './todoSmartConvert.core.js';
|
|
6
6
|
import { generalRules } from './aigroupRules.js';
|
|
7
7
|
const COUNT_CONCURRENCY = 4;
|
|
8
|
+
const DISCONTINUED_WORKFLOW_NAME = /废弃|作废|停用|失效|已下线/u;
|
|
8
9
|
function recordOf(value) {
|
|
9
10
|
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
10
11
|
? value : {};
|
|
@@ -162,6 +163,15 @@ export async function enrichWorkflowClarification(error, args, env) {
|
|
|
162
163
|
}
|
|
163
164
|
if (candidates.length < 2)
|
|
164
165
|
return error;
|
|
166
|
+
const selectable = candidates.filter(candidate => !DISCONTINUED_WORKFLOW_NAME.test(candidate.name));
|
|
167
|
+
if (selectable.length === 0) {
|
|
168
|
+
const question = '匹配到的工作流名称均带废弃或停用标识,请提供当前使用的工作流名称。';
|
|
169
|
+
return new WorkflowCliError(error.type, error.subtype, question, {
|
|
170
|
+
code: error.code, retryable: error.retryable, stage: error.stage, exitCode: error.exitCode,
|
|
171
|
+
partialData: error.partialData,
|
|
172
|
+
details: { ...details, clarificationQuestion: question, clarificationReason: 'workflow_discontinued', candidates: [] },
|
|
173
|
+
});
|
|
174
|
+
}
|
|
165
175
|
const nameRequests = new Map();
|
|
166
176
|
const scopedEnv = {
|
|
167
177
|
...env,
|
|
@@ -181,11 +191,11 @@ export async function enrichWorkflowClarification(error, args, env) {
|
|
|
181
191
|
getSession: () => env.host.getSession(),
|
|
182
192
|
},
|
|
183
193
|
};
|
|
184
|
-
const queries = await mapLimited(
|
|
194
|
+
const queries = await mapLimited(selectable, candidate => buildCandidateQuery(candidate, args, scopedEnv));
|
|
185
195
|
// Only this enrichment shares counts: never reuse results across commands, filters or users.
|
|
186
196
|
const countRequests = new Map();
|
|
187
197
|
const [types, counts] = await Promise.all([
|
|
188
|
-
|
|
198
|
+
selectable.some(candidate => !candidate.workflowTypeName) ? loadWorkflowTypes(queries, env) : Promise.resolve(new Map()),
|
|
189
199
|
mapLimited(queries, query => {
|
|
190
200
|
if (query.body === null)
|
|
191
201
|
return Promise.resolve(null);
|
|
@@ -198,7 +208,7 @@ export async function enrichWorkflowClarification(error, args, env) {
|
|
|
198
208
|
return pending;
|
|
199
209
|
}),
|
|
200
210
|
]);
|
|
201
|
-
const enriched =
|
|
211
|
+
const enriched = selectable.map((candidate, index) => ({
|
|
202
212
|
...candidate, workflowTypeName: candidate.workflowTypeName ?? types.get(candidate.id) ?? null, totalCount: counts[index],
|
|
203
213
|
})).filter(candidate => candidate.totalCount !== 0);
|
|
204
214
|
enriched.sort((left, right) => {
|
|
@@ -214,8 +224,8 @@ export async function enrichWorkflowClarification(error, args, env) {
|
|
|
214
224
|
});
|
|
215
225
|
const excluded = candidates.length - enriched.length;
|
|
216
226
|
const question = excluded === 0 ? error.message : enriched.length === 0
|
|
217
|
-
?
|
|
218
|
-
:
|
|
227
|
+
? `保留的${selectable.length}个工作流在当前筛选条件下均无待办,无需选择。`
|
|
228
|
+
: `已排除无待办或名称带废弃标识的工作流,请确认要查询的工作流(剩余${enriched.length}项)。`;
|
|
219
229
|
return new WorkflowCliError(error.type, error.subtype, question, {
|
|
220
230
|
code: error.code, retryable: error.retryable, stage: error.stage, exitCode: error.exitCode,
|
|
221
231
|
partialData: error.partialData,
|
package/docs/project.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- 查询项目/任务列表和详情,默认第 1 页 10 条;未指定状态时仅返回未开始、进行中。- 查询项目/任务类型、状态、紧急程度字典。
|
|
8
8
|
- 按姓名解析员工、部门、分部 ID;按 Ebuilder 表单字段解析关联对象。
|
|
9
9
|
- 创建、修改、删除项目和任务,全部使用 `prepare -> apply` 确认链。
|
|
10
|
-
- 仅在接口异常或用户主动询问版本时调用 `project.version.check`,最低版本为 `20.6.11
|
|
10
|
+
- 仅在接口异常或用户主动询问版本时调用 `project.version.check`,最低版本为 `20.6.11`;返回 `status`(`OK` / `NOT_INSTALLED` / `VERSION_TOO_LOW`)用于处置,应用缺失时带 `reason=app_not_found`,版本接口失败不抛错。
|
|
11
11
|
|
|
12
12
|
## operation
|
|
13
13
|
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|