weaver-work-cli 0.1.39 → 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/README.md +4 -2
- package/dist/chunks/{archive-ENZYBBME.js → archive-J4I6MCKF.js} +2 -2
- package/dist/chunks/{archive-oa-YWLEC5V4.js → archive-oa-BRZKKTO4.js} +2 -2
- package/dist/chunks/{asset-OOV6DWPA.js → asset-L7D4FAOZ.js} +2 -2
- package/dist/chunks/{asset-idle-RE632MY5.js → asset-idle-DADLLV75.js} +2 -2
- package/dist/chunks/{attachment-content-RWN2FCLL.js → attachment-content-K4C7VLWQ.js} +3 -3
- package/dist/chunks/{blog-PEPOJAL7.js → blog-BVGQ7NZL.js} +2 -2
- package/dist/chunks/{caizhilian-WYIQDVPJ.js → caizhilian-SAADNFD6.js} +2 -2
- package/dist/chunks/{calendar-CIARBAOX.js → calendar-Q7NQY5Z2.js} +61 -23
- package/dist/chunks/{chunk-F2EQXUEE.js → chunk-3KTFS4IA.js} +397 -159
- package/dist/chunks/{chunk-G2JSIUWF.js → chunk-4PD5NWAX.js} +89 -0
- package/dist/chunks/{chunk-HJYVHXUQ.js → chunk-4RAE6JXP.js} +1 -1
- package/dist/chunks/{chunk-CQHGNCK2.js → chunk-72CKAUAG.js} +41 -8
- package/dist/chunks/{chunk-K3RUEEOL.js → chunk-APVFJUQH.js} +2 -2
- package/dist/chunks/{chunk-BJGXMFGD.js → chunk-BBKDXQEC.js} +2 -2
- package/dist/chunks/chunk-BIPYLLVS.js +501 -0
- package/dist/chunks/{chunk-GVPJZXJ2.js → chunk-EKWAQSLU.js} +92 -50
- package/dist/chunks/{chunk-XXJOSZTQ.js → chunk-FOAA27U5.js} +381 -57
- package/dist/chunks/{chunk-I2HB737U.js → chunk-G4UR6NXN.js} +2 -2
- package/dist/chunks/{chunk-YS5DPN4T.js → chunk-GEWYMQME.js} +1 -1
- package/dist/chunks/{chunk-P2DAISYW.js → chunk-GHXCDPTM.js} +1 -1
- package/dist/chunks/{chunk-L4N7B7ZD.js → chunk-IZ7S7QUS.js} +4 -4
- package/dist/chunks/{chunk-NLK2RZKG.js → chunk-JPRO6ER2.js} +122 -2214
- package/dist/chunks/{chunk-36DIFZAH.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-EINRJHQ3.js → chunk-QKNKR4RH.js} +3 -3
- package/dist/chunks/{chunk-T7JDJJ7H.js → chunk-R4CHUSKC.js} +126 -19
- package/dist/chunks/{chunk-EZGFHJFW.js → chunk-SA6VBIHY.js} +88 -15
- package/dist/chunks/{chunk-ZXRNHZTE.js → chunk-TTPJJJC4.js} +2 -2
- package/dist/chunks/{chunk-KTCB5R5H.js → chunk-W7BEHOSR.js} +2 -2
- package/dist/chunks/{chunk-MUQUHKPG.js → chunk-YRSZQUD2.js} +2 -2
- package/dist/chunks/{conflict-DRMDOL56.js → conflict-F2OMZRTO.js} +2 -2
- package/dist/chunks/{contract-73MERZWN.js → contract-5BETHRSG.js} +2 -2
- package/dist/chunks/{cowork-HNGBPD7A.js → cowork-3MN6EQQO.js} +27 -10
- package/dist/chunks/create-flow-5FQNNMVO.js +55 -0
- package/dist/chunks/{ebuilder-form-OY6DVNRK.js → ebuilder-form-SBHOYBUD.js} +3 -3
- package/dist/chunks/{ehr-RAQNEQO7.js → ehr-KMOJULKG.js} +432 -1234
- package/dist/chunks/env-LB7NBL2O.js +19 -0
- package/dist/chunks/{esb-6XV7C7YV.js → esb-W2PJCFCX.js} +4 -4
- package/dist/chunks/factory-6ZFQXQ46.js +30 -0
- package/dist/chunks/{fna-XTSRB7G7.js → fna-ZQPCUV4R.js} +2 -2
- package/dist/chunks/group-chat-2HHAJN46.js +20 -0
- package/dist/chunks/{host-YMBXWFWX.js → host-4CBHGOHT.js} +3 -3
- package/dist/chunks/{host-A7J6GDUP.js → host-ATKVNZAT.js} +3 -3
- package/dist/chunks/{host-3F5UM5GN.js → host-BQH22NTQ.js} +3 -3
- package/dist/chunks/{host-YAQAPYNP.js → host-X2CSLFM6.js} +3 -3
- package/dist/chunks/{host-VGPVP7YF.js → host-YTODKMSL.js} +3 -3
- package/dist/chunks/{hrm-TLHKC545.js → hrm-FFM4UJFS.js} +4 -4
- package/dist/chunks/{im-YOUCFMUK.js → im-VEHKDQPB.js} +8 -8
- package/dist/chunks/{invoice-WNBS2B4C.js → invoice-LVIKSIIF.js} +3 -3
- package/dist/chunks/{jiuchuanhui-XABWS5RN.js → jiuchuanhui-X6DINO5P.js} +2 -2
- package/dist/chunks/{lazy-dispatch-NLZ5UQQI.js → lazy-dispatch-KSWTN5L6.js} +4 -4
- package/dist/chunks/{mail-LRYMBFNL.js → mail-VDKRGUD3.js} +9 -4
- package/dist/chunks/{meeting-ESXL6MFI.js → meeting-CLC6HP3Z.js} +12 -10
- package/dist/chunks/{okr-EOV65SSF.js → okr-CHG4OO3U.js} +2 -2
- package/dist/chunks/{plan-YFPVKW6Y.js → plan-XWR75667.js} +2 -2
- package/dist/chunks/{project-MDVZUYQW.js → project-5BXOOKMG.js} +40 -23
- package/dist/chunks/recruit-stage-DGMFNNDE.js +4507 -0
- package/dist/chunks/{registry-VT5Y2HLA.js → registry-7FFOXIAW.js} +4 -4
- package/dist/chunks/{registry-QCLZEDAP.js → registry-BKBZPBAJ.js} +10 -8
- package/dist/chunks/{registry-YX4CSEMD.js → registry-RHMW6ANW.js} +2 -2
- package/dist/chunks/{registry-NYPYMZXG.js → registry-Z43434VG.js} +1 -1
- package/dist/chunks/{room-recommend-L3MWH4JW.js → room-recommend-62H7ZQQ6.js} +4 -4
- package/dist/chunks/{schedule-UASAVDVD.js → schedule-FNXKH3DQ.js} +4 -4
- package/dist/chunks/{workflow-KDGIUCNW.js → workflow-ADHKCAJK.js} +4 -4
- package/dist/index.js +33 -28
- package/dist/internal/e10/auth/commands.js +110 -56
- package/dist/internal/e10/auth/messages.js +6 -0
- package/dist/internal/e10/auth/session.js +28 -1
- package/dist/internal/e10/auth/xiaoe.js +315 -48
- package/dist/internal/e10/auth-recovery.js +36 -5
- package/dist/internal/e10/client.js +13 -0
- package/dist/internal/e10/context.js +61 -9
- package/dist/internal/e10/index.js +1 -1
- package/dist/internal/e10/network-error.js +93 -0
- package/dist/internal/e10/request-runtime.js +15 -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 +5 -3
- 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/mail/operations/mail-send.js +8 -2
- package/dist/shortcuts/meeting/operations/eb/catalog.js +9 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +461 -127
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
- package/dist/shortcuts/meeting/operations/eb/factory.js +33 -0
- package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +605 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +96 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +44 -6
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
- 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/form.js +21 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +52 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +19 -11
- 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 +78 -10
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +3 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +17 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +16 -40
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +52 -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 +53 -16
- package/docs/e10-auth.md +22 -1
- package/docs/operation-manual.md +8 -0
- package/package.json +1 -1
- package/scripts/install-skill-to-xiaoe.mjs +105 -0
- package/scripts/mcp-meeting.mjs +234 -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-mail/references/mail-send.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +119 -26
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
- 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 +2 -2
- 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 +7 -1
- package/skills/weaver-e10-workflow/aigroup/default.json +23 -9
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +37 -21
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +135 -43
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -10
- package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +6 -3
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
meetingValidationError,
|
|
13
13
|
queryBody,
|
|
14
14
|
toIdCsv
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-72CKAUAG.js";
|
|
16
16
|
|
|
17
17
|
// src/shortcuts/meeting/operations/eb/conflict.ts
|
|
18
18
|
var ACTIVE_MT_STATUS = "1,2,8,9";
|
|
@@ -296,7 +296,7 @@ var ebMeetingWritePreflight = async ({ endpoint, payload, args, env, extras }) =
|
|
|
296
296
|
const items = rawMembers.split(/[,;,;]+/u).map((item) => item.trim()).filter((item) => item !== "");
|
|
297
297
|
const nameLike = items.filter((item) => !/^\d+$/u.test(item));
|
|
298
298
|
if (nameLike.length > 0) {
|
|
299
|
-
const { resolveMemberIdsByName } = await import("./schedule-
|
|
299
|
+
const { resolveMemberIdsByName } = await import("./schedule-FNXKH3DQ.js");
|
|
300
300
|
const idsByName = await resolveMemberIdsByName(env, nameLike);
|
|
301
301
|
const resolved = items.map((item) => idsByName.get(item) ?? item);
|
|
302
302
|
payload.mainTable.hrm_members = [...new Set(resolved)].join(",");
|
|
@@ -610,7 +610,7 @@ async function findCommonFreeSlots(env, input) {
|
|
|
610
610
|
const scheduleItems = [];
|
|
611
611
|
if (includeSchedule) {
|
|
612
612
|
try {
|
|
613
|
-
const { runScheduleConflictFlow, parseScheduleConflictMessage, resolveMemberIdsByName } = await import("./schedule-
|
|
613
|
+
const { runScheduleConflictFlow, parseScheduleConflictMessage, resolveMemberIdsByName } = await import("./schedule-FNXKH3DQ.js");
|
|
614
614
|
const dayBegin = new Date(rangeStart.getFullYear(), rangeStart.getMonth(), rangeStart.getDate(), 0, 0, 0, 0);
|
|
615
615
|
const dayEnd = new Date(rangeStart.getFullYear(), rangeStart.getMonth(), rangeStart.getDate(), 23, 59, 0, 0);
|
|
616
616
|
const flow = await runScheduleConflictFlow(env, {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
cacheScopeSuffix,
|
|
5
5
|
readCache,
|
|
6
6
|
writeCache
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GHXCDPTM.js";
|
|
8
8
|
import {
|
|
9
9
|
EB_BASE,
|
|
10
10
|
SCHEMA_DATETIME_MINUTE,
|
|
@@ -13,15 +13,94 @@ import {
|
|
|
13
13
|
meetingSuccess,
|
|
14
14
|
queryBody,
|
|
15
15
|
schemaOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-72CKAUAG.js";
|
|
17
|
+
|
|
18
|
+
// src/shortcuts/meeting/operations/eb/usage-cache.ts
|
|
19
|
+
var USAGE_TTL_MS = 5 * 60 * 1e3;
|
|
20
|
+
var MAX_PAGES = 10;
|
|
21
|
+
var PAGE_SIZE = 200;
|
|
22
|
+
function dayOf(datetime) {
|
|
23
|
+
return String(datetime ?? "").trim().slice(0, 10);
|
|
24
|
+
}
|
|
25
|
+
function usageOverlaps(row, begin, end) {
|
|
26
|
+
return row.start < end && row.end > begin;
|
|
27
|
+
}
|
|
28
|
+
function filterUsages(rows, options) {
|
|
29
|
+
return rows.filter((row) => {
|
|
30
|
+
if (options.roomId && row.roomId !== options.roomId) return false;
|
|
31
|
+
if (options.excludeMtId && row.mtId && row.mtId === options.excludeMtId) return false;
|
|
32
|
+
return usageOverlaps(row, options.begin, options.end);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function busyRoomIds(rows, begin, end) {
|
|
36
|
+
const ids = /* @__PURE__ */ new Set();
|
|
37
|
+
for (const row of rows) {
|
|
38
|
+
if (row.roomId && usageOverlaps(row, begin, end)) ids.add(row.roomId);
|
|
39
|
+
}
|
|
40
|
+
return ids;
|
|
41
|
+
}
|
|
42
|
+
function usageKey(scope, day) {
|
|
43
|
+
return `usage-v1-${scope}-${day}`;
|
|
44
|
+
}
|
|
45
|
+
async function loadDayUsages(env, day, options = {}) {
|
|
46
|
+
const scope = await cacheScopeSuffix(env);
|
|
47
|
+
const key = usageKey(scope, day);
|
|
48
|
+
if (options.refresh !== true) {
|
|
49
|
+
const cached = await readCache(env, key, { ttlMs: USAGE_TTL_MS });
|
|
50
|
+
if (cached) {
|
|
51
|
+
return { rows: cached.data, fromCache: true, ageMs: cached.ageMs, requests: 0 };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const session = await env.host.getSession();
|
|
55
|
+
const rows = [];
|
|
56
|
+
let requests = 0;
|
|
57
|
+
for (let pageNo = 1; pageNo <= MAX_PAGES; pageNo += 1) {
|
|
58
|
+
const response = await env.host.request({
|
|
59
|
+
method: "POST",
|
|
60
|
+
path: `${EB_BASE}/getFormDataList/query_roomusage_list`,
|
|
61
|
+
operation: "meeting.eb.roomUsage.list",
|
|
62
|
+
// 与 fetchBusyRoomIds 同一套算子语义:enddatetime lt 当天末尾、begindatetime gt 当天开头
|
|
63
|
+
query: { enddatetime: `${day} 23:59`, begindatetime: `${day} 00:00` },
|
|
64
|
+
body: queryBody(session.userId, { pageNo, pageSize: PAGE_SIZE }),
|
|
65
|
+
acceptBusiness: ebBusinessSuccess
|
|
66
|
+
});
|
|
67
|
+
requests += 1;
|
|
68
|
+
const { rows: pageRows } = extractEbRows(response);
|
|
69
|
+
for (const row of pageRows) {
|
|
70
|
+
const main = row?.mainTable ?? row ?? {};
|
|
71
|
+
const roomId = String(main.address ?? main.room_id ?? "").trim();
|
|
72
|
+
const start = String(main.startdate ?? "").trim();
|
|
73
|
+
const end = String(main.enddate ?? "").trim();
|
|
74
|
+
if (roomId && start && end) {
|
|
75
|
+
rows.push({ roomId, mtId: String(main.mt_id ?? "").trim(), start, end });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (pageRows.length < PAGE_SIZE) break;
|
|
79
|
+
}
|
|
80
|
+
await writeCache(env, key, rows);
|
|
81
|
+
return { rows, fromCache: false, ageMs: 0, requests };
|
|
82
|
+
}
|
|
83
|
+
async function invalidateDayUsages(env, day) {
|
|
84
|
+
const scope = await cacheScopeSuffix(env);
|
|
85
|
+
await clearCache(env, usageKey(scope, day));
|
|
86
|
+
}
|
|
87
|
+
async function clearCache(env, key) {
|
|
88
|
+
try {
|
|
89
|
+
const { rm } = await import("node:fs/promises");
|
|
90
|
+
const { join } = await import("node:path");
|
|
91
|
+
const { meetingStateDir } = await import("./env-LB7NBL2O.js");
|
|
92
|
+
await rm(join(meetingStateDir(env.ctx), "cache", `${key}.json`), { force: true });
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
17
96
|
|
|
18
97
|
// src/shortcuts/meeting/operations/eb/room-recommend.ts
|
|
19
98
|
var ROOMS_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
20
99
|
var STALE_NOTICE_MS = 4 * 60 * 60 * 1e3;
|
|
21
100
|
var FREQUENT_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
22
101
|
var FREQUENT_WINDOW_DAYS = 180;
|
|
23
|
-
var
|
|
24
|
-
var
|
|
102
|
+
var PAGE_SIZE2 = 100;
|
|
103
|
+
var MAX_PAGES2 = 20;
|
|
25
104
|
var STATUS_TEXT = { "0": "\u6B63\u5E38", "1": "\u5C01\u5B58" };
|
|
26
105
|
var ATTR_TEXT = { "0": "\u5B9E\u4F53", "1": "\u865A\u62DF", "2": "\u7EC4\u5408" };
|
|
27
106
|
function toText(value) {
|
|
@@ -47,7 +126,7 @@ async function fetchRoomsPage(env, pageNo) {
|
|
|
47
126
|
method: "POST",
|
|
48
127
|
path: `${EB_BASE}/getFormDataList/query_meeting_room_list`,
|
|
49
128
|
operation: "meeting.eb.room.recommend",
|
|
50
|
-
body: queryBody(session.userId, { pageNo, pageSize:
|
|
129
|
+
body: queryBody(session.userId, { pageNo, pageSize: PAGE_SIZE2 }),
|
|
51
130
|
acceptBusiness: ebBusinessSuccess
|
|
52
131
|
});
|
|
53
132
|
const { rows } = extractEbRows(response);
|
|
@@ -68,11 +147,15 @@ function normalizeRoom(row) {
|
|
|
68
147
|
maxNum: toNumber(main.allow_maxnum),
|
|
69
148
|
place: toText(main.place).trim(),
|
|
70
149
|
equipments: toText(main.equipments).trim(),
|
|
71
|
-
mrType: toText(main.mr_type).trim()
|
|
150
|
+
mrType: toText(main.mr_type).trim(),
|
|
151
|
+
// ⛔ 2026-11-04 真机发现:以前没映射 room_desc,`roomDesc` 永远是 undefined,
|
|
152
|
+
// 于是「带客户优先接待类」里**按描述文案判定**那一半从来没生效过(只有名称含「接待」的能命中)。
|
|
153
|
+
// 例:广州会议室四 的描述「用来接待重要来宾…」明明写着,却被当普通房间。
|
|
154
|
+
roomDesc: toText(main.room_desc).trim()
|
|
72
155
|
};
|
|
73
156
|
}
|
|
74
157
|
async function loadRooms(env, options = {}) {
|
|
75
|
-
const key = `rooms-${await cacheScopeSuffix(env)}`;
|
|
158
|
+
const key = `rooms-v3-${await cacheScopeSuffix(env)}`;
|
|
76
159
|
const warnings = [];
|
|
77
160
|
if (!options.refresh) {
|
|
78
161
|
const cached = await readCache(env, key, { ttlMs: ROOMS_TTL_MS });
|
|
@@ -88,11 +171,11 @@ async function loadRooms(env, options = {}) {
|
|
|
88
171
|
}
|
|
89
172
|
const rooms = [];
|
|
90
173
|
let requests = 0;
|
|
91
|
-
for (let pageNo = 1; pageNo <=
|
|
174
|
+
for (let pageNo = 1; pageNo <= MAX_PAGES2; pageNo += 1) {
|
|
92
175
|
const page = await fetchRoomsPage(env, pageNo);
|
|
93
176
|
requests += page.requests;
|
|
94
177
|
rooms.push(...page.rows.map(normalizeRoom).filter((room) => room.id !== ""));
|
|
95
|
-
if (page.rows.length <
|
|
178
|
+
if (page.rows.length < PAGE_SIZE2) break;
|
|
96
179
|
}
|
|
97
180
|
if (rooms.length === 0) {
|
|
98
181
|
warnings.push("\u4F1A\u8BAE\u5BA4\u5217\u8868\u4E3A\u7A7A\uFF08\u6216\u5F53\u524D\u8D26\u53F7\u65E0\u4F1A\u8BAE\u5BA4\u8BFB\u53D6\u6743\u9650\uFF09\u2014\u2014\u65E0\u6CD5\u63A8\u8350\uFF0C\u8BF7\u6539\u4E3A\u624B\u5DE5\u6307\u5B9A\u4F1A\u8BAE\u5BA4");
|
|
@@ -121,22 +204,27 @@ async function loadFrequentRooms(env, options = {}) {
|
|
|
121
204
|
const counts = /* @__PURE__ */ new Map();
|
|
122
205
|
let requests = 0;
|
|
123
206
|
try {
|
|
124
|
-
const { getMeetingOperation } = await import("./registry-
|
|
207
|
+
const { getMeetingOperation } = await import("./registry-BKBZPBAJ.js");
|
|
125
208
|
const listOp = getMeetingOperation("meeting.eb.meeting.list");
|
|
126
|
-
|
|
209
|
+
let seen = 0;
|
|
210
|
+
let total = 0;
|
|
211
|
+
for (let pageNo = 1; pageNo <= 40; pageNo += 1) {
|
|
127
212
|
const page = await listOp.handler(
|
|
128
|
-
{ creator: userId, begindatetime: sinceText, pageNo, pageSize:
|
|
213
|
+
{ creator: userId, begindatetime: sinceText, pageNo, pageSize: 200 },
|
|
129
214
|
env
|
|
130
215
|
);
|
|
131
216
|
requests += 1;
|
|
132
217
|
const rows = page?.data?.rows ?? [];
|
|
218
|
+
if (rows.length === 0) break;
|
|
219
|
+
total = Number(page?.data?.total ?? total) || total;
|
|
133
220
|
for (const row of rows) {
|
|
134
221
|
const main = row?.mainTable ?? row ?? {};
|
|
135
222
|
const name = toText(main.address).trim();
|
|
136
223
|
if (!name) continue;
|
|
137
224
|
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
138
225
|
}
|
|
139
|
-
|
|
226
|
+
seen += rows.length;
|
|
227
|
+
if (total > 0 && seen >= total) break;
|
|
140
228
|
}
|
|
141
229
|
} catch (error) {
|
|
142
230
|
warnings.push(`\u5E38\u7528\u4F1A\u8BAE\u5BA4\u7EDF\u8BA1\u5931\u8D25\uFF08${String(error?.message ?? error).slice(0, 80)}\uFF09\uFF1A\u672C\u6B21\u6309\u5168\u91CF\u4F1A\u8BAE\u5BA4\u6392\u5E8F\u63A8\u8350`);
|
|
@@ -150,13 +238,13 @@ async function fetchBusyRoomIds(env, begin, end) {
|
|
|
150
238
|
const ids = /* @__PURE__ */ new Set();
|
|
151
239
|
let requests = 0;
|
|
152
240
|
const usageQuery = { enddatetime: end, begindatetime: begin };
|
|
153
|
-
for (let pageNo = 1; pageNo <=
|
|
241
|
+
for (let pageNo = 1; pageNo <= MAX_PAGES2; pageNo += 1) {
|
|
154
242
|
const response = await env.host.request({
|
|
155
243
|
method: "POST",
|
|
156
244
|
path: `${EB_BASE}/getFormDataList/query_roomusage_list`,
|
|
157
245
|
operation: "meeting.eb.room.recommend",
|
|
158
246
|
query: usageQuery,
|
|
159
|
-
body: queryBody(session.userId, { pageNo, pageSize:
|
|
247
|
+
body: queryBody(session.userId, { pageNo, pageSize: PAGE_SIZE2 }),
|
|
160
248
|
acceptBusiness: ebBusinessSuccess
|
|
161
249
|
});
|
|
162
250
|
requests += 1;
|
|
@@ -166,7 +254,7 @@ async function fetchBusyRoomIds(env, begin, end) {
|
|
|
166
254
|
const roomId = toText(main.address ?? main.room_id).trim();
|
|
167
255
|
if (roomId) ids.add(roomId);
|
|
168
256
|
}
|
|
169
|
-
if (rows.length <
|
|
257
|
+
if (rows.length < PAGE_SIZE2) break;
|
|
170
258
|
}
|
|
171
259
|
return { ids, requests };
|
|
172
260
|
}
|
|
@@ -182,13 +270,14 @@ async function recommendRooms(env, input) {
|
|
|
182
270
|
}
|
|
183
271
|
const frequent = await loadFrequentRooms(env, { refresh: input.refreshFrequent === true });
|
|
184
272
|
warnings.push(...frequent.warnings);
|
|
185
|
-
const busy = await fetchBusyRoomIds(env, input.beginDatetime, input.endDatetime);
|
|
273
|
+
const busy = input.dayUsages ? { ids: busyRoomIds(input.dayUsages, input.beginDatetime, input.endDatetime), requests: 0 } : await fetchBusyRoomIds(env, input.beginDatetime, input.endDatetime);
|
|
186
274
|
const frequentRank = /* @__PURE__ */ new Map();
|
|
187
275
|
frequent.order.forEach((item, index) => {
|
|
188
276
|
frequentRank.set(item.name, { rank: index, count: item.count });
|
|
189
277
|
});
|
|
190
278
|
const memberCount = input.memberCount && input.memberCount > 0 ? input.memberCount : null;
|
|
191
279
|
const requirement = input.requirement ?? {};
|
|
280
|
+
if (input.hasCustomer === true) requirement.hasCustomer = true;
|
|
192
281
|
const usable = roomData.rooms.filter((room) => room.status === "0");
|
|
193
282
|
let busyCount = 0;
|
|
194
283
|
const candidates = [];
|
|
@@ -235,6 +324,16 @@ async function recommendRooms(env, input) {
|
|
|
235
324
|
reasons.push(`\u8BBE\u5907\u542B\u300C${requirement.equipmentsKeyword}\u300D`);
|
|
236
325
|
score += 10;
|
|
237
326
|
}
|
|
327
|
+
if (requirement.hasCustomer === true) {
|
|
328
|
+
const desc = String(room.roomDesc ?? "").trim();
|
|
329
|
+
const nameHit = room.name.match(/(接待|招待|贵宾|商务|vip)/iu);
|
|
330
|
+
const descHit = desc.match(/(接待|招待|贵宾|商务|vip)/iu);
|
|
331
|
+
const hostHit = nameHit ?? descHit;
|
|
332
|
+
if (hostHit) {
|
|
333
|
+
reasons.push(`\u5E26\u5BA2\u6237\u4F18\u5148\uFF1A${descHit ? `\u63CF\u8FF0\u542B\u300C${desc.slice(0, 30)}\u300D` : `\u540D\u79F0\u542B\u300C${hostHit[1]}\u300D`}`);
|
|
334
|
+
score += 35;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
238
337
|
if (isBusy) {
|
|
239
338
|
reasons.push("\u8BE5\u65F6\u6BB5\u5DF2\u88AB\u5360\u7528\uFF08\u6309 includeBusy \u4E00\u5E76\u8FD4\u56DE\uFF09");
|
|
240
339
|
score -= 100;
|
|
@@ -248,6 +347,7 @@ async function recommendRooms(env, input) {
|
|
|
248
347
|
place: room.place,
|
|
249
348
|
equipments: room.equipments,
|
|
250
349
|
roomAttrText: room.roomAttrText,
|
|
350
|
+
...String(room.roomDesc ?? "").trim() !== "" ? { roomDesc: String(room.roomDesc).trim() } : {},
|
|
251
351
|
frequentCount: freq?.count ?? 0,
|
|
252
352
|
score,
|
|
253
353
|
reasons
|
|
@@ -321,6 +421,7 @@ var ebRoomRecommendOperation = {
|
|
|
321
421
|
mrType: { type: "string", description: "\u4F1A\u8BAE\u5BA4\u7C7B\u578B id\uFF08mr_type\uFF09" },
|
|
322
422
|
roomAttr: { type: "string", enum: ["0", "1", "2"], description: "\u4F1A\u8BAE\u5BA4\u5C5E\u6027\uFF1A0 \u5B9E\u4F53 / 1 \u865A\u62DF / 2 \u7EC4\u5408" },
|
|
323
423
|
equipmentsKeyword: { type: "string", description: "\u8BBE\u5907\u5173\u952E\u8BCD\uFF08\u6A21\u7CCA\u5339\u914D equipments\uFF0C\u5982 \u6295\u5F71/\u89C6\u9891\uFF09" },
|
|
424
|
+
hasCustomer: { type: "boolean", description: "\u672C\u6B21\u4F1A\u8BAE\u662F\u5426\u5E26\u5BA2\u6237\uFF1Atrue \u65F6\u4F18\u5148\u63A8\u8350\u63A5\u5F85\u7C7B\u4F1A\u8BAE\u5BA4\uFF08\u63CF\u8FF0/\u540D\u79F0\u542B \u63A5\u5F85/\u62DB\u5F85/\u5BA2\u6237/\u5546\u52A1/\u8D35\u5BBE \u7684\u52A0\u5206\uFF09" },
|
|
324
425
|
topN: { type: "number", description: "\u8FD4\u56DE\u5019\u9009\u6570\u91CF\uFF08\u9ED8\u8BA4 3\uFF0C\u6700\u591A 10\uFF09" },
|
|
325
426
|
refresh: { type: "boolean", description: "true=\u5237\u65B0\u4F1A\u8BAE\u5BA4\u5168\u91CF\u4E0E\u5E38\u7528\u8BB0\u5F55\u7F13\u5B58" },
|
|
326
427
|
includeBusy: { type: "boolean", description: "true=\u628A\u8BE5\u65F6\u6BB5\u5DF2\u88AB\u5360\u7528\u7684\u4F1A\u8BAE\u5BA4\u4E5F\u8FD4\u56DE\uFF08\u6392\u5728\u6700\u540E\uFF0C\u5E26\u8BF4\u660E\uFF09" }
|
|
@@ -339,7 +440,9 @@ var ebRoomRecommendOperation = {
|
|
|
339
440
|
...args.nameKeyword ? { nameKeyword: String(args.nameKeyword) } : {},
|
|
340
441
|
...args.mrType ? { mrType: String(args.mrType) } : {},
|
|
341
442
|
...args.roomAttr ? { roomAttr: String(args.roomAttr) } : {},
|
|
342
|
-
...args.equipmentsKeyword ? { equipmentsKeyword: String(args.equipmentsKeyword) } : {}
|
|
443
|
+
...args.equipmentsKeyword ? { equipmentsKeyword: String(args.equipmentsKeyword) } : {},
|
|
444
|
+
// 2026-11-04 修:以前漏了它 —— 用户传了 hasCustomer,打分却读 requirement.hasCustomer,永远 false
|
|
445
|
+
...args.hasCustomer === true ? { hasCustomer: true } : {}
|
|
343
446
|
},
|
|
344
447
|
...args.topN !== void 0 ? { topN: Number(args.topN) } : {},
|
|
345
448
|
...args.refresh === true ? { refreshRooms: true, refreshFrequent: true } : {},
|
|
@@ -360,7 +463,7 @@ async function rememberFrequentRoom(env, roomId) {
|
|
|
360
463
|
const id = String(roomId ?? "").trim();
|
|
361
464
|
if (!id) return false;
|
|
362
465
|
const scope = await cacheScopeSuffix(env);
|
|
363
|
-
const roomsCached = await readCache(env, `rooms-${scope}`, { ttlMs: ROOMS_TTL_MS });
|
|
466
|
+
const roomsCached = await readCache(env, `rooms-v3-${scope}`, { ttlMs: ROOMS_TTL_MS });
|
|
364
467
|
const name = roomsCached?.data?.find((room) => room.id === id)?.name ?? "";
|
|
365
468
|
if (!name) return false;
|
|
366
469
|
const session = await env.host.getSession().catch(() => null);
|
|
@@ -378,6 +481,10 @@ async function rememberFrequentRoom(env, roomId) {
|
|
|
378
481
|
}
|
|
379
482
|
|
|
380
483
|
export {
|
|
484
|
+
dayOf,
|
|
485
|
+
filterUsages,
|
|
486
|
+
loadDayUsages,
|
|
487
|
+
invalidateDayUsages,
|
|
381
488
|
loadRooms,
|
|
382
489
|
loadFrequentRooms,
|
|
383
490
|
recommendRooms,
|
|
@@ -3,15 +3,20 @@ const require = __esbuildCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
E10AuthSession,
|
|
5
5
|
E10_AUTH_REQUIRED_MESSAGE,
|
|
6
|
+
E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE,
|
|
7
|
+
E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE,
|
|
6
8
|
E10_XIAOE_RECOVERY_FAILED_MESSAGE,
|
|
7
9
|
getActiveProfile,
|
|
8
10
|
hasXiaoEEnv,
|
|
9
11
|
isXiaoERuntimeAgent,
|
|
12
|
+
lastXiaoEFailure,
|
|
13
|
+
readErrorCauseCode,
|
|
10
14
|
readProfileConfig,
|
|
11
15
|
resolveXiaoEPreferredBaseUrl,
|
|
12
16
|
startFetchTiming,
|
|
17
|
+
summarizeXiaoEFailureKind,
|
|
13
18
|
tryXiaoEUnifiedLogin
|
|
14
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FOAA27U5.js";
|
|
15
20
|
import {
|
|
16
21
|
CliError
|
|
17
22
|
} from "./chunk-LUSPKZKY.js";
|
|
@@ -165,8 +170,25 @@ function canAutomaticallyRecoverXiaoE(ctx, currentSession) {
|
|
|
165
170
|
if (options.auth) return false;
|
|
166
171
|
return hasXiaoEEnv(ctx.env || process.env, options) || currentSession?.loginSource === "xiaoe-unified" || isXiaoERuntimeAgent(currentSession?.agentType);
|
|
167
172
|
}
|
|
173
|
+
function recoveryLogger(ctx) {
|
|
174
|
+
const options = globalOptions(ctx);
|
|
175
|
+
if (options.json || options.quiet || options.verbose !== true) return void 0;
|
|
176
|
+
const adapter = ctx.logger;
|
|
177
|
+
if (!adapter || typeof adapter.debug !== "function") return void 0;
|
|
178
|
+
return {
|
|
179
|
+
info: (message) => adapter.debug(message),
|
|
180
|
+
warn: (message) => adapter.debug(message)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
168
183
|
async function recoverXiaoEAuthSession(ctx, currentSession) {
|
|
169
|
-
|
|
184
|
+
return (await recoverXiaoEAuthSessionWithDiagnostics(ctx, currentSession)).session;
|
|
185
|
+
}
|
|
186
|
+
async function recoverXiaoEAuthSessionWithDiagnostics(ctx, currentSession) {
|
|
187
|
+
const emptyOutcome = () => ({
|
|
188
|
+
session: null,
|
|
189
|
+
diagnostics: { attemptedSteps: [] }
|
|
190
|
+
});
|
|
191
|
+
if (!canAutomaticallyRecoverXiaoE(ctx, currentSession)) return emptyOutcome();
|
|
170
192
|
const options = globalOptions(ctx);
|
|
171
193
|
const profile = options.profile || getActiveProfile();
|
|
172
194
|
const config = readProfileConfig(profile);
|
|
@@ -179,6 +201,7 @@ async function recoverXiaoEAuthSession(ctx, currentSession) {
|
|
|
179
201
|
${baseUrl}`;
|
|
180
202
|
const existing = recoveryInFlight.get(key);
|
|
181
203
|
if (existing) return existing;
|
|
204
|
+
const diagnostics = { attemptedSteps: [] };
|
|
182
205
|
const recovery = (async () => {
|
|
183
206
|
const login = await tryXiaoEUnifiedLogin({
|
|
184
207
|
env: ctx.env,
|
|
@@ -187,11 +210,11 @@ ${baseUrl}`;
|
|
|
187
210
|
allowBundledEnvScript: true,
|
|
188
211
|
allowTokenScript: true,
|
|
189
212
|
tenantKeyFallback: currentSession?.tenantKey || config.tenantKey,
|
|
190
|
-
profileHint: profile
|
|
191
|
-
|
|
192
|
-
|
|
213
|
+
profileHint: profile,
|
|
214
|
+
diagnostics,
|
|
215
|
+
logger: recoveryLogger(ctx)
|
|
193
216
|
});
|
|
194
|
-
return login?.session || null;
|
|
217
|
+
return { session: login?.session || null, diagnostics };
|
|
195
218
|
})();
|
|
196
219
|
recoveryInFlight.set(key, recovery);
|
|
197
220
|
try {
|
|
@@ -208,21 +231,56 @@ function sameE10SessionIdentity(current, recovered) {
|
|
|
208
231
|
}
|
|
209
232
|
|
|
210
233
|
// src/internal/e10/context.ts
|
|
234
|
+
function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
|
|
235
|
+
const failureKind = summarizeXiaoEFailureKind(diagnostics);
|
|
236
|
+
const lastFailure = lastXiaoEFailure(diagnostics);
|
|
237
|
+
const networkUnavailable = failureKind === "network";
|
|
238
|
+
const hostCredentialMissing = diagnostics?.clientType === "cloud" && diagnostics.platformCredentialDetected === false && diagnostics.attemptedSteps.includes("platform_token:missing") && diagnostics.attemptedSteps.includes("environment_map:empty");
|
|
239
|
+
const details = diagnostics ? {
|
|
240
|
+
...diagnostics.baseUrl ? { baseUrl: diagnostics.baseUrl } : {},
|
|
241
|
+
...diagnostics.clientType ? { clientType: diagnostics.clientType } : {},
|
|
242
|
+
...diagnostics.platformCredentialDetected === void 0 ? {} : { platformCredentialDetected: diagnostics.platformCredentialDetected },
|
|
243
|
+
attemptedSteps: diagnostics.attemptedSteps,
|
|
244
|
+
...diagnostics.lastError ? { lastError: diagnostics.lastError } : {},
|
|
245
|
+
...failureKind ? { errorKind: failureKind } : {},
|
|
246
|
+
...lastFailure ? { failureStage: lastFailure.stage } : {},
|
|
247
|
+
...diagnostics.failures?.length ? { failures: diagnostics.failures } : {},
|
|
248
|
+
...hostCredentialMissing ? { reason: "host_credential_not_injected" } : {},
|
|
249
|
+
...resultSessionExpired ? { resultSessionExpired: true } : {}
|
|
250
|
+
} : void 0;
|
|
251
|
+
return Object.assign(
|
|
252
|
+
new CliError(
|
|
253
|
+
networkUnavailable ? E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE : hostCredentialMissing ? E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE : E10_XIAOE_RECOVERY_FAILED_MESSAGE,
|
|
254
|
+
3 /* AuthError */
|
|
255
|
+
),
|
|
256
|
+
{
|
|
257
|
+
type: "authentication",
|
|
258
|
+
subtype: networkUnavailable ? "xiaoe_network_unavailable" : "xiaoe_credential_unavailable",
|
|
259
|
+
// 网络错误是可重试的;凭证缺失/被拒重试也一样失败,不能让调用方空转。
|
|
260
|
+
retryable: networkUnavailable,
|
|
261
|
+
stage: lastFailure?.stage || "xiaoe_unified_login",
|
|
262
|
+
...details ? { details } : {}
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
211
266
|
async function getE10Session(ctx, load = {}) {
|
|
212
267
|
const options = ctx.getGlobalOptions();
|
|
213
268
|
return E10AuthSession.fromOptions(options, ctx.cwd, load);
|
|
214
269
|
}
|
|
215
270
|
async function requireE10Session(ctx, load = {}) {
|
|
216
271
|
let session = await getE10Session(ctx, load);
|
|
272
|
+
if (session?.isExpired() && canAutomaticallyRecoverXiaoE(ctx, session)) {
|
|
273
|
+
const outcome = await recoverXiaoEAuthSessionWithDiagnostics(ctx, session).catch(() => null);
|
|
274
|
+
session = outcome?.session || null;
|
|
275
|
+
if (!session || session.isExpired()) {
|
|
276
|
+
throw xiaoERecoveryFailedError(outcome?.diagnostics, session?.isExpired() === true);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
217
279
|
if (!session && canAutomaticallyRecoverXiaoE(ctx)) {
|
|
218
|
-
|
|
280
|
+
const outcome = await recoverXiaoEAuthSessionWithDiagnostics(ctx).catch(() => null);
|
|
281
|
+
session = outcome?.session || null;
|
|
219
282
|
if (!session) {
|
|
220
|
-
throw
|
|
221
|
-
type: "authentication",
|
|
222
|
-
subtype: "xiaoe_credential_unavailable",
|
|
223
|
-
retryable: false,
|
|
224
|
-
stage: "xiaoe_unified_login"
|
|
225
|
-
});
|
|
283
|
+
throw xiaoERecoveryFailedError(outcome?.diagnostics);
|
|
226
284
|
}
|
|
227
285
|
}
|
|
228
286
|
if (!session) {
|
|
@@ -282,6 +340,17 @@ var E10RequestRuntime = class {
|
|
|
282
340
|
return this.request({ ...request, responseType: "binary" });
|
|
283
341
|
}
|
|
284
342
|
async request(request) {
|
|
343
|
+
if (this.session.isExpired?.()) {
|
|
344
|
+
const recovered = await this.recoverExpiredSession(this.session.eteamsId);
|
|
345
|
+
if (!recovered || this.session.isExpired?.()) {
|
|
346
|
+
throw new E10ApiError(
|
|
347
|
+
"authentication",
|
|
348
|
+
"session_expired",
|
|
349
|
+
E10_XIAOE_RECOVERY_FAILED_MESSAGE,
|
|
350
|
+
{ exitCode: 3 /* AuthError */, retryable: false }
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
285
354
|
const mutable = this.prepareRequest(request);
|
|
286
355
|
try {
|
|
287
356
|
await this.runBeforeRequest(mutable, this.sessionContext());
|
|
@@ -391,6 +460,7 @@ var E10RequestRuntime = class {
|
|
|
391
460
|
return false;
|
|
392
461
|
}
|
|
393
462
|
if (!recovered) return false;
|
|
463
|
+
if (recovered.isExpired?.()) return false;
|
|
394
464
|
if (!sameE10SessionIdentity(this.session, recovered)) {
|
|
395
465
|
throw new E10ApiError(
|
|
396
466
|
"authentication",
|
|
@@ -521,13 +591,16 @@ var E10RequestRuntime = class {
|
|
|
521
591
|
if (error instanceof Error && error.name === "AbortError") {
|
|
522
592
|
throw new E10ApiError("network", "timeout", `\u8BF7\u6C42\u8D85\u65F6\uFF08${timeoutMs}ms\uFF09`, {
|
|
523
593
|
retryable: false,
|
|
524
|
-
exitCode: 4 /* NetworkError
|
|
594
|
+
exitCode: 4 /* NetworkError */,
|
|
595
|
+
details: { timeoutMs }
|
|
525
596
|
});
|
|
526
597
|
}
|
|
527
598
|
const message = error instanceof Error ? error.message : String(error);
|
|
599
|
+
const causeCode = readErrorCauseCode(error);
|
|
528
600
|
throw new E10ApiError("network", "transport", `\u8BF7\u6C42\u5931\u8D25\uFF1A${message}`, {
|
|
529
601
|
retryable: true,
|
|
530
|
-
exitCode: 4 /* NetworkError
|
|
602
|
+
exitCode: 4 /* NetworkError */,
|
|
603
|
+
...causeCode ? { details: { causeCode } } : {}
|
|
531
604
|
});
|
|
532
605
|
} finally {
|
|
533
606
|
clearTimeout(timer);
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
createE10RequestRuntime,
|
|
5
5
|
isE10SessionExpiredResponse,
|
|
6
6
|
requireE10Session
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SA6VBIHY.js";
|
|
8
8
|
import {
|
|
9
9
|
E10_REAUTH_GUIDANCE,
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FOAA27U5.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError
|
|
15
15
|
} from "./chunk-LUSPKZKY.js";
|
|
@@ -2,13 +2,13 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
meetingStateDir
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GEWYMQME.js";
|
|
6
6
|
import {
|
|
7
7
|
SCHEMA_ID,
|
|
8
8
|
meetingSuccess,
|
|
9
9
|
meetingValidationError,
|
|
10
10
|
schemaOf
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-72CKAUAG.js";
|
|
12
12
|
|
|
13
13
|
// src/shortcuts/meeting/operations/attachment-content.ts
|
|
14
14
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
createE10RequestRuntime,
|
|
11
11
|
isE10SessionExpiredResponse,
|
|
12
12
|
requireE10Session
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SA6VBIHY.js";
|
|
14
14
|
import {
|
|
15
15
|
getActiveProfile
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FOAA27U5.js";
|
|
17
17
|
|
|
18
18
|
// src/shortcuts/ebuilder-form/host.ts
|
|
19
19
|
import { randomUUID } from "node:crypto";
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
findCommonFreeSlots,
|
|
8
8
|
meetingEbConflictOperations,
|
|
9
9
|
runEbConflictCheck
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-QKNKR4RH.js";
|
|
11
|
+
import "./chunk-72CKAUAG.js";
|
|
12
12
|
import "./chunk-LUSPKZKY.js";
|
|
13
13
|
import "./chunk-BUSC6UAE.js";
|
|
14
14
|
export {
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SA6VBIHY.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FOAA27U5.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SA6VBIHY.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FOAA27U5.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -413,6 +413,11 @@ function unwrapData(response) {
|
|
|
413
413
|
if (!response || typeof response !== "object") return response;
|
|
414
414
|
return response.data;
|
|
415
415
|
}
|
|
416
|
+
function coworkViewUrl(baseUrl, id, mobile = false) {
|
|
417
|
+
if (!id) return null;
|
|
418
|
+
const base = String(baseUrl || "").replace(/\/+$/, "");
|
|
419
|
+
return `${base}/${mobile ? "mobile" : "sp"}/cowork/view/${id}`;
|
|
420
|
+
}
|
|
416
421
|
function normalizePaged(response) {
|
|
417
422
|
const data = unwrapData(response);
|
|
418
423
|
const page = {};
|
|
@@ -1133,7 +1138,9 @@ var itemCreateApply = {
|
|
|
1133
1138
|
itemName,
|
|
1134
1139
|
sectionId,
|
|
1135
1140
|
principal,
|
|
1136
|
-
endTime
|
|
1141
|
+
endTime,
|
|
1142
|
+
viewUrl: coworkViewUrl(lease.baseUrl, data.id),
|
|
1143
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, data.id, true)
|
|
1137
1144
|
});
|
|
1138
1145
|
}
|
|
1139
1146
|
};
|
|
@@ -1225,7 +1232,7 @@ var itemActionApply = {
|
|
|
1225
1232
|
}
|
|
1226
1233
|
throw error;
|
|
1227
1234
|
}
|
|
1228
|
-
return coworkSuccess("cowork.item.action.apply", { action, id, result: unwrapData(response) ?? null });
|
|
1235
|
+
return coworkSuccess("cowork.item.action.apply", { action, id, result: unwrapData(response) ?? null, viewUrl: coworkViewUrl(lease.baseUrl, id) });
|
|
1229
1236
|
}
|
|
1230
1237
|
};
|
|
1231
1238
|
var ITEM_FLAGS = ["hide", "vote"];
|
|
@@ -1297,7 +1304,7 @@ var itemFlagApply = {
|
|
|
1297
1304
|
form,
|
|
1298
1305
|
operation: "cowork.item.flag.apply"
|
|
1299
1306
|
});
|
|
1300
|
-
return coworkSuccess("cowork.item.flag.apply", { action, id, result: unwrapData(response) ?? null });
|
|
1307
|
+
return coworkSuccess("cowork.item.flag.apply", { action, id, result: unwrapData(response) ?? null, viewUrl: coworkViewUrl(lease.baseUrl, id) });
|
|
1301
1308
|
}
|
|
1302
1309
|
};
|
|
1303
1310
|
var coworkItemWriteOperations = [
|
|
@@ -1433,7 +1440,9 @@ var discussPublishApply = {
|
|
|
1433
1440
|
return coworkSuccess("cowork.discuss.publish.apply", {
|
|
1434
1441
|
coworkId,
|
|
1435
1442
|
sectionId,
|
|
1436
|
-
status: data.status ?? root?.status ?? null
|
|
1443
|
+
status: data.status ?? root?.status ?? null,
|
|
1444
|
+
viewUrl: coworkViewUrl(lease.baseUrl, coworkId),
|
|
1445
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, coworkId, true)
|
|
1437
1446
|
});
|
|
1438
1447
|
}
|
|
1439
1448
|
};
|
|
@@ -1568,7 +1577,9 @@ var discussActionApply = {
|
|
|
1568
1577
|
action,
|
|
1569
1578
|
coworkId,
|
|
1570
1579
|
discussId,
|
|
1571
|
-
result: unwrapData(response) ?? null
|
|
1580
|
+
result: unwrapData(response) ?? null,
|
|
1581
|
+
viewUrl: coworkViewUrl(lease.baseUrl, coworkId),
|
|
1582
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, coworkId, true)
|
|
1572
1583
|
});
|
|
1573
1584
|
}
|
|
1574
1585
|
};
|
|
@@ -1723,7 +1734,9 @@ var memberActionApply = {
|
|
|
1723
1734
|
action,
|
|
1724
1735
|
coworkId,
|
|
1725
1736
|
userIds: action === "join" ? void 0 : String(form.ids).split(","),
|
|
1726
|
-
result: unwrapData(response) ?? null
|
|
1737
|
+
result: unwrapData(response) ?? null,
|
|
1738
|
+
viewUrl: coworkViewUrl(lease.baseUrl, coworkId),
|
|
1739
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, coworkId, true)
|
|
1727
1740
|
});
|
|
1728
1741
|
}
|
|
1729
1742
|
};
|
|
@@ -2162,7 +2175,9 @@ var permAddApply = {
|
|
|
2162
2175
|
permissionId,
|
|
2163
2176
|
userId,
|
|
2164
2177
|
userName,
|
|
2165
|
-
result: unwrapData(response) ?? null
|
|
2178
|
+
result: unwrapData(response) ?? null,
|
|
2179
|
+
viewUrl: coworkViewUrl(lease.baseUrl, coworkId),
|
|
2180
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, coworkId, true)
|
|
2166
2181
|
});
|
|
2167
2182
|
}
|
|
2168
2183
|
};
|
|
@@ -2277,7 +2292,9 @@ var permRemoveApply = {
|
|
|
2277
2292
|
pkId,
|
|
2278
2293
|
removed: stillThere === false ? true : void 0,
|
|
2279
2294
|
verified: stillThere !== null,
|
|
2280
|
-
result: unwrapData(response) ?? null
|
|
2295
|
+
result: unwrapData(response) ?? null,
|
|
2296
|
+
viewUrl: coworkViewUrl(lease.baseUrl, coworkId),
|
|
2297
|
+
mobileViewUrl: coworkViewUrl(lease.baseUrl, coworkId, true)
|
|
2281
2298
|
});
|
|
2282
2299
|
}
|
|
2283
2300
|
};
|