weaver-work-cli 0.1.40 → 0.1.42
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-JHTONRST.js → archive-J4I6MCKF.js} +2 -2
- package/dist/chunks/{archive-oa-FCHLCPHC.js → archive-oa-BRZKKTO4.js} +2 -2
- package/dist/chunks/{asset-RLIHC7DB.js → asset-L7D4FAOZ.js} +2 -2
- package/dist/chunks/{asset-idle-KVOFTLCP.js → asset-idle-DADLLV75.js} +2 -2
- package/dist/chunks/{attachment-content-RZYDB3MB.js → attachment-content-K4C7VLWQ.js} +3 -3
- package/dist/chunks/{blog-42OZTJNP.js → blog-BVGQ7NZL.js} +2 -2
- package/dist/chunks/{caizhilian-KRK547K5.js → caizhilian-SAADNFD6.js} +2 -2
- package/dist/chunks/{calendar-RTWAMKHD.js → calendar-Q7NQY5Z2.js} +61 -23
- package/dist/chunks/{chunk-LFMSDBZN.js → chunk-3KTFS4IA.js} +308 -153
- package/dist/chunks/{chunk-G2JSIUWF.js → chunk-4PD5NWAX.js} +89 -0
- package/dist/chunks/{chunk-T6EGVBKU.js → chunk-4RAE6JXP.js} +1 -1
- package/dist/chunks/{chunk-7BRU4EFH.js → chunk-72CKAUAG.js} +29 -2
- package/dist/chunks/{chunk-NETCCARD.js → chunk-APVFJUQH.js} +2 -2
- package/dist/chunks/{chunk-CAQNBBQA.js → chunk-BBKDXQEC.js} +2 -2
- package/dist/chunks/{chunk-57IECMWX.js → chunk-BIPYLLVS.js} +26 -12
- package/dist/chunks/{chunk-LN447PY2.js → chunk-EKWAQSLU.js} +3 -2
- package/dist/chunks/{chunk-4TEDNCON.js → chunk-FOAA27U5.js} +338 -52
- package/dist/chunks/{chunk-7U577Q7U.js → chunk-G4UR6NXN.js} +2 -2
- package/dist/chunks/{chunk-NJKREDA3.js → chunk-GEWYMQME.js} +1 -1
- package/dist/chunks/{chunk-I566ZYNF.js → chunk-GHXCDPTM.js} +1 -1
- package/dist/chunks/{chunk-4CTESSKI.js → chunk-IZ7S7QUS.js} +4 -4
- package/dist/chunks/{chunk-VNBU55SL.js → chunk-JPRO6ER2.js} +57 -2432
- package/dist/chunks/{chunk-IZSSVYAG.js → chunk-LADPYOWC.js} +2 -2
- package/dist/chunks/chunk-LDZQPUIA.js +1238 -0
- package/dist/chunks/chunk-NKZRQXST.js +2546 -0
- package/dist/chunks/{chunk-JWRZM2H2.js → chunk-QKNKR4RH.js} +3 -3
- package/dist/chunks/{chunk-FLS4DPGP.js → chunk-R4CHUSKC.js} +28 -15
- package/dist/chunks/{chunk-WFFNM65B.js → chunk-SA6VBIHY.js} +73 -19
- package/dist/chunks/{chunk-SPRHHSVC.js → chunk-TTPJJJC4.js} +2 -2
- package/dist/chunks/{chunk-7E6MUOEK.js → chunk-W7BEHOSR.js} +2 -2
- package/dist/chunks/{chunk-CXRQWOZ5.js → chunk-YRSZQUD2.js} +2 -2
- package/dist/chunks/{conflict-VR55AOOO.js → conflict-F2OMZRTO.js} +2 -2
- package/dist/chunks/{contract-HI4FNPYE.js → contract-5BETHRSG.js} +2 -2
- package/dist/chunks/{cowork-HJLI353D.js → cowork-3MN6EQQO.js} +22 -12
- package/dist/chunks/create-flow-5FQNNMVO.js +55 -0
- package/dist/chunks/{ebuilder-form-HTGI63UU.js → ebuilder-form-SBHOYBUD.js} +3 -3
- package/dist/chunks/{ehr-GYXIYH3A.js → ehr-KMOJULKG.js} +432 -1234
- package/dist/chunks/{env-DW3G4HUO.js → env-LB7NBL2O.js} +2 -2
- package/dist/chunks/{esb-I5INCEFE.js → esb-W2PJCFCX.js} +4 -4
- package/dist/chunks/{factory-TKXGXS6L.js → factory-6ZFQXQ46.js} +1 -1
- package/dist/chunks/{fna-K2MHTQ24.js → fna-ZQPCUV4R.js} +2 -2
- package/dist/chunks/{group-chat-VYBNMJLG.js → group-chat-2HHAJN46.js} +5 -3
- package/dist/chunks/{host-ZUQTJYYK.js → host-4CBHGOHT.js} +3 -3
- package/dist/chunks/{host-D5SERMAJ.js → host-ATKVNZAT.js} +3 -3
- package/dist/chunks/{host-JM4YVHFM.js → host-BQH22NTQ.js} +3 -3
- package/dist/chunks/{host-L3VLITMT.js → host-X2CSLFM6.js} +3 -3
- package/dist/chunks/{host-256GVCAH.js → host-YTODKMSL.js} +3 -3
- package/dist/chunks/{hrm-VLRBKTZB.js → hrm-FFM4UJFS.js} +4 -4
- package/dist/chunks/{im-QK3VTLXK.js → im-VEHKDQPB.js} +7 -7
- package/dist/chunks/{invoice-T5JTA32H.js → invoice-LVIKSIIF.js} +3 -3
- package/dist/chunks/{jiuchuanhui-P2FNEQVZ.js → jiuchuanhui-X6DINO5P.js} +2 -2
- package/dist/chunks/{lazy-dispatch-XRRI46M6.js → lazy-dispatch-KSWTN5L6.js} +4 -4
- package/dist/chunks/{mail-3Y7MJ6PS.js → mail-VDKRGUD3.js} +2 -2
- package/dist/chunks/{meeting-M7LTXGJE.js → meeting-CLC6HP3Z.js} +12 -11
- package/dist/chunks/{okr-OBC6S67L.js → okr-CHG4OO3U.js} +2 -2
- package/dist/chunks/{plan-5H6I53SK.js → plan-XWR75667.js} +2 -2
- package/dist/chunks/{project-L75QZV4S.js → project-5BXOOKMG.js} +40 -23
- package/dist/chunks/recruit-stage-DGMFNNDE.js +4507 -0
- package/dist/chunks/{registry-RXPN6BBT.js → registry-7FFOXIAW.js} +4 -4
- package/dist/chunks/{registry-KMHCPAAD.js → registry-BKBZPBAJ.js} +10 -9
- package/dist/chunks/{registry-QGHFNUWS.js → registry-OZSMDVPP.js} +2 -2
- package/dist/chunks/{registry-UGRBCBHO.js → registry-RHMW6ANW.js} +2 -2
- package/dist/chunks/{registry-NYPYMZXG.js → registry-Z43434VG.js} +1 -1
- package/dist/chunks/{room-recommend-A3UDC3CA.js → room-recommend-62H7ZQQ6.js} +4 -4
- package/dist/chunks/{schedule-5GCACCK7.js → schedule-FNXKH3DQ.js} +4 -4
- package/dist/chunks/{workflow-M5ZJ7DWF.js → workflow-ADHKCAJK.js} +6 -6
- package/dist/index.js +33 -28
- package/dist/internal/e10/auth/commands.js +1 -0
- package/dist/internal/e10/auth/messages.js +6 -0
- package/dist/internal/e10/auth/session.js +17 -0
- package/dist/internal/e10/auth/xiaoe.js +286 -44
- package/dist/internal/e10/auth-recovery.js +36 -5
- package/dist/internal/e10/context.js +56 -12
- package/dist/internal/e10/index.js +1 -1
- package/dist/internal/e10/network-error.js +93 -0
- package/dist/internal/e10/request-runtime.js +6 -0
- package/dist/shortcuts/calendar/operations/read.js +31 -22
- package/dist/shortcuts/calendar/operations/write.js +45 -1
- package/dist/shortcuts/cowork/operations/discuss-write.js +5 -1
- package/dist/shortcuts/cowork/operations/item-write.js +1 -7
- package/dist/shortcuts/cowork/operations/member-write.js +3 -1
- package/dist/shortcuts/cowork/operations/permission-write.js +5 -1
- package/dist/shortcuts/cowork/operations/shared.js +7 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +43 -1
- package/dist/shortcuts/ehr/operations/hr-contact.js +7 -4
- package/dist/shortcuts/ehr/operations/hr-report.js +13 -7
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +134 -59
- package/dist/shortcuts/ehr/operations/recruit-write.js +262 -17
- package/dist/shortcuts/ehr/operations/recruit.js +10 -4
- package/dist/shortcuts/ehr/operations/shared.js +47 -0
- package/dist/shortcuts/hrm/operations/org.js +118 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +4 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +85 -28
- package/dist/shortcuts/meeting/operations/eb/factory.js +33 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +25 -3
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +96 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +33 -11
- package/dist/shortcuts/project/operations/read.js +6 -25
- package/dist/shortcuts/project/operations/shared.js +22 -0
- package/dist/shortcuts/project/operations/write.js +28 -2
- package/dist/shortcuts/recruit-stage/context.js +119 -0
- package/dist/shortcuts/recruit-stage/continuation.js +73 -0
- package/dist/shortcuts/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/recruit-stage/host.js +109 -0
- package/dist/shortcuts/recruit-stage/index.js +115 -0
- package/dist/shortcuts/recruit-stage/manifest.js +29 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +722 -0
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +269 -0
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +630 -0
- package/dist/shortcuts/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/recruit-stage/operations/registry.js +38 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +1198 -0
- package/dist/shortcuts/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/recruit-stage/operations/types.js +25 -0
- package/dist/shortcuts/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/recruit-stage/shared.js +608 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +13 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +17 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +14 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +50 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +17 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +7 -39
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +51 -15
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.pipeline.js +16 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +151 -63
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subGroup.js +56 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +39 -14
- package/docs/e10-auth.md +7 -1
- package/docs/operation-manual.md +8 -0
- package/package.json +1 -1
- package/scripts/install-skill-to-xiaoe.mjs +105 -0
- package/scripts/package-skill.mjs +4 -2
- package/skill-template/business-info.json +24 -0
- package/skill-template/domains/recruit-stage.md +29 -0
- package/skills/weaver-e10-calendar/SKILL.md +2 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +54 -0
- package/skills/weaver-e10-cowork/SKILL.md +1 -1
- package/skills/weaver-e10-cowork/references/cowork-write.md +3 -1
- package/skills/weaver-e10-jucailin/SKILL.md +1 -1
- package/skills/weaver-e10-jucailin/references/attend-write.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-contact.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-report.md +8 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -3
- package/skills/weaver-e10-mail/SKILL.md +1 -1
- package/skills/weaver-e10-meeting/SKILL.md +32 -2
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +226 -0
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +119 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +188 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +322 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +127 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +65 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +63 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +73 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +56 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +148 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +59 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +438 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-shared/SKILL.md +1 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-shijingran/SKILL.md +3 -2
- package/skills/weaver-e10-shijingran/references/operations.md +3 -1
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-shijingran/references/write-operations.md +2 -0
- package/skills/weaver-e10-workflow/SKILL.md +4 -2
- package/skills/weaver-e10-workflow/aigroup/default.json +11 -9
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +23 -13
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +62 -20
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -10
- package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +6 -3
- package/dist/chunks/{chunk-E7OK5WD5.js → chunk-2LV74IWP.js} +5 -5
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
createFetchTimingSink,
|
|
25
25
|
hasXiaoEEnv,
|
|
26
26
|
runWithFetchTiming
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FOAA27U5.js";
|
|
28
28
|
|
|
29
29
|
// src/shortcuts/workflow/operations/form.ts
|
|
30
30
|
import { randomUUID } from "node:crypto";
|
|
@@ -9968,6 +9968,7 @@ var STAGE_VALUES = [
|
|
|
9968
9968
|
"smartGroup",
|
|
9969
9969
|
"summaryContext",
|
|
9970
9970
|
"summary",
|
|
9971
|
+
"subGroup",
|
|
9971
9972
|
"groupSummaryContext",
|
|
9972
9973
|
"groupSummary",
|
|
9973
9974
|
"aggregate"
|
|
@@ -10082,6 +10083,7 @@ var ALLOWED_INPUT_KEYS = [
|
|
|
10082
10083
|
"aiGroupSummaries",
|
|
10083
10084
|
"withDetailContext",
|
|
10084
10085
|
"withGroupSummaryContext",
|
|
10086
|
+
"withSubGroup",
|
|
10085
10087
|
"detailPrefetch",
|
|
10086
10088
|
"maxCharsPerBatch",
|
|
10087
10089
|
"maxItemsPerBatch",
|
|
@@ -10400,7 +10402,7 @@ function promptTagOf(prompt) {
|
|
|
10400
10402
|
return String(prompt ?? "").trim();
|
|
10401
10403
|
}
|
|
10402
10404
|
function entryMatches(entry, maxChars, pk, dv) {
|
|
10403
|
-
if (pk !== void 0 && entry.pk !==
|
|
10405
|
+
if (pk !== void 0 && entry.pk !== pk) return false;
|
|
10404
10406
|
if (maxChars !== void 0 && entry.maxChars !== void 0 && entry.maxChars !== maxChars) return false;
|
|
10405
10407
|
if (entry.dv !== void 0 && entry.dv !== dv) return false;
|
|
10406
10408
|
return true;
|
|
@@ -10411,7 +10413,7 @@ function normalizeSummaryEntry(raw) {
|
|
|
10411
10413
|
if (typeof entry.summary !== "string" || !entry.summary.trim()) return null;
|
|
10412
10414
|
if (typeof entry.cachedAt !== "number" || !Number.isFinite(entry.cachedAt)) return null;
|
|
10413
10415
|
const maxChars = typeof entry.maxChars === "number" && Number.isFinite(entry.maxChars) ? entry.maxChars : void 0;
|
|
10414
|
-
const pk = typeof entry.pk === "string"
|
|
10416
|
+
const pk = typeof entry.pk === "string" ? entry.pk : void 0;
|
|
10415
10417
|
const dv = typeof entry.dv === "string" && entry.dv !== "" ? entry.dv : void 0;
|
|
10416
10418
|
return {
|
|
10417
10419
|
summary: entry.summary,
|
|
@@ -10477,7 +10479,8 @@ async function openSummaryCache(ctx) {
|
|
|
10477
10479
|
summary: text,
|
|
10478
10480
|
cachedAt: Date.now(),
|
|
10479
10481
|
...maxChars === void 0 ? {} : { maxChars },
|
|
10480
|
-
|
|
10482
|
+
// 空串同样落库(见 entryMatches 注释):空口径与「缺 pk」必须能区分开。
|
|
10483
|
+
...pk === void 0 ? {} : { pk },
|
|
10481
10484
|
...dv === void 0 || dv === "" ? {} : { dv }
|
|
10482
10485
|
});
|
|
10483
10486
|
dirty = true;
|
|
@@ -11004,18 +11007,15 @@ function projectDisplayRows(response) {
|
|
|
11004
11007
|
var DETAIL_CACHE_FILE_NAME = "todo-detail-cache.json";
|
|
11005
11008
|
var DETAIL_CACHE_TTL_MS = SUMMARY_CACHE_TTL_MS;
|
|
11006
11009
|
var DETAIL_CACHE_PRUNE_INTERVAL_MS = SUMMARY_CACHE_PRUNE_INTERVAL_MS;
|
|
11007
|
-
var DETAIL_CACHE_ENTRY_VERSION =
|
|
11010
|
+
var DETAIL_CACHE_ENTRY_VERSION = 4;
|
|
11008
11011
|
function detailCacheKey(requestId, lastFeedBackDateTime) {
|
|
11009
11012
|
const stamp = String(lastFeedBackDateTime ?? "").trim();
|
|
11010
11013
|
return `${requestId}__${stamp}`;
|
|
11011
11014
|
}
|
|
11012
11015
|
function detailMaterialTagOf(entry) {
|
|
11013
|
-
const
|
|
11014
|
-
const basicKeys = Object.keys(basic).sort();
|
|
11015
|
-
const material = JSON.stringify([
|
|
11016
|
-
basicKeys.map((key) => [key, basic[key]]),
|
|
11016
|
+
const material = JSON.stringify(
|
|
11017
11017
|
(entry.fields ?? []).map((field) => [field.fieldName, field.value])
|
|
11018
|
-
|
|
11018
|
+
);
|
|
11019
11019
|
let hash = 5381;
|
|
11020
11020
|
for (let i = 0; i < material.length; i += 1) hash = (hash << 5) + hash + material.charCodeAt(i) >>> 0;
|
|
11021
11021
|
return hash.toString(16);
|
|
@@ -11026,17 +11026,12 @@ function normalizeEntry(raw) {
|
|
|
11026
11026
|
if (value.v !== DETAIL_CACHE_ENTRY_VERSION) return null;
|
|
11027
11027
|
if (typeof value.cachedAt !== "number" || !Number.isFinite(value.cachedAt)) return null;
|
|
11028
11028
|
if (typeof value.excludeTag !== "string") return null;
|
|
11029
|
-
const
|
|
11030
|
-
if (value.basicInfo && typeof value.basicInfo === "object") {
|
|
11031
|
-
for (const [key, item] of Object.entries(value.basicInfo)) {
|
|
11032
|
-
if (typeof item === "string") basicInfo[key] = item;
|
|
11033
|
-
}
|
|
11034
|
-
}
|
|
11029
|
+
const workflowName = typeof value.workflowName === "string" ? value.workflowName : "";
|
|
11035
11030
|
const fields = Array.isArray(value.fields) ? value.fields.filter((item) => Boolean(item) && typeof item.fieldName === "string" && typeof item.value === "string").map((item) => ({ fieldName: item.fieldName, value: item.value })) : [];
|
|
11036
11031
|
const metrics = value.metrics && typeof value.metrics === "object" ? value.metrics : {};
|
|
11037
11032
|
return {
|
|
11038
11033
|
v: DETAIL_CACHE_ENTRY_VERSION,
|
|
11039
|
-
|
|
11034
|
+
workflowName,
|
|
11040
11035
|
fields,
|
|
11041
11036
|
metrics,
|
|
11042
11037
|
excludeTag: value.excludeTag,
|
|
@@ -11129,13 +11124,13 @@ function pickInternalMessageContentField(fields) {
|
|
|
11129
11124
|
const content = named.find((item) => item.name === "\u5185\u5BB9" || item.name.endsWith("\u5185\u5BB9"));
|
|
11130
11125
|
return content?.field;
|
|
11131
11126
|
}
|
|
11132
|
-
function pickInternalMessageFieldPairs(fields, basicInfo = {}) {
|
|
11127
|
+
function pickInternalMessageFieldPairs(fields, basicInfo = {}, fallbackCreatorName) {
|
|
11133
11128
|
const content = pickInternalMessageContentField(fields);
|
|
11134
11129
|
const contentValue = String(content?.value ?? "").trim();
|
|
11135
11130
|
if (!contentValue) return [];
|
|
11136
11131
|
const name = normalizeDetailFieldName(content?.fieldName) || INTERNAL_MESSAGE_CONTENT_LABEL;
|
|
11137
11132
|
const pairs = [{ fieldName: name, value: contentValue }];
|
|
11138
|
-
const creatorName = String(basicInfo.creatorName ?? "").trim();
|
|
11133
|
+
const creatorName = String(basicInfo.creatorName ?? fallbackCreatorName ?? "").trim();
|
|
11139
11134
|
if (creatorName) pairs.push({ fieldName: INTERNAL_MESSAGE_INITIATOR_LABEL, value: creatorName });
|
|
11140
11135
|
const createdAt = String(basicInfo.createdAt ?? "").trim();
|
|
11141
11136
|
if (createdAt) pairs.push({ fieldName: INTERNAL_MESSAGE_TIME_LABEL, value: createdAt });
|
|
@@ -11388,6 +11383,11 @@ function isRetryable(error) {
|
|
|
11388
11383
|
if (structured?.type === "network") return true;
|
|
11389
11384
|
return structured?.retryable === true && structured?.type !== "authentication";
|
|
11390
11385
|
}
|
|
11386
|
+
function userIdToCreatorName(options, requestId) {
|
|
11387
|
+
const name = options.rowMeta?.get(requestId)?.createrName;
|
|
11388
|
+
const text = String(name ?? "").trim();
|
|
11389
|
+
return text === "" ? void 0 : text;
|
|
11390
|
+
}
|
|
11391
11391
|
async function fetchOneDetail(env, requestId, userId, options) {
|
|
11392
11392
|
const body = {
|
|
11393
11393
|
requestId,
|
|
@@ -11408,28 +11408,26 @@ async function fetchOneDetail(env, requestId, userId, options) {
|
|
|
11408
11408
|
const normalized = normalizeDetailResponse(response);
|
|
11409
11409
|
const base = normalized?.basicInfo ?? {};
|
|
11410
11410
|
const rawFields = Array.isArray(normalized?.formData?.fields) ? normalized.formData.fields : [];
|
|
11411
|
-
const
|
|
11412
|
-
Object.entries(base).filter(([key]) => key !== "requestTitle" && key !== "flowName")
|
|
11413
|
-
);
|
|
11411
|
+
const workflowName = String(base.workflowName ?? "").trim();
|
|
11414
11412
|
const usableFields = dropDistributionDetailFields(rawFields);
|
|
11415
11413
|
const internalMessage = isInternalMessageDetail(
|
|
11416
|
-
|
|
11414
|
+
workflowName,
|
|
11417
11415
|
usableFields.map((field) => field?.fieldName)
|
|
11418
11416
|
);
|
|
11419
11417
|
const cleanedFields = usableFields.map((field) => ({
|
|
11420
11418
|
...field,
|
|
11421
11419
|
value: cleanFieldText(String(field?.value ?? ""))
|
|
11422
11420
|
}));
|
|
11423
|
-
const excludeFields = excludeFieldsFor(
|
|
11421
|
+
const excludeFields = excludeFieldsFor(workflowName);
|
|
11424
11422
|
const excludeSet = new Set(excludeFields.map((name) => normalizeDetailFieldName(name)));
|
|
11425
|
-
const picked = (internalMessage ? pickInternalMessageFieldPairs(cleanedFields,
|
|
11423
|
+
const picked = (internalMessage ? pickInternalMessageFieldPairs(cleanedFields, {}, userIdToCreatorName(options, requestId)) : cleanedFields.filter((field) => !excludeSet.has(normalizeDetailFieldName(field?.fieldName)))).slice(0, DETAIL_MATERIAL_FIELD_LIMIT).map((field) => ({
|
|
11426
11424
|
fieldName: String(field?.fieldName ?? "").trim(),
|
|
11427
11425
|
value: String(field?.value ?? "").slice(0, DETAIL_MATERIAL_VALUE_LIMIT)
|
|
11428
11426
|
})).filter((field) => field.fieldName && field.value);
|
|
11429
11427
|
const metrics = extractRowMetrics(usableFields);
|
|
11430
11428
|
return {
|
|
11431
11429
|
requestId,
|
|
11432
|
-
|
|
11430
|
+
workflowName,
|
|
11433
11431
|
formFields: picked,
|
|
11434
11432
|
contextAvailable: picked.length > 0,
|
|
11435
11433
|
excludeTag: excludeTagOf(excludeFields),
|
|
@@ -11484,7 +11482,7 @@ async function fetchRequestDetailsBatch(env, requestIds, options = {}) {
|
|
|
11484
11482
|
failures.push({ requestId, error: reason });
|
|
11485
11483
|
details.set(requestId, {
|
|
11486
11484
|
requestId,
|
|
11487
|
-
|
|
11485
|
+
workflowName: "",
|
|
11488
11486
|
formFields: [],
|
|
11489
11487
|
contextAvailable: false,
|
|
11490
11488
|
excludeTag: "",
|
|
@@ -11512,9 +11510,7 @@ async function fetchRequestDetailsBatch(env, requestIds, options = {}) {
|
|
|
11512
11510
|
|
|
11513
11511
|
// src/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.ts
|
|
11514
11512
|
function contextOfDetail(detail) {
|
|
11515
|
-
|
|
11516
|
-
const fieldLines = (detail.formFields ?? []).map((field) => `${field.fieldName}:${field.value}`);
|
|
11517
|
-
return [...basicLines, ...fieldLines].join("\n");
|
|
11513
|
+
return (detail.formFields ?? []).map((field) => `${field.fieldName}:${field.value}`).join("\n");
|
|
11518
11514
|
}
|
|
11519
11515
|
var EMPTY_DETAIL_STATS = {
|
|
11520
11516
|
requested: 0,
|
|
@@ -11540,7 +11536,7 @@ function stampsOfRows(rows) {
|
|
|
11540
11536
|
function materialFieldsOf(detail) {
|
|
11541
11537
|
return detail.formFields.map((field) => ({ fieldName: field.fieldName, value: field.value }));
|
|
11542
11538
|
}
|
|
11543
|
-
async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
11539
|
+
async function fetchDetailFacts(env, requestIds, args, stamps, names, createrNames) {
|
|
11544
11540
|
const unique = [...new Set(requestIds.filter(Boolean))];
|
|
11545
11541
|
const facts = /* @__PURE__ */ new Map();
|
|
11546
11542
|
const warnings = [];
|
|
@@ -11552,15 +11548,16 @@ async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
11552
11548
|
const missing = [];
|
|
11553
11549
|
for (const requestId of unique) {
|
|
11554
11550
|
const hit = cache.get(requestId, stamps?.get(requestId));
|
|
11555
|
-
if (!hit || hit.excludeTag !== excludeTagFor(hit.
|
|
11551
|
+
if (!hit || hit.excludeTag !== excludeTagFor(hit.workflowName ?? names?.get(requestId) ?? "")) {
|
|
11556
11552
|
missing.push(requestId);
|
|
11557
11553
|
continue;
|
|
11558
11554
|
}
|
|
11559
11555
|
facts.set(requestId, {
|
|
11560
|
-
context: contextOfDetail({
|
|
11556
|
+
context: contextOfDetail({ formFields: hit.fields }),
|
|
11561
11557
|
contextAvailable: hit.fields.length > 0,
|
|
11562
11558
|
metrics: hit.metrics,
|
|
11563
|
-
fields: hit.fields
|
|
11559
|
+
fields: hit.fields,
|
|
11560
|
+
workflowName: hit.workflowName || (names?.get(requestId) ?? "")
|
|
11564
11561
|
});
|
|
11565
11562
|
stats.cacheHit += 1;
|
|
11566
11563
|
}
|
|
@@ -11569,7 +11566,8 @@ async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
11569
11566
|
try {
|
|
11570
11567
|
const { details, stats: fetchStats } = await fetchRequestDetailsBatch(env, missing, {
|
|
11571
11568
|
concurrency: readBoundedInt(args.detailConcurrency, "detailConcurrency", 10, 1, 32),
|
|
11572
|
-
timeoutMs: readBoundedInt(args.detailTimeoutMs, "detailTimeoutMs", 1e4, 1e3, 6e4)
|
|
11569
|
+
timeoutMs: readBoundedInt(args.detailTimeoutMs, "detailTimeoutMs", 1e4, 1e3, 6e4),
|
|
11570
|
+
...createrNames ? { rowMeta: createrNames } : {}
|
|
11573
11571
|
});
|
|
11574
11572
|
stats.failed = fetchStats.failed;
|
|
11575
11573
|
stats.concurrency = fetchStats.concurrency;
|
|
@@ -11578,7 +11576,8 @@ async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
11578
11576
|
context: contextOfDetail(detail),
|
|
11579
11577
|
contextAvailable: detail.formFields.length > 0,
|
|
11580
11578
|
metrics: detail.metrics ?? {},
|
|
11581
|
-
fields: materialFieldsOf(detail)
|
|
11579
|
+
fields: materialFieldsOf(detail),
|
|
11580
|
+
workflowName: detail.workflowName || (names?.get(requestId) ?? "")
|
|
11582
11581
|
};
|
|
11583
11582
|
facts.set(requestId, fact);
|
|
11584
11583
|
stats.fetched += 1;
|
|
@@ -11586,7 +11585,7 @@ async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
11586
11585
|
else stats.contextEmpty += 1;
|
|
11587
11586
|
if (cache.set(requestId, stamps?.get(requestId), {
|
|
11588
11587
|
v: DETAIL_CACHE_ENTRY_VERSION,
|
|
11589
|
-
|
|
11588
|
+
workflowName: fact.workflowName,
|
|
11590
11589
|
metrics: fact.metrics,
|
|
11591
11590
|
fields: fact.fields,
|
|
11592
11591
|
excludeTag: detail.excludeTag
|
|
@@ -11833,14 +11832,8 @@ function runGroup(args) {
|
|
|
11833
11832
|
const { rawCount, rows, duplicateCount, unreadableCount } = readItems(args.items);
|
|
11834
11833
|
const groupBy = readGroupBy(args.groupBy);
|
|
11835
11834
|
const topN = readTopN(args.topN);
|
|
11836
|
-
const pgConfig = generalRules()?.priorityGroup ?? null;
|
|
11837
|
-
const pgTitle = pgConfig?.title?.trim() || PRIORITY_GROUP_TITLE;
|
|
11838
|
-
const pgRules = new Set(pgConfig?.rules ?? ["overdue", "levelFallback"]);
|
|
11839
|
-
const priority = selectPriorityRows(rows, pgRules);
|
|
11840
|
-
const priorityRows = sortPriorityRows(priority.rows);
|
|
11841
|
-
const restRows = rows;
|
|
11842
11835
|
const buckets = /* @__PURE__ */ new Map();
|
|
11843
|
-
for (const row of
|
|
11836
|
+
for (const row of rows) {
|
|
11844
11837
|
const key = groupKeyOf(row, groupBy);
|
|
11845
11838
|
let bucket = buckets.get(key);
|
|
11846
11839
|
if (!bucket) {
|
|
@@ -11863,16 +11856,8 @@ function runGroup(args) {
|
|
|
11863
11856
|
stats: statsOf(bucket.rows),
|
|
11864
11857
|
...bucket.ids.length > 1 ? { workflowIds: bucket.ids } : {}
|
|
11865
11858
|
}));
|
|
11866
|
-
const groups =
|
|
11867
|
-
|
|
11868
|
-
topPriority: true,
|
|
11869
|
-
title: pgTitle,
|
|
11870
|
-
count: priorityRows.length,
|
|
11871
|
-
requestDatas: priorityRows.map((row) => toRequestData(row)),
|
|
11872
|
-
stats: statsOf(priorityRows)
|
|
11873
|
-
}, ...workflowGroups] : workflowGroups;
|
|
11874
|
-
const displayedWorkflow = workflowGroups.slice(0, topN);
|
|
11875
|
-
const displayed = priorityRows.length > 0 && groupBy === "workflow" ? [groups[0], ...displayedWorkflow] : displayedWorkflow;
|
|
11859
|
+
const groups = workflowGroups;
|
|
11860
|
+
const displayed = workflowGroups.slice(0, topN);
|
|
11876
11861
|
const rest = workflowGroups.slice(topN);
|
|
11877
11862
|
const restCount = rest.reduce((sum, group) => sum + group.count, 0);
|
|
11878
11863
|
const overall = statsOf(rows);
|
|
@@ -11889,16 +11874,6 @@ function runGroup(args) {
|
|
|
11889
11874
|
groupBy === "workflow" ? `\u6709 ${unknownGroupCount} \u6761\u7F3A\u5C11\u5DE5\u4F5C\u6D41\u540D\u79F0\uFF0C\u5DF2\u5F52\u5165\u300C${UNKNOWN_GROUP}\u300D` : `\u6709 ${unknownGroupCount} \u6761\u7F3A\u5C11\u5206\u7EC4\u5B57\u6BB5\uFF0C\u5DF2\u5F52\u5165\u300C${UNKNOWN_GROUP}\u300D`
|
|
11890
11875
|
);
|
|
11891
11876
|
}
|
|
11892
|
-
if (priorityRows.length > 0 && groupBy === "workflow") {
|
|
11893
|
-
const levelText = priority.targetLevel === 2 ? "\u7D27\u6025\uFF08requestLevel=2\uFF09" : priority.targetLevel === 1 ? "\u91CD\u8981\uFF08requestLevel=1\uFF1B\u672C\u6B21\u65E0 2 \u7EA7\u6570\u636E\uFF0C\u5DF2\u6309\u89C4\u5219\u964D\u7EA7\u53D6 1\uFF0C0 \u7EA7\u4E0D\u53D6\uFF09" : "\u65E0\u7B49\u7EA7\uFF08\u672C\u6B21\u6574\u6279\u6CA1\u6709 \u22651 \u7EA7\u7684\u6761\u76EE\uFF0C\u53EA\u6309\u8D85\u65F6\u7B5B\uFF09";
|
|
11894
|
-
warnings.push(
|
|
11895
|
-
`\u300C${pgTitle}\u300D\u7B5B\u51FA ${priorityRows.length} \u6761\uFF1A\u8D85\u65F6 ${priority.overdueCount} \u6761 / \u7B49\u7EA7\u547D\u4E2D ${priority.levelCount} \u6761\uFF08\u4E24\u8005\u90FD\u6EE1\u8DB3 ${priority.bothCount} \u6761\uFF09\uFF0C\u7B49\u7EA7\u53E3\u5F84=${levelText}\uFF1B\u8FD9 ${priorityRows.length} \u6761\u540C\u65F6\u4FDD\u7559\u5728\u5404\u81EA\u5DE5\u4F5C\u6D41\u5206\u7EC4\u4E2D\uFF08\u53E0\u52A0\u89C6\u56FE\uFF1A\u03A3count \u4F1A\u5927\u4E8E totalCount\uFF0CtotalCount \u6309\u53BB\u91CD\u6761\u6570\u8BA1 = ${rows.length}\uFF09`
|
|
11896
|
-
);
|
|
11897
|
-
} else if (priorityRows.length === 0 && groupBy === "workflow") {
|
|
11898
|
-
warnings.push(
|
|
11899
|
-
`\u672C\u6B21\u6CA1\u6709\u8D85\u65F6\u6761\u76EE\uFF0C\u4E5F\u6CA1\u6709 requestLevel\u22651 \u7684\u6761\u76EE\uFF0C\u6545\u4E0D\u8F93\u51FA\u300C${PRIORITY_GROUP_TITLE}\u300D\u5206\u7EC4`
|
|
11900
|
-
);
|
|
11901
|
-
}
|
|
11902
11877
|
if (rest.length > 0) {
|
|
11903
11878
|
warnings.push(`markdown \u53EA\u5C55\u793A\u524D ${topN} \u4E2A\u5DE5\u4F5C\u6D41\u5206\u7EC4\uFF0C\u5176\u4F59 ${rest.length} \u7EC4\u5171 ${restCount} \u6761\u4ECD\u5728 wfIdGroup \u4E2D\uFF08\u672A\u622A\u65AD\uFF09`);
|
|
11904
11879
|
}
|
|
@@ -11934,7 +11909,7 @@ function runGroup(args) {
|
|
|
11934
11909
|
},
|
|
11935
11910
|
wfIdGroup: groups,
|
|
11936
11911
|
/** 第二部分(非优先组)的总条数与组数,前端折叠/分页直接用它,不用自己减 */
|
|
11937
|
-
restTotal:
|
|
11912
|
+
restTotal: rows.length,
|
|
11938
11913
|
restGroupCount: workflowGroups.length,
|
|
11939
11914
|
restGroups: rest.length > 0 ? { groupCount: rest.length, count: restCount } : null,
|
|
11940
11915
|
warnings,
|
|
@@ -12049,6 +12024,46 @@ async function collectRawTodos(args, env) {
|
|
|
12049
12024
|
if (items.length >= limit) break;
|
|
12050
12025
|
if (pageRows.length < pageSize) break;
|
|
12051
12026
|
}
|
|
12027
|
+
const workflowNames = /* @__PURE__ */ new Map();
|
|
12028
|
+
const createrNames = /* @__PURE__ */ new Map();
|
|
12029
|
+
for (const row of items) {
|
|
12030
|
+
if (!row.requestId) continue;
|
|
12031
|
+
const name = String(row.workflowName ?? "").trim();
|
|
12032
|
+
if (name) workflowNames.set(row.requestId, name);
|
|
12033
|
+
if (row.createrName) createrNames.set(row.requestId, { createrName: row.createrName });
|
|
12034
|
+
}
|
|
12035
|
+
const detailBackfill = { requested: 0, cacheHit: 0, fetched: 0, failed: 0, nameFilled: 0 };
|
|
12036
|
+
let allFacts = /* @__PURE__ */ new Map();
|
|
12037
|
+
if (items.length > 0) {
|
|
12038
|
+
const detailIds = [...new Set(items.map((row) => row.requestId).filter(Boolean))];
|
|
12039
|
+
const { facts, stats } = await fetchDetailFacts(
|
|
12040
|
+
env,
|
|
12041
|
+
detailIds,
|
|
12042
|
+
args,
|
|
12043
|
+
stampsOfRows(items),
|
|
12044
|
+
workflowNames,
|
|
12045
|
+
createrNames
|
|
12046
|
+
);
|
|
12047
|
+
allFacts = facts;
|
|
12048
|
+
detailBackfill.requested = stats.requested;
|
|
12049
|
+
detailBackfill.cacheHit = stats.cacheHit;
|
|
12050
|
+
detailBackfill.fetched = stats.fetched;
|
|
12051
|
+
detailBackfill.failed = stats.failed;
|
|
12052
|
+
for (const row of items) {
|
|
12053
|
+
const fact = facts.get(row.requestId);
|
|
12054
|
+
if (!fact) continue;
|
|
12055
|
+
if (!String(row.workflowName ?? "").trim() && fact.workflowName) {
|
|
12056
|
+
row.workflowName = fact.workflowName;
|
|
12057
|
+
workflowNames.set(row.requestId, fact.workflowName);
|
|
12058
|
+
detailBackfill.nameFilled += 1;
|
|
12059
|
+
}
|
|
12060
|
+
}
|
|
12061
|
+
if (detailBackfill.nameFilled > 0) {
|
|
12062
|
+
warnings.push(
|
|
12063
|
+
`\u6709 ${detailBackfill.nameFilled} \u6761\u5217\u8868\u6570\u636E\u7F3A\u5C11\u5DE5\u4F5C\u6D41\u540D\u79F0\uFF0C\u5DF2\u7528\u6D41\u7A0B\u8BE6\u60C5\u6570\u636E\uFF08basic.workflowName\uFF09\u56DE\u586B`
|
|
12064
|
+
);
|
|
12065
|
+
}
|
|
12066
|
+
}
|
|
12052
12067
|
await saveSearchIndex(
|
|
12053
12068
|
{
|
|
12054
12069
|
items: items.map((row, index) => ({
|
|
@@ -12125,8 +12140,9 @@ async function collectRawTodos(args, env) {
|
|
|
12125
12140
|
cachedSummaryIds.add(row.requestId);
|
|
12126
12141
|
}
|
|
12127
12142
|
detailStats = {
|
|
12128
|
-
deferred:
|
|
12129
|
-
note: "\u8BE6\u60C5\
|
|
12143
|
+
deferred: false,
|
|
12144
|
+
note: "\u8BE6\u60C5\u5DF2\u5728 collect \u9636\u6BB5\u5168\u91CF\u56DE\u586B\uFF08\u7F13\u5B58\u4F18\u5148\uFF09\uFF1A\u4EC5 basic.workflowName \u4FDD\u7559\uFF0C\u5176\u4F59 basic \u5B57\u6BB5\u4E0E\u7D20\u6750\u65E0\u5173",
|
|
12145
|
+
detailBackfill,
|
|
12130
12146
|
summaryCached: cachedSummaryIds.size,
|
|
12131
12147
|
summaryCacheFile: summaryCache.file,
|
|
12132
12148
|
summaryCachePruned: summaryCache.pruned
|
|
@@ -12137,15 +12153,15 @@ async function collectRawTodos(args, env) {
|
|
|
12137
12153
|
const targetRows = wfIdGroup.filter((group) => !group.topPriority && activeRuleFor(group.title)?.aiGroup?.groupRule.aiContext === "\u6D41\u7A0B\u8BE6\u60C5").flatMap((group) => group.requestDatas ?? []);
|
|
12138
12154
|
const targetIds = [...new Set(targetRows.map((row) => row.requestId).filter(Boolean))];
|
|
12139
12155
|
if (targetIds.length > 0) {
|
|
12140
|
-
const
|
|
12141
|
-
|
|
12142
|
-
if (fact.fields.length > 0) fieldsById.set(requestId, fact.fields);
|
|
12156
|
+
for (const requestId of targetIds) {
|
|
12157
|
+
const fact = allFacts.get(requestId);
|
|
12158
|
+
if (fact && fact.fields.length > 0) fieldsById.set(requestId, fact.fields);
|
|
12143
12159
|
}
|
|
12144
12160
|
detailStats.groupingMaterial = {
|
|
12145
12161
|
requested: targetIds.length,
|
|
12146
|
-
cacheHit:
|
|
12147
|
-
fetched:
|
|
12148
|
-
failed:
|
|
12162
|
+
cacheHit: detailBackfill.cacheHit,
|
|
12163
|
+
fetched: detailBackfill.fetched,
|
|
12164
|
+
failed: detailBackfill.failed,
|
|
12149
12165
|
withFields: fieldsById.size
|
|
12150
12166
|
};
|
|
12151
12167
|
}
|
|
@@ -12317,7 +12333,17 @@ function inferStage(args) {
|
|
|
12317
12333
|
if (!Array.isArray(args.wfIdGroup)) return "auto";
|
|
12318
12334
|
if (Array.isArray(args.aiGroupSummaries)) return "groupSummary";
|
|
12319
12335
|
if (Array.isArray(args.aiSummaries)) return "summary";
|
|
12320
|
-
|
|
12336
|
+
if (hasAnyRequestSummary(args.wfIdGroup)) {
|
|
12337
|
+
return hasAnySubGroup(args.wfIdGroup) ? "groupSummaryContext" : "subGroup";
|
|
12338
|
+
}
|
|
12339
|
+
return "summaryContext";
|
|
12340
|
+
}
|
|
12341
|
+
function hasAnySubGroup(groups) {
|
|
12342
|
+
for (const raw of groups) {
|
|
12343
|
+
const items = raw?.displayItems;
|
|
12344
|
+
if (Array.isArray(items) && items.some((item) => item?.type === "group")) return true;
|
|
12345
|
+
}
|
|
12346
|
+
return false;
|
|
12321
12347
|
}
|
|
12322
12348
|
function rowsOfRawGroup(group) {
|
|
12323
12349
|
if (!group) return [];
|
|
@@ -12352,6 +12378,34 @@ function rowsOfGroup(group) {
|
|
|
12352
12378
|
function groupItemsOf(group) {
|
|
12353
12379
|
return group.displayItems.filter((item) => item.type === "group");
|
|
12354
12380
|
}
|
|
12381
|
+
function assemblePriorityGroup(groups) {
|
|
12382
|
+
const base = (groups ?? []).filter((group) => group.id !== PRIORITY_GROUP_ID && group.topPriority !== true);
|
|
12383
|
+
const pgConfig = generalRules()?.priorityGroup ?? null;
|
|
12384
|
+
const title = pgConfig?.title?.trim() || PRIORITY_GROUP_TITLE;
|
|
12385
|
+
const rules = new Set(pgConfig?.rules ?? ["overdue", "levelFallback"]);
|
|
12386
|
+
const rows = base.flatMap((group) => rowsOfGroup(group));
|
|
12387
|
+
if (rows.length === 0) return { groups: base };
|
|
12388
|
+
const selection = selectPriorityRows(rows, rules);
|
|
12389
|
+
const selected = sortPriorityRows(selection.rows);
|
|
12390
|
+
if (selected.length === 0) {
|
|
12391
|
+
return { groups: base, warning: `\u672C\u6B21\u6CA1\u6709\u8D85\u65F6\u6761\u76EE\uFF0C\u4E5F\u6CA1\u6709 requestLevel\u22651 \u7684\u6761\u76EE\uFF0C\u6545\u4E0D\u8F93\u51FA\u300C${title}\u300D\u5206\u7EC4` };
|
|
12392
|
+
}
|
|
12393
|
+
const levelText = selection.targetLevel === 2 ? "\u7D27\u6025\uFF08requestLevel=2\uFF09" : selection.targetLevel === 1 ? "\u91CD\u8981\uFF08requestLevel=1\uFF1B\u672C\u6B21\u65E0 2 \u7EA7\u6570\u636E\uFF0C\u5DF2\u6309\u89C4\u5219\u964D\u7EA7\u53D6 1\uFF0C0 \u7EA7\u4E0D\u53D6\uFF09" : "\u65E0\u7B49\u7EA7\uFF08\u672C\u6B21\u6574\u6279\u6CA1\u6709 \u22651 \u7EA7\u7684\u6761\u76EE\uFF0C\u53EA\u6309\u8D85\u65F6\u7B5B\uFF09";
|
|
12394
|
+
const priorityGroup = {
|
|
12395
|
+
id: PRIORITY_GROUP_ID,
|
|
12396
|
+
topPriority: true,
|
|
12397
|
+
title,
|
|
12398
|
+
count: selected.length,
|
|
12399
|
+
// 大分组(含优先组)默认展开;只有汇总项收缩
|
|
12400
|
+
defaultExpanded: true,
|
|
12401
|
+
// 复制一份:优先组是独立视图,确保两边互不影响
|
|
12402
|
+
displayItems: requestItemsOf(selected.map((row) => ({ ...row })))
|
|
12403
|
+
};
|
|
12404
|
+
return {
|
|
12405
|
+
groups: [priorityGroup, ...base],
|
|
12406
|
+
warning: `\u300C${title}\u300D\u7B5B\u51FA ${selected.length} \u6761\uFF1A\u8D85\u65F6 ${selection.overdueCount} \u6761 / \u7B49\u7EA7\u547D\u4E2D ${selection.levelCount} \u6761\uFF08\u4E24\u8005\u90FD\u6EE1\u8DB3 ${selection.bothCount} \u6761\uFF09\uFF0C\u7B49\u7EA7\u53E3\u5F84=${levelText}\uFF1B\u8FD9 ${selected.length} \u6761\u540C\u65F6\u4FDD\u7559\u5728\u5404\u81EA\u5DE5\u4F5C\u6D41\u5206\u7EC4\u4E2D\uFF08\u53E0\u52A0\u89C6\u56FE\uFF1A\u03A3count \u4F1A\u5927\u4E8E totalCount\uFF0CtotalCount \u6309\u53BB\u91CD\u6761\u6570\u8BA1\uFF09`
|
|
12407
|
+
};
|
|
12408
|
+
}
|
|
12355
12409
|
function readAiGroups(value) {
|
|
12356
12410
|
if (!Array.isArray(value)) {
|
|
12357
12411
|
throw workflowValidationError(
|
|
@@ -12367,14 +12421,15 @@ function readAiGroups(value) {
|
|
|
12367
12421
|
if (!record) {
|
|
12368
12422
|
throw workflowValidationError("ai_groups_invalid", `${label} \u5FC5\u987B\u662F\u5BF9\u8C61 { groupId, title, requestIds }`, { retryAllowed: false });
|
|
12369
12423
|
}
|
|
12370
|
-
const unknownKeys = Object.keys(record).filter((key) => !["groupId", "title", "requestIds"].includes(key));
|
|
12424
|
+
const unknownKeys = Object.keys(record).filter((key) => !["groupId", "title", "requestIds", "summary"].includes(key));
|
|
12371
12425
|
if (unknownKeys.length > 0) {
|
|
12372
12426
|
throw workflowValidationError(
|
|
12373
12427
|
"ai_groups_invalid",
|
|
12374
|
-
`${label} \u4E0D\u63A5\u53D7\u5B57\u6BB5\uFF1A${unknownKeys.join(", ")}\uFF1B\u53EA\u652F\u6301 groupId / title / requestIds`,
|
|
12428
|
+
`${label} \u4E0D\u63A5\u53D7\u5B57\u6BB5\uFF1A${unknownKeys.join(", ")}\uFF1B\u53EA\u652F\u6301 groupId / title / requestIds / summary`,
|
|
12375
12429
|
{ retryAllowed: false, details: { unknownKeys } }
|
|
12376
12430
|
);
|
|
12377
12431
|
}
|
|
12432
|
+
const planSummary = typeof record.summary === "string" ? record.summary.trim() : "";
|
|
12378
12433
|
const groupId = typeof record.groupId === "string" ? record.groupId.trim() : "";
|
|
12379
12434
|
if (!groupId) {
|
|
12380
12435
|
throw workflowValidationError(
|
|
@@ -12412,7 +12467,12 @@ function readAiGroups(value) {
|
|
|
12412
12467
|
ids.push(id);
|
|
12413
12468
|
}
|
|
12414
12469
|
const bucket = map.get(groupId) ?? [];
|
|
12415
|
-
bucket.push({
|
|
12470
|
+
bucket.push({
|
|
12471
|
+
groupId,
|
|
12472
|
+
title,
|
|
12473
|
+
requestIds: [...new Set(ids)],
|
|
12474
|
+
...planSummary ? { summary: planSummary } : {}
|
|
12475
|
+
});
|
|
12416
12476
|
map.set(groupId, bucket);
|
|
12417
12477
|
});
|
|
12418
12478
|
return map;
|
|
@@ -12468,44 +12528,21 @@ function rowKeyForCount(row) {
|
|
|
12468
12528
|
if (id) return `id:${id}`;
|
|
12469
12529
|
return `tx:${row.requestNameTitle ?? ""}|${row.creater ?? ""}|${row.nodeId ?? ""}`;
|
|
12470
12530
|
}
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
const
|
|
12485
|
-
const
|
|
12486
|
-
const detailCacheForTag = skipDetail ? null : await openDetailCache(env.ctx);
|
|
12487
|
-
const materialTagOfRow = (requestId, stamp) => {
|
|
12488
|
-
const entry = detailCacheForTag?.get(requestId, stamp);
|
|
12489
|
-
return entry ? detailMaterialTagOf(entry) : void 0;
|
|
12490
|
-
};
|
|
12491
|
-
const cachedIds = /* @__PURE__ */ new Set();
|
|
12492
|
-
const allRows = [];
|
|
12493
|
-
for (const group of groups) {
|
|
12494
|
-
for (const row of group.requestDatas ?? []) {
|
|
12495
|
-
allRows.push(row);
|
|
12496
|
-
if (summaryCache.get(
|
|
12497
|
-
row.requestId,
|
|
12498
|
-
row.lastFeedBackDateTime,
|
|
12499
|
-
summaryMaxChars,
|
|
12500
|
-
promptTagOf(activeRuleFor(group.title)?.requestSummaryPrompt ?? ""),
|
|
12501
|
-
materialTagOfRow(row.requestId, row.lastFeedBackDateTime)
|
|
12502
|
-
)) cachedIds.add(row.requestId);
|
|
12503
|
-
}
|
|
12504
|
-
}
|
|
12505
|
-
const detailIds = [...new Set(allRows.map((row) => row.requestId).filter(Boolean))];
|
|
12506
|
-
const stamps = stampsOfRows(allRows);
|
|
12507
|
-
const facts = skipDetail ? /* @__PURE__ */ new Map() : options.facts ?? (await fetchDetailFacts(env, detailIds, args, stamps)).facts;
|
|
12508
|
-
const metrics = skipDetail ? void 0 : options.metrics ?? metricsOfFacts(facts);
|
|
12531
|
+
function flattenFinalGroups(groups) {
|
|
12532
|
+
return groups.map((group) => ({
|
|
12533
|
+
id: group.id,
|
|
12534
|
+
topPriority: group.id === PRIORITY_GROUP_ID,
|
|
12535
|
+
title: group.title,
|
|
12536
|
+
count: group.count,
|
|
12537
|
+
defaultExpanded: true,
|
|
12538
|
+
displayItems: requestItemsOf(group.requestDatas)
|
|
12539
|
+
}));
|
|
12540
|
+
}
|
|
12541
|
+
function applySubGroups(groups, options) {
|
|
12542
|
+
const plans = options.plans;
|
|
12543
|
+
const facts = options.facts;
|
|
12544
|
+
const metrics = options.metrics;
|
|
12545
|
+
const warnings = options.warnings;
|
|
12509
12546
|
const knownGroupIds = new Set(groups.map((group) => group.id));
|
|
12510
12547
|
for (const groupId of plans?.keys() ?? []) {
|
|
12511
12548
|
if (!knownGroupIds.has(groupId)) {
|
|
@@ -12523,15 +12560,6 @@ async function runSmartGroup(args, env, options = {}) {
|
|
|
12523
12560
|
);
|
|
12524
12561
|
}
|
|
12525
12562
|
}
|
|
12526
|
-
const warnings = (base.warnings ?? []).filter((text) => !text.startsWith("markdown \u53EA\u5C55\u793A\u524D"));
|
|
12527
|
-
warnings.push(...primeRules(env.ctx).warnings);
|
|
12528
|
-
if (skipDetail) {
|
|
12529
|
-
warnings.push("withDetailContext=false\uFF1A\u672C\u6B21\u672A\u62C9\u53D6\u4EFB\u4F55\u8BE6\u60C5\u2014\u2014\u8BF7\u5047/\u8D22\u52A1\u9608\u503C\u6539\u4E3A\u6309\u6807\u9898\u8BC6\u522B\u3001\u8DF3\u8FC7\u6574\u7EC4\u7A7A\u5224\u5B9A\uFF0C\u4E5F\u4E0D\u4EA7 summaryBatches");
|
|
12530
|
-
} else if (cachedIds.size > 0) {
|
|
12531
|
-
warnings.push(
|
|
12532
|
-
`\u6709 ${cachedIds.size} \u6761\u547D\u4E2D\u672C\u5730\u6458\u8981\u7F13\u5B58\uFF08\u8FD9\u4E9B\u6761\u76EE\u4E0D\u7528\u518D\u8C03 AI\uFF09\uFF1B\u8BE6\u60C5\u4ECD\u6309\u7F13\u5B58\u4F18\u5148\u53D6\u4E00\u6B21\u2014\u2014\u9608\u503C\u6307\u6807\u53EA\u8BA4\u6D41\u7A0B\u8BE6\u60C5\u6570\u636E\uFF0C\u8DF3\u8FC7\u8BE6\u60C5\u4F1A\u8BA9\u9608\u503C\u5206\u7EC4\u5931\u6548`
|
|
12533
|
-
);
|
|
12534
|
-
}
|
|
12535
12563
|
const finalGroups = groups.map((group) => {
|
|
12536
12564
|
if (group.id === PRIORITY_GROUP_ID) {
|
|
12537
12565
|
return {
|
|
@@ -12657,7 +12685,11 @@ async function runSmartGroup(args, env, options = {}) {
|
|
|
12657
12685
|
}
|
|
12658
12686
|
groupRows = kept2;
|
|
12659
12687
|
}
|
|
12660
|
-
subGroups.push({
|
|
12688
|
+
subGroups.push({
|
|
12689
|
+
title: plan.title,
|
|
12690
|
+
requestDatas: groupRows,
|
|
12691
|
+
...plan.summary ? { summary: plan.summary } : {}
|
|
12692
|
+
});
|
|
12661
12693
|
}
|
|
12662
12694
|
const kept = subGroups.filter((sub) => sub.requestDatas.length >= 2);
|
|
12663
12695
|
const dissolved = subGroups.length - kept.length;
|
|
@@ -12689,6 +12721,7 @@ async function runSmartGroup(args, env, options = {}) {
|
|
|
12689
12721
|
}
|
|
12690
12722
|
}
|
|
12691
12723
|
const renderSubGroupSummary = (sub) => {
|
|
12724
|
+
if ((sub.summary ?? "").trim()) return sub.summary;
|
|
12692
12725
|
const groupSummary = rule.aiGroup?.groupSummary;
|
|
12693
12726
|
if (!groupSummary || groupSummary.needAI || !groupSummary.template) return "";
|
|
12694
12727
|
if (groupRule.groupTitle && sub.title !== groupRule.groupTitle) return "";
|
|
@@ -12730,9 +12763,57 @@ async function runSmartGroup(args, env, options = {}) {
|
|
|
12730
12763
|
displayItems: [...groupItems, ...requestItemsOf(singles)]
|
|
12731
12764
|
};
|
|
12732
12765
|
});
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12766
|
+
return finalGroups;
|
|
12767
|
+
}
|
|
12768
|
+
async function runSmartGroup(args, env, options = {}) {
|
|
12769
|
+
const base = runGroup(args);
|
|
12770
|
+
const groups = base.wfIdGroup ?? [];
|
|
12771
|
+
const plans = args.aiGroups === void 0 || args.aiGroups === null ? void 0 : readAiGroups(args.aiGroups);
|
|
12772
|
+
const groupFocus = typeof args.groupFocus === "string" ? args.groupFocus.trim() : "";
|
|
12773
|
+
const hasFocus = groupFocus.length > 0;
|
|
12774
|
+
const summaryMaxChars = readBoundedInt(
|
|
12775
|
+
args.summaryMaxChars,
|
|
12776
|
+
"summaryMaxChars",
|
|
12777
|
+
DEFAULT_REQUEST_SUMMARY_MAX2,
|
|
12778
|
+
10,
|
|
12779
|
+
500
|
|
12780
|
+
);
|
|
12781
|
+
const skipDetail = args.withDetailContext === false;
|
|
12782
|
+
const summaryCache = await openSummaryCache(env.ctx);
|
|
12783
|
+
const detailCacheForTag = skipDetail ? null : await openDetailCache(env.ctx);
|
|
12784
|
+
const materialTagOfRow = (requestId, stamp) => {
|
|
12785
|
+
const entry = detailCacheForTag?.get(requestId, stamp);
|
|
12786
|
+
return entry ? detailMaterialTagOf(entry) : void 0;
|
|
12787
|
+
};
|
|
12788
|
+
const cachedIds = /* @__PURE__ */ new Set();
|
|
12789
|
+
const allRows = [];
|
|
12790
|
+
for (const group of groups) {
|
|
12791
|
+
for (const row of group.requestDatas ?? []) {
|
|
12792
|
+
allRows.push(row);
|
|
12793
|
+
if (summaryCache.get(
|
|
12794
|
+
row.requestId,
|
|
12795
|
+
row.lastFeedBackDateTime,
|
|
12796
|
+
summaryMaxChars,
|
|
12797
|
+
promptTagOf(activeRuleFor(group.title)?.requestSummaryPrompt ?? ""),
|
|
12798
|
+
materialTagOfRow(row.requestId, row.lastFeedBackDateTime)
|
|
12799
|
+
)) cachedIds.add(row.requestId);
|
|
12800
|
+
}
|
|
12801
|
+
}
|
|
12802
|
+
const detailIds = [...new Set(allRows.map((row) => row.requestId).filter(Boolean))];
|
|
12803
|
+
const stamps = stampsOfRows(allRows);
|
|
12804
|
+
const facts = skipDetail ? /* @__PURE__ */ new Map() : options.facts ?? (await fetchDetailFacts(env, detailIds, args, stamps)).facts;
|
|
12805
|
+
const warnings = (base.warnings ?? []).filter((text) => !text.startsWith("markdown \u53EA\u5C55\u793A\u524D"));
|
|
12806
|
+
warnings.push(...primeRules(env.ctx).warnings);
|
|
12807
|
+
if (skipDetail) {
|
|
12808
|
+
warnings.push("withDetailContext=false\uFF1A\u672C\u6B21\u672A\u62C9\u53D6\u4EFB\u4F55\u8BE6\u60C5\u2014\u2014\u8BF7\u5047/\u8D22\u52A1\u9608\u503C\u6539\u4E3A\u6309\u6807\u9898\u8BC6\u522B\u3001\u8DF3\u8FC7\u6574\u7EC4\u7A7A\u5224\u5B9A\uFF0C\u4E5F\u4E0D\u4EA7 summaryBatches");
|
|
12809
|
+
} else if (cachedIds.size > 0) {
|
|
12810
|
+
warnings.push(
|
|
12811
|
+
`\u6709 ${cachedIds.size} \u6761\u547D\u4E2D\u672C\u5730\u6458\u8981\u7F13\u5B58\uFF08\u8FD9\u4E9B\u6761\u76EE\u4E0D\u7528\u518D\u8C03 AI\uFF09\uFF1B\u8BE6\u60C5\u4ECD\u6309\u7F13\u5B58\u4F18\u5148\u53D6\u4E00\u6B21\u2014\u2014\u9608\u503C\u6307\u6807\u53EA\u8BA4\u6D41\u7A0B\u8BE6\u60C5\u6570\u636E\uFF0C\u8DF3\u8FC7\u8BE6\u60C5\u4F1A\u8BA9\u9608\u503C\u5206\u7EC4\u5931\u6548`
|
|
12812
|
+
);
|
|
12813
|
+
}
|
|
12814
|
+
const orderedGroups = flattenFinalGroups(groups);
|
|
12815
|
+
if (plans !== void 0) {
|
|
12816
|
+
warnings.push("aiGroups \u5DF2\u6536\u5230\uFF0C\u4F46\u672C\u9636\u6BB5\u4E0D\u505A\u4E8C\u6B21\u5206\u7EC4\uFF1A\u7559\u5230 stage=subGroup \u5E94\u7528");
|
|
12736
12817
|
}
|
|
12737
12818
|
return {
|
|
12738
12819
|
data: {
|
|
@@ -12909,7 +12990,7 @@ function collectSummaryUnits(groups) {
|
|
|
12909
12990
|
continue;
|
|
12910
12991
|
}
|
|
12911
12992
|
const kind = detectBusinessKind(group.title);
|
|
12912
|
-
if (!needsRequestSummary(kind)) continue;
|
|
12993
|
+
if (!needAiSummary(group.title) || !needsRequestSummary(kind)) continue;
|
|
12913
12994
|
for (const item of group.displayItems) {
|
|
12914
12995
|
if (item.type === "group") {
|
|
12915
12996
|
units.push({
|
|
@@ -12949,11 +13030,11 @@ async function runSummaryContext(args, env, prefetched) {
|
|
|
12949
13030
|
const prefilledIds = /* @__PURE__ */ new Set();
|
|
12950
13031
|
const needsDetail = [];
|
|
12951
13032
|
const workflowTitleByRequest = /* @__PURE__ */ new Map();
|
|
12952
|
-
for (const
|
|
12953
|
-
if (
|
|
12954
|
-
for (const row of
|
|
13033
|
+
for (const group of groups) {
|
|
13034
|
+
if (group.topPriority) continue;
|
|
13035
|
+
for (const row of rowsOfGroup(group)) {
|
|
12955
13036
|
if (row.requestId && !workflowTitleByRequest.has(row.requestId)) {
|
|
12956
|
-
workflowTitleByRequest.set(row.requestId,
|
|
13037
|
+
workflowTitleByRequest.set(row.requestId, group.title);
|
|
12957
13038
|
}
|
|
12958
13039
|
}
|
|
12959
13040
|
}
|
|
@@ -12961,6 +13042,7 @@ async function runSummaryContext(args, env, prefetched) {
|
|
|
12961
13042
|
for (const unit of units) {
|
|
12962
13043
|
for (const row of unit.rows) {
|
|
12963
13044
|
const name = ruleNameForRow(unit, row);
|
|
13045
|
+
if (!needAiSummary(name)) continue;
|
|
12964
13046
|
const cached = summaryCache.get(
|
|
12965
13047
|
row.requestId,
|
|
12966
13048
|
row.lastFeedBackDateTime,
|
|
@@ -13016,6 +13098,13 @@ async function runSummaryContext(args, env, prefetched) {
|
|
|
13016
13098
|
};
|
|
13017
13099
|
for (const row of unit.rows) {
|
|
13018
13100
|
if (prefilledIds.has(row.requestId)) continue;
|
|
13101
|
+
if (!needAiSummary(ruleNameForRow(unit, row))) {
|
|
13102
|
+
if (!(row.summary ?? "").trim()) {
|
|
13103
|
+
row.summary = row.requestNameTitle ?? "";
|
|
13104
|
+
if ((row.summary ?? "").trim()) titleCopied += 1;
|
|
13105
|
+
}
|
|
13106
|
+
continue;
|
|
13107
|
+
}
|
|
13019
13108
|
const { context, contextAvailable: available } = provider.get(row.requestId);
|
|
13020
13109
|
if (!available) {
|
|
13021
13110
|
const firstSeen = !row.requestId || !claimed.has(row.requestId);
|
|
@@ -13169,17 +13258,15 @@ async function runSummary(args, env) {
|
|
|
13169
13258
|
}
|
|
13170
13259
|
const ruleNameForGroup = (group, row) => group.topPriority ? wfTitleByRequest.get(row?.requestId ?? "") ?? group.title : group.title;
|
|
13171
13260
|
for (const group of groups) {
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13261
|
+
for (const row of rowsOfGroup(group)) {
|
|
13262
|
+
if ((row.summary ?? "").trim()) continue;
|
|
13263
|
+
const name = ruleNameForGroup(group, row);
|
|
13264
|
+
if (!needAiSummary(name)) {
|
|
13175
13265
|
row.summary = row.requestNameTitle ?? "";
|
|
13176
13266
|
if ((row.summary ?? "").trim()) titleSummary += 1;
|
|
13267
|
+
continue;
|
|
13177
13268
|
}
|
|
13178
|
-
continue;
|
|
13179
|
-
}
|
|
13180
|
-
for (const row of rowsOfGroup(group)) {
|
|
13181
|
-
if (!row?.requestId || (row.summary ?? "").trim()) continue;
|
|
13182
|
-
const name = ruleNameForGroup(group, row);
|
|
13269
|
+
if (!row?.requestId) continue;
|
|
13183
13270
|
const cached = summaryCache.get(
|
|
13184
13271
|
row.requestId,
|
|
13185
13272
|
row.lastFeedBackDateTime,
|
|
@@ -13312,6 +13399,41 @@ async function runSummary(args, env) {
|
|
|
13312
13399
|
};
|
|
13313
13400
|
}
|
|
13314
13401
|
|
|
13402
|
+
// src/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subGroup.ts
|
|
13403
|
+
async function runSubGroup(args, env) {
|
|
13404
|
+
const groups = await readFinalGroups(args, env);
|
|
13405
|
+
const warnings = [];
|
|
13406
|
+
const wfGroups = groups.filter((group) => !group.topPriority).map((group) => ({
|
|
13407
|
+
id: group.id,
|
|
13408
|
+
title: group.title,
|
|
13409
|
+
count: group.count,
|
|
13410
|
+
requestDatas: rowsOfGroup(group)
|
|
13411
|
+
}));
|
|
13412
|
+
const plans = args.aiGroups === void 0 || args.aiGroups === null ? void 0 : readAiGroups(args.aiGroups);
|
|
13413
|
+
const rows = wfGroups.flatMap((group) => group.requestDatas);
|
|
13414
|
+
const detailIds = [...new Set(rows.map((row) => row.requestId).filter(Boolean))];
|
|
13415
|
+
const facts = /* @__PURE__ */ new Map();
|
|
13416
|
+
let metrics;
|
|
13417
|
+
if (args.withDetailContext !== false && detailIds.length > 0) {
|
|
13418
|
+
const result = await fetchDetailFacts(env, detailIds, args, stampsOfRows(rows));
|
|
13419
|
+
for (const [requestId, fact] of result.facts) facts.set(requestId, fact);
|
|
13420
|
+
metrics = metricsOfFacts(facts);
|
|
13421
|
+
warnings.push(...result.warnings);
|
|
13422
|
+
}
|
|
13423
|
+
const finalGroups = applySubGroups(wfGroups, { plans, facts, metrics, warnings });
|
|
13424
|
+
return {
|
|
13425
|
+
data: {
|
|
13426
|
+
smartSummaryTitle: readSmartSummaryTitle(
|
|
13427
|
+
args,
|
|
13428
|
+
`\u60A8\u5F53\u524D\u6709 ${totalTodoCount(groups)} \u6761\u5F85\u529E\uFF0C\u6E05\u5355\u5982\u4E0B\uFF1A`
|
|
13429
|
+
),
|
|
13430
|
+
totalCount: totalTodoCount(groups),
|
|
13431
|
+
wfIdGroup: finalGroups
|
|
13432
|
+
},
|
|
13433
|
+
warnings
|
|
13434
|
+
};
|
|
13435
|
+
}
|
|
13436
|
+
|
|
13315
13437
|
// src/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.ts
|
|
13316
13438
|
var INTERNAL_MESSAGE_SUMMARY_HINT2 = "\u5185\u90E8\u7559\u8A00\uFF1A\u53EA\u6309\u539F\u6587\u76F4\u63A5\u6982\u62EC\u300C\u8C01\u8BF4\u4E86\u4EC0\u4E48\u300D\uFF0C\u4E0D\u8981\u8FC7\u5EA6\u89E3\u8BFB\u3001\u4E0D\u8981\u63A8\u6D4B\u52A8\u673A\u6216\u5F71\u54CD\uFF0C\u4E25\u683C\u6309\u672C\u6279 suggestedMaxChars \u63A7\u5236\u5B57\u6570";
|
|
13317
13439
|
var GROUP_SUMMARY_TAIL = GROUP_SUMMARY_TAIL_TEXT;
|
|
@@ -13356,7 +13478,7 @@ function collectGroupSummaryBatches(groups, isCtxEmpty, maxCharsFor = () => DEFA
|
|
|
13356
13478
|
if (group.topPriority) continue;
|
|
13357
13479
|
const kind = detectBusinessKind(group.title);
|
|
13358
13480
|
for (const sub of groupItemsOf(group)) {
|
|
13359
|
-
if (
|
|
13481
|
+
if ((sub.summary ?? "").trim() !== "") continue;
|
|
13360
13482
|
const allRows = Array.isArray(sub.requestDatas) ? sub.requestDatas : [];
|
|
13361
13483
|
const rows = isCtxEmpty ? allRows.filter((row) => !isCtxEmpty(row.requestId)) : allRows;
|
|
13362
13484
|
const emptySkipped = allRows.length - rows.length;
|
|
@@ -13661,6 +13783,7 @@ var inputSchema = schemaOf({
|
|
|
13661
13783
|
}
|
|
13662
13784
|
},
|
|
13663
13785
|
withDetailContext: { type: "boolean", description: "smartGroup \u662F\u5426\u540C\u8FDB\u7A0B\u751F\u6210\u5355\u6761\u6458\u8981\u4E0A\u4E0B\u6587\u3002" },
|
|
13786
|
+
withSubGroup: { type: "boolean", description: "summary \u56DE\u586B\u540E\u662F\u5426\u540C\u8FDB\u7A0B\u63A5\u7740\u505A ai \u4E8C\u6B21\u5206\u7EC4\uFF08stage=subGroup \u7B49\u4EF7\uFF09\u3002" },
|
|
13664
13787
|
withGroupSummaryContext: { type: "boolean", description: "summary \u662F\u5426\u540C\u8FDB\u7A0B\u751F\u6210\u7EC4\u6458\u8981\u4E0A\u4E0B\u6587\u3002" },
|
|
13665
13788
|
detailPrefetch: { type: "boolean", description: "\u5E9F\u5F03\u517C\u5BB9\u53C2\u6570\uFF0C\u5DF2\u5FFD\u7565\uFF1Bcollect \u53EA\u5728\u7ED9\u4E86 groupFocus \u4E14\u610F\u56FE\u9002\u7528\u4E8E\u672C\u7EC4\u65F6\u6309\u9700\u9884\u53D6\u5206\u7EC4\u5B57\u6BB5\uFF08\u8D70\u8BE6\u60C5\u7F13\u5B58\uFF09\u3002" },
|
|
13666
13789
|
groupBy: { type: "string", enum: [...GROUP_BY_VALUES], default: "workflow" },
|
|
@@ -13741,6 +13864,14 @@ var workflowTodoSmartConvertOperations = [{
|
|
|
13741
13864
|
const stage = args.stage === void 0 || args.stage === null || args.stage === "" ? inferStage(args) : readStage(args.stage);
|
|
13742
13865
|
const hasItems = Array.isArray(args.items);
|
|
13743
13866
|
const resumed = stage === "collect" && hasItems;
|
|
13867
|
+
const withPriorityView = (data, extraWarnings) => {
|
|
13868
|
+
if ((args.groupBy ?? "workflow") !== "workflow") return { data, warnings: extraWarnings };
|
|
13869
|
+
const { groups, warning } = assemblePriorityGroup(data.wfIdGroup ?? []);
|
|
13870
|
+
return {
|
|
13871
|
+
data: { ...data, wfIdGroup: groups },
|
|
13872
|
+
warnings: warning ? [...extraWarnings, warning] : extraWarnings
|
|
13873
|
+
};
|
|
13874
|
+
};
|
|
13744
13875
|
if ((stage === "group" || stage === "smartGroup" || stage === "aggregate") && !hasItems) {
|
|
13745
13876
|
throw workflowValidationError(
|
|
13746
13877
|
"items_required",
|
|
@@ -13794,39 +13925,62 @@ var workflowTodoSmartConvertOperations = [{
|
|
|
13794
13925
|
);
|
|
13795
13926
|
}
|
|
13796
13927
|
const result = await runSummary(args, env);
|
|
13928
|
+
let baseData = result.data;
|
|
13929
|
+
let baseWarnings = result.warnings;
|
|
13930
|
+
let subGrouped = false;
|
|
13931
|
+
if (args.withSubGroup === true) {
|
|
13932
|
+
const sub = await runSubGroup({ ...args, wfIdGroup: baseData.wfIdGroup }, env);
|
|
13933
|
+
baseData = { ...baseData, wfIdGroup: sub.data.wfIdGroup };
|
|
13934
|
+
baseWarnings = [...baseWarnings, ...sub.warnings];
|
|
13935
|
+
subGrouped = true;
|
|
13936
|
+
}
|
|
13937
|
+
const final = withPriorityView(baseData, baseWarnings);
|
|
13797
13938
|
if (args.withGroupSummaryContext === true) {
|
|
13798
13939
|
const context = await runGroupSummaryContext({
|
|
13799
|
-
wfIdGroup:
|
|
13800
|
-
smartSummaryTitle:
|
|
13801
|
-
totalCount:
|
|
13940
|
+
wfIdGroup: final.data.wfIdGroup,
|
|
13941
|
+
smartSummaryTitle: final.data.smartSummaryTitle,
|
|
13942
|
+
totalCount: final.data.totalCount
|
|
13802
13943
|
}, env);
|
|
13803
13944
|
if (Array.isArray(context.data.groupSummaryBatches) && context.data.groupSummaryBatches.length === 0) {
|
|
13804
|
-
return finish(env, args, startedAt, stage,
|
|
13945
|
+
return finish(env, args, startedAt, stage, final.data, {
|
|
13805
13946
|
branch: "todo-smart-convert",
|
|
13806
13947
|
stage,
|
|
13807
13948
|
aiSummarized: true,
|
|
13949
|
+
subGrouped,
|
|
13808
13950
|
withGroupSummaryContext: true,
|
|
13809
13951
|
...result.meta
|
|
13810
|
-
},
|
|
13952
|
+
}, final.warnings);
|
|
13811
13953
|
}
|
|
13812
13954
|
return finish(env, args, startedAt, stage, {
|
|
13813
|
-
...
|
|
13955
|
+
...final.data,
|
|
13814
13956
|
groupSummaryBatches: context.data.groupSummaryBatches,
|
|
13815
13957
|
groupSummaryStats: context.data.groupSummaryStats
|
|
13816
13958
|
}, {
|
|
13817
13959
|
branch: "todo-smart-convert",
|
|
13818
13960
|
stage,
|
|
13819
13961
|
aiSummarized: true,
|
|
13962
|
+
subGrouped,
|
|
13820
13963
|
withGroupSummaryContext: true,
|
|
13821
13964
|
...result.meta
|
|
13822
|
-
}, [...
|
|
13965
|
+
}, [...final.warnings, ...context.warnings]);
|
|
13823
13966
|
}
|
|
13824
|
-
return finish(env, args, startedAt, stage,
|
|
13967
|
+
return finish(env, args, startedAt, stage, final.data, {
|
|
13825
13968
|
branch: "todo-smart-convert",
|
|
13826
13969
|
stage,
|
|
13827
13970
|
aiSummarized: true,
|
|
13971
|
+
subGrouped,
|
|
13828
13972
|
...result.meta
|
|
13829
|
-
},
|
|
13973
|
+
}, final.warnings);
|
|
13974
|
+
}
|
|
13975
|
+
if (stage === "subGroup") {
|
|
13976
|
+
const result = await runSubGroup(args, env);
|
|
13977
|
+
const final = withPriorityView(result.data, result.warnings);
|
|
13978
|
+
return finish(env, args, startedAt, stage, final.data, {
|
|
13979
|
+
branch: "todo-smart-convert",
|
|
13980
|
+
stage,
|
|
13981
|
+
aiGrouped: Array.isArray(args.aiGroups),
|
|
13982
|
+
subGrouped: true
|
|
13983
|
+
}, final.warnings);
|
|
13830
13984
|
}
|
|
13831
13985
|
if (stage === "groupSummaryContext") {
|
|
13832
13986
|
const result = await runGroupSummaryContext(args, env);
|
|
@@ -13845,12 +13999,13 @@ var workflowTodoSmartConvertOperations = [{
|
|
|
13845
13999
|
);
|
|
13846
14000
|
}
|
|
13847
14001
|
const result = await runGroupSummary(args, env);
|
|
13848
|
-
|
|
14002
|
+
const final = withPriorityView(result.data, result.warnings);
|
|
14003
|
+
return finish(env, args, startedAt, stage, final.data, {
|
|
13849
14004
|
branch: "todo-smart-convert",
|
|
13850
14005
|
stage,
|
|
13851
14006
|
aiSummarized: true,
|
|
13852
14007
|
...result.meta
|
|
13853
|
-
},
|
|
14008
|
+
}, final.warnings);
|
|
13854
14009
|
}
|
|
13855
14010
|
if (stage === "group" || resumed) {
|
|
13856
14011
|
return finish(env, args, startedAt, "group", runGroup(args), {
|