weaver-work-cli 0.1.32 → 0.1.36

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.
Files changed (211) hide show
  1. package/README.md +2 -2
  2. package/dist/chunks/{archive-UMGX72K6.js → archive-XBVH7JU7.js} +2 -2
  3. package/dist/chunks/{archive-oa-N2IYBLF3.js → archive-oa-MZM3EKFQ.js} +2 -2
  4. package/dist/chunks/{asset-GLEGKFG5.js → asset-4XO7UOUW.js} +2 -2
  5. package/dist/chunks/{attachment-content-AQNX5N3S.js → attachment-content-VXSWANAC.js} +3 -2
  6. package/dist/chunks/{blog-E44OTVDA.js → blog-PGZKOPSC.js} +2 -2
  7. package/dist/chunks/{caizhilian-DQUFZXZL.js → caizhilian-BH4ZVGUN.js} +2 -2
  8. package/dist/chunks/{calendar-JKPIRKFD.js → calendar-MXEMTIO4.js} +2 -2
  9. package/dist/chunks/{chunk-QWY6PGL6.js → chunk-2LV74IWP.js} +361 -56
  10. package/dist/chunks/chunk-3SO6QL6U.js +73 -0
  11. package/dist/chunks/chunk-5DQEEGCC.js +229 -0
  12. package/dist/chunks/{chunk-G3QJULO2.js → chunk-6LLJFKJE.js} +1 -1
  13. package/dist/chunks/{chunk-C6R3B2ML.js → chunk-BPE37FPB.js} +35 -7
  14. package/dist/chunks/chunk-BYATLLEF.js +68 -0
  15. package/dist/chunks/chunk-BYBSCN4X.js +932 -0
  16. package/dist/chunks/{chunk-CVZ2JOSW.js → chunk-F746NKNF.js} +1 -1
  17. package/dist/chunks/{chunk-GCG2NMWR.js → chunk-HXJQI5NM.js} +4 -2
  18. package/dist/chunks/{chunk-YRVDW4WN.js → chunk-I6QGIBDM.js} +2 -2
  19. package/dist/chunks/{chunk-H7J4DC5R.js → chunk-JCSN3JGM.js} +2 -2
  20. package/dist/chunks/{chunk-2GA5ZIQL.js → chunk-JNG42JKG.js} +30 -1
  21. package/dist/chunks/{chunk-DW6AUUKS.js → chunk-JUXVYKII.js} +9 -4
  22. package/dist/chunks/{chunk-6RKD4DRZ.js → chunk-JYKABYCV.js} +2 -2
  23. package/dist/chunks/{chunk-6EFWDL7Y.js → chunk-NCOVUAZK.js} +2 -2
  24. package/dist/chunks/{chunk-E4Z23GHM.js → chunk-QHFANTX7.js} +1114 -904
  25. package/dist/chunks/{ebuilder-form-V5FG2EHC.js → chunk-QYGO5EE2.js} +22 -1148
  26. package/dist/chunks/{chunk-IURUFGZK.js → chunk-T72N74ZT.js} +50 -33
  27. package/dist/chunks/{chunk-H6XSTSLM.js → chunk-TC6MZAO3.js} +137 -204
  28. package/dist/chunks/{chunk-WKI2FBIQ.js → chunk-VPUTVEMC.js} +737 -341
  29. package/dist/chunks/{chunk-WSKBSQ2U.js → chunk-VPXOPQJI.js} +2 -2
  30. package/dist/chunks/chunk-WXFPWCXG.js +774 -0
  31. package/dist/chunks/{chunk-4YC43QQ4.js → chunk-XMGSYD6S.js} +4 -4
  32. package/dist/chunks/conflict-JAB2LJEZ.js +21 -0
  33. package/dist/chunks/continuation-RN6PZN2M.js +11 -0
  34. package/dist/chunks/contract-XI2EEIZU.js +9110 -0
  35. package/dist/chunks/cowork-SCPGLBA4.js +2527 -0
  36. package/dist/chunks/ebuilder-form-EYLHNOTA.js +121 -0
  37. package/dist/chunks/{ehr-HMFY6VIL.js → ehr-EAP77IMT.js} +1344 -27
  38. package/dist/chunks/{esb-ZYSVB7SG.js → esb-2TGGXEE7.js} +4 -4
  39. package/dist/chunks/{fna-B7RKPAZD.js → fna-2X7ZE7BU.js} +13 -8
  40. package/dist/chunks/{host-OCH2BCCV.js → host-C6EL2RKL.js} +3 -3
  41. package/dist/chunks/{host-45WED2KK.js → host-I4NRK4MX.js} +3 -3
  42. package/dist/chunks/{host-I4Z6BFYX.js → host-Q4LZGCRU.js} +3 -3
  43. package/dist/chunks/host-UEI5FGDM.js +23 -0
  44. package/dist/chunks/{host-KNZ52LJZ.js → host-XCLDDXKQ.js} +3 -3
  45. package/dist/chunks/{hrm-2KAZGUHI.js → hrm-YXERJM76.js} +3 -3
  46. package/dist/chunks/{im-ACJJWH4U.js → im-A4VZN2TQ.js} +88 -12
  47. package/dist/chunks/{invoice-ZK3WCX2U.js → invoice-2Z6YPMIS.js} +3 -3
  48. package/dist/chunks/{jiuchuanhui-5PQD3IL2.js → jiuchuanhui-AR5GMKZB.js} +2 -2
  49. package/dist/chunks/{lazy-dispatch-JQXBW3GM.js → lazy-dispatch-QXW7P4X3.js} +4 -4
  50. package/dist/chunks/{mail-S2HDDXO2.js → mail-7GZ6CPBJ.js} +45 -24
  51. package/dist/chunks/{meeting-QVN3I37L.js → meeting-3NMGA3MB.js} +278 -43
  52. package/dist/chunks/{okr-QNG4VC2Q.js → okr-BZ6XUOAG.js} +2 -2
  53. package/dist/chunks/operations-5QL3AECO.js +11 -0
  54. package/dist/chunks/{plan-A25EMW6U.js → plan-DR5CMUYP.js} +2 -2
  55. package/dist/chunks/{project-G6XV66DZ.js → project-6J63MK33.js} +2 -2
  56. package/dist/chunks/{registry-DC6KR3NH.js → registry-KDD7DHNK.js} +4 -4
  57. package/dist/chunks/{registry-2VLUAESA.js → registry-OZSMDVPP.js} +2 -2
  58. package/dist/chunks/{registry-7C5UMIPL.js → registry-TKX2E7C7.js} +2 -2
  59. package/dist/chunks/{registry-TI3CIUXF.js → registry-VRTNC6UR.js} +8 -6
  60. package/dist/chunks/{room-recommend-WRTHO6Y2.js → room-recommend-XCWRMB5P.js} +4 -3
  61. package/dist/chunks/{schedule-KFIITGSK.js → schedule-IVBICP32.js} +4 -3
  62. package/dist/chunks/{workflow-DJ7SYWAF.js → workflow-D74NFK3C.js} +179 -6
  63. package/dist/index.js +35 -25
  64. package/dist/internal/e10/auth-recovery.js +14 -4
  65. package/dist/internal/e10/fetch-timing.js +31 -0
  66. package/dist/internal/e10/request-runtime.js +5 -0
  67. package/dist/shortcuts/contract/host.js +34 -59
  68. package/dist/shortcuts/cowork/continuation.js +70 -0
  69. package/dist/shortcuts/cowork/errors.js +59 -0
  70. package/dist/shortcuts/cowork/host.js +180 -0
  71. package/dist/shortcuts/cowork/index.js +166 -0
  72. package/dist/shortcuts/cowork/manifest.js +65 -0
  73. package/dist/shortcuts/cowork/operations/discuss-write.js +277 -0
  74. package/dist/shortcuts/cowork/operations/item-write.js +380 -0
  75. package/dist/shortcuts/cowork/operations/member-write.js +283 -0
  76. package/dist/shortcuts/cowork/operations/permission-write.js +286 -0
  77. package/dist/shortcuts/cowork/operations/read.js +423 -0
  78. package/dist/shortcuts/cowork/operations/registry.js +39 -0
  79. package/dist/shortcuts/cowork/operations/review-write.js +157 -0
  80. package/dist/shortcuts/cowork/operations/shared.js +215 -0
  81. package/dist/shortcuts/cowork/operations/types.js +39 -0
  82. package/dist/shortcuts/cowork/operations.js +19 -0
  83. package/dist/shortcuts/ehr/host.js +4 -1
  84. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +757 -0
  85. package/dist/shortcuts/ehr/operations/recruit-position.js +367 -0
  86. package/dist/shortcuts/ehr/operations/recruit-stats.js +133 -0
  87. package/dist/shortcuts/ehr/operations/recruit-write.js +43 -16
  88. package/dist/shortcuts/ehr/operations/recruit.js +182 -10
  89. package/dist/shortcuts/ehr/operations/registry.js +6 -0
  90. package/dist/shortcuts/fna/operations/expense-chart.js +19 -7
  91. package/dist/shortcuts/im/diagnostics.js +97 -0
  92. package/dist/shortcuts/im/host.js +58 -31
  93. package/dist/shortcuts/im/index.js +7 -2
  94. package/dist/shortcuts/im/operations/at-mention.js +127 -0
  95. package/dist/shortcuts/im/operations/file-user.js +10 -2
  96. package/dist/shortcuts/im/operations/group-read.js +26 -5
  97. package/dist/shortcuts/im/operations/group-write.js +35 -28
  98. package/dist/shortcuts/im/operations/msg-sync.js +7 -2
  99. package/dist/shortcuts/im/operations/msg-write.js +76 -10
  100. package/dist/shortcuts/im/operations/quote-mention.js +119 -0
  101. package/dist/shortcuts/im/operations/session.js +1 -1
  102. package/dist/shortcuts/im/operations/shared.js +10 -0
  103. package/dist/shortcuts/im/operations/types.js +13 -0
  104. package/dist/shortcuts/index.js +10 -0
  105. package/dist/shortcuts/mail/host.js +12 -1
  106. package/dist/shortcuts/mail/operations/types.js +17 -2
  107. package/dist/shortcuts/meeting/host.js +27 -34
  108. package/dist/shortcuts/meeting/index.js +79 -1
  109. package/dist/shortcuts/meeting/manifest.js +10 -0
  110. package/dist/shortcuts/meeting/operations/create.js +4 -1
  111. package/dist/shortcuts/meeting/operations/eb/catalog.js +10 -0
  112. package/dist/shortcuts/meeting/operations/eb/conflict.js +84 -8
  113. package/dist/shortcuts/meeting/operations/eb/create-flow.js +1195 -140
  114. package/dist/shortcuts/meeting/operations/eb/factory.js +170 -8
  115. package/dist/shortcuts/meeting/operations/eb/index.js +16 -3
  116. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +50 -5
  117. package/dist/shortcuts/meeting/operations/eb-fallback.js +163 -0
  118. package/dist/shortcuts/meeting/operations/env.js +99 -46
  119. package/dist/shortcuts/meeting/operations/form-fields.js +110 -0
  120. package/dist/shortcuts/meeting/operations/invitation.js +79 -20
  121. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  122. package/dist/shortcuts/meeting/operations/standard-guard.js +71 -0
  123. package/dist/shortcuts/meeting/operations.js +16 -0
  124. package/dist/shortcuts/workflow/endpoints.js +8 -3
  125. package/dist/shortcuts/workflow/index.js +110 -1
  126. package/dist/shortcuts/workflow/operations/form.js +204 -36
  127. package/dist/shortcuts/workflow/operations/read.js +104 -23
  128. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +448 -0
  129. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +106 -0
  130. package/dist/shortcuts/workflow/operations/todoSmartConvert/businessRules.js +47 -0
  131. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +30 -23
  132. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
  133. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
  134. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +2 -1
  135. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +2 -4
  136. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +138 -181
  137. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +12 -7
  138. package/dist/shortcuts/workflow/operations.js +23 -1
  139. package/docs/e10-auth.md +1 -1
  140. package/docs/ehr.md +1 -1
  141. package/docs/fna.md +2 -1
  142. package/docs/im.md +8 -1
  143. package/docs/todo-smart-convert/README.md +1 -1
  144. package/docs/todo-smart-convert/data-contract.md +2 -2
  145. package/docs/todo-smart-convert/subgroup-rules.md +6 -0
  146. package/package.json +1 -1
  147. package/skill-template/business-info.json +18 -0
  148. package/skill-template/domains/cowork.md +14 -0
  149. package/skill-template/domains/yimiaoban.md +3 -3
  150. package/skill-template/skill-template.md +1 -1
  151. package/skills/weaver-e10-blog/SKILL.md +5 -5
  152. package/skills/weaver-e10-caizhilian/SKILL.md +5 -5
  153. package/skills/weaver-e10-calendar/SKILL.md +5 -5
  154. package/skills/weaver-e10-cowork/SKILL.md +101 -0
  155. package/skills/weaver-e10-cowork/references/cowork-read.md +90 -0
  156. package/skills/weaver-e10-cowork/references/cowork-write.md +131 -0
  157. package/skills/weaver-e10-cowork/references/safety-boundaries.md +45 -0
  158. package/skills/weaver-e10-esb/SKILL.md +5 -5
  159. package/skills/weaver-e10-hrm/SKILL.md +5 -5
  160. package/skills/weaver-e10-jinchengda/SKILL.md +2 -2
  161. package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -5
  162. package/skills/weaver-e10-jucailin/SKILL.md +38 -14
  163. package/skills/weaver-e10-jucailin/references/recruit-create.md +104 -0
  164. package/skills/weaver-e10-jucailin/references/recruit-read.md +25 -0
  165. package/skills/weaver-e10-jucailin/references/recruit-write.md +13 -0
  166. package/skills/weaver-e10-jucailin/references/salary.md +15 -11
  167. package/skills/weaver-e10-mail/SKILL.md +17 -14
  168. package/skills/weaver-e10-meeting/SKILL.md +442 -46
  169. package/skills/weaver-e10-meeting/references/meeting-eb.md +135 -3
  170. package/skills/weaver-e10-meeting/references/meeting-invitation.md +28 -2
  171. package/skills/weaver-e10-meeting/references/meeting-queries.md +9 -6
  172. package/skills/weaver-e10-meeting/references/meeting-verification.md +8 -6
  173. package/skills/weaver-e10-meeting.zip +0 -0
  174. package/skills/weaver-e10-okr/SKILL.md +5 -5
  175. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  176. package/skills/weaver-e10-plan/SKILL.md +5 -5
  177. package/skills/weaver-e10-qiyecheng/SKILL.md +5 -2
  178. package/skills/weaver-e10-qiyecheng/references/catalog.md +2 -2
  179. package/skills/weaver-e10-qiyecheng/references/expense-chart.md +15 -1
  180. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +22 -21
  181. package/skills/weaver-e10-shared/SKILL.md +12 -12
  182. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -4
  183. package/skills/weaver-e10-wenshuding/SKILL.md +5 -5
  184. package/skills/weaver-e10-workflow/SKILL.md +29 -5
  185. package/skills/weaver-e10-workflow/aigroup/default.json +88 -0
  186. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +66 -14
  187. package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -1
  188. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  189. package/skills/weaver-e10-workflow/references/workflow-query.md +12 -10
  190. package/skills/weaver-e10-workflow/references/workflow-view.md +2 -2
  191. package/skills/weaver-e10-workflow/tools/todo-serve.cjs +239 -0
  192. package/skills/weaver-e10-workflow/{scripts → tools}/todo-summary.cjs +218 -28
  193. package/skills/weaver-e10-yepiaotong/SKILL.md +10 -8
  194. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +7 -7
  195. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +10 -10
  196. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +40 -37
  197. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +4 -4
  198. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +27 -38
  199. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
  200. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +37 -29
  201. package/skills/weaver-e10-yimiaoban/SKILL.md +156 -33
  202. package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -1
  203. package/skills/weaver-e10-yimiaoban/references/error-codes.md +5 -1
  204. package/skills/weaver-e10-yimiaoban/references/group-read.md +5 -1
  205. package/skills/weaver-e10-yimiaoban/references/group-write.md +6 -4
  206. package/skills/weaver-e10-yimiaoban/references/msg-read.md +1 -0
  207. package/skills/weaver-e10-yimiaoban/references/msg-write.md +34 -2
  208. package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +5 -2
  209. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +79 -58
  210. package/skills/weaver-e10-yimiaoban/references/user-remind.md +2 -2
  211. package/skills/weaver-e10-ziguanjia/SKILL.md +5 -5
@@ -0,0 +1,73 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ ebuilderValidationError
5
+ } from "./chunk-BYATLLEF.js";
6
+
7
+ // src/shortcuts/ebuilder-form/continuation.ts
8
+ import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
9
+ import { existsSync } from "node:fs";
10
+ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
11
+ import { homedir } from "node:os";
12
+ import { resolve } from "node:path";
13
+ function stateRoot(ctx) {
14
+ const configured = ctx?.config?.path();
15
+ if (configured) return resolve(configured, "..");
16
+ return process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), ".weaver-work-cli");
17
+ }
18
+ async function loadKey(ctx) {
19
+ const keysDir = resolve(stateRoot(ctx), "keys");
20
+ const filename = resolve(keysDir, "ebuilder-form-continuation.key");
21
+ await mkdir(keysDir, { recursive: true, mode: 448 });
22
+ if (existsSync(filename)) return readFile(filename);
23
+ const key = randomBytes(32);
24
+ try {
25
+ await writeFile(filename, key, { flag: "wx", mode: 384 });
26
+ if (process.platform !== "win32") await chmod(filename, 384).catch(() => void 0);
27
+ return key;
28
+ } catch {
29
+ return readFile(filename);
30
+ }
31
+ }
32
+ function encode(value) {
33
+ return Buffer.from(JSON.stringify(value)).toString("base64url");
34
+ }
35
+ function signature(payload, key) {
36
+ return createHmac("sha256", key).update(payload).digest("base64url");
37
+ }
38
+ function createEbuilderFormContinuationSigner(ctx) {
39
+ return {
40
+ async issue(payload, ttlMs = 10 * 6e4) {
41
+ const issuedAt = Date.now();
42
+ const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
43
+ const sig = signature(body, await loadKey(ctx));
44
+ return `${body}.${sig}`;
45
+ },
46
+ async verify(token, expectedOperation) {
47
+ if (typeof token !== "string" || !token.includes(".")) {
48
+ throw ebuilderValidationError("continuation_invalid", "continuation \u65E0\u6548");
49
+ }
50
+ const [body, provided] = token.split(".");
51
+ const expected = signature(body, await loadKey(ctx));
52
+ const valid = provided.length === expected.length && timingSafeEqual(Buffer.from(provided), Buffer.from(expected));
53
+ if (!valid) throw ebuilderValidationError("continuation_invalid", "continuation \u7B7E\u540D\u6821\u9A8C\u5931\u8D25");
54
+ let value;
55
+ try {
56
+ value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
57
+ } catch {
58
+ throw ebuilderValidationError("continuation_invalid", "continuation \u5185\u5BB9\u65E0\u6CD5\u89E3\u6790");
59
+ }
60
+ if (value.operation !== expectedOperation) {
61
+ throw ebuilderValidationError("continuation_mismatch", "continuation \u4E0D\u5C5E\u4E8E\u5F53\u524D\u64CD\u4F5C");
62
+ }
63
+ if (!Number.isSafeInteger(value.expiresAt) || value.expiresAt < Date.now()) {
64
+ throw ebuilderValidationError("continuation_expired", "continuation \u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare");
65
+ }
66
+ return value;
67
+ }
68
+ };
69
+ }
70
+
71
+ export {
72
+ createEbuilderFormContinuationSigner
73
+ };
@@ -0,0 +1,229 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ SCHEMA_ID,
5
+ ebBusinessSuccess,
6
+ meetingSuccess,
7
+ meetingValidationError
8
+ } from "./chunk-TC6MZAO3.js";
9
+
10
+ // src/shortcuts/meeting/operations/env.ts
11
+ import { existsSync } from "node:fs";
12
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
13
+ import { homedir } from "node:os";
14
+ import { resolve } from "node:path";
15
+ var EB_SMOKE_PATH = "/api/ebuilder/form/formdata/v2/getFormDataList/query_meeting_baseset";
16
+ var STD_CALENDAR_PATH = "/api/meeting/detail/getCalendarBaseData";
17
+ function stateRoot(ctx) {
18
+ const configured = ctx?.config?.path();
19
+ if (configured) return resolve(configured, "..");
20
+ return process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), ".weaver-work-cli");
21
+ }
22
+ function meetingStateDir(ctx) {
23
+ return resolve(stateRoot(ctx), "meeting");
24
+ }
25
+ function cacheFile(ctx) {
26
+ return resolve(stateRoot(ctx), "meeting", "env-mode.json");
27
+ }
28
+ function emptyCache() {
29
+ return { schemaVersion: 1, environments: {} };
30
+ }
31
+ async function readCache(ctx) {
32
+ const file = cacheFile(ctx);
33
+ if (!existsSync(file)) return emptyCache();
34
+ try {
35
+ const parsed = JSON.parse(await readFile(file, "utf8"));
36
+ if (!parsed || typeof parsed !== "object" || !parsed.environments) return emptyCache();
37
+ return parsed;
38
+ } catch {
39
+ return emptyCache();
40
+ }
41
+ }
42
+ async function writeCache(ctx, baseUrl, mode, smokePath) {
43
+ try {
44
+ const file = cacheFile(ctx);
45
+ await mkdir(resolve(file, ".."), { recursive: true });
46
+ const cache = await readCache(ctx);
47
+ cache.environments[baseUrl] = { mode, smokePath, detectedAt: (/* @__PURE__ */ new Date()).toISOString() };
48
+ await writeFile(file, JSON.stringify(cache, null, 2), "utf8");
49
+ return void 0;
50
+ } catch (error) {
51
+ return `\u73AF\u5883\u6A21\u5F0F\u7F13\u5B58\u5199\u5165\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD\u672C\u6B21\u7ED3\u679C\uFF0C\u4E0B\u6B21\u4F1A\u91CD\u65B0\u5192\u70DF\uFF09\uFF1A${error instanceof Error ? error.message : String(error)}`;
52
+ }
53
+ }
54
+ var DEFAULT_MEETING_MODE = "eb";
55
+ function describeEnvError(error) {
56
+ if (error instanceof Error) {
57
+ return `${error.type ?? "api"}/${error.subtype ?? "error"}: ${error.message}`;
58
+ }
59
+ return String(error);
60
+ }
61
+ async function probeAndPersist(host, ctx, knownEbError, options = {}) {
62
+ const persist = options.persist !== false;
63
+ const session = await host.getSession();
64
+ let ebError = knownEbError;
65
+ if (ebError === void 0) {
66
+ try {
67
+ await host.request({
68
+ method: "POST",
69
+ path: EB_SMOKE_PATH,
70
+ operation: "meeting.env.detect",
71
+ // EB list 的 datajson 内必须出现 mainTable 节点(空对象即可):缺失时服务端报
72
+ // “mainTable解析异常,请参照文档修正数据格式”,冒烟会**假失败**并把 EB 环境误判为
73
+ // 标准版(2026-09-20 真机复现)。
74
+ body: { datajson: { mainTable: {}, header: { operator: session.userId } } },
75
+ // EB 响应不含 code/status(形如 {datajson:{datas:[...]}}),默认的 isBusinessSuccess
76
+ // 会判为 false → 冒烟假失败 → EB 环境被误判为标准版。
77
+ acceptBusiness: ebBusinessSuccess
78
+ });
79
+ const warning = await writeCache(ctx, session.baseUrl, "eb", EB_SMOKE_PATH);
80
+ return { mode: "eb", smokePath: EB_SMOKE_PATH, warning };
81
+ } catch (error) {
82
+ ebError = error;
83
+ }
84
+ }
85
+ try {
86
+ await host.request({
87
+ method: "GET",
88
+ path: STD_CALENDAR_PATH,
89
+ operation: "meeting.env.detect"
90
+ });
91
+ const warning = persist ? await writeCache(ctx, session.baseUrl, "standard", STD_CALENDAR_PATH) : void 0;
92
+ return {
93
+ mode: "standard",
94
+ smokePath: STD_CALENDAR_PATH,
95
+ ebSmokeFailed: true,
96
+ ebSmokeError: describeEnvError(ebError),
97
+ warning
98
+ };
99
+ } catch (stdError) {
100
+ throw meetingValidationError(
101
+ "env_unavailable",
102
+ "\u5F53\u524D\u73AF\u5883 EB \u7248\u4E0E\u6807\u51C6\u7248\u4F1A\u8BAE\u63A5\u53E3\u5192\u70DF\u5747\u672A\u901A\u8FC7\uFF0C\u8BF7\u786E\u8BA4\u4F1A\u8BAE\u5E94\u7528\u5DF2\u5B89\u88C5\u4E14\u63A5\u53E3\u5DF2\u914D\u7F6E\u5B8C\u6574",
103
+ {
104
+ eb: describeEnvError(ebError),
105
+ standard: describeEnvError(stdError)
106
+ }
107
+ );
108
+ }
109
+ }
110
+ async function resolveMeetingEnvMode(host, ctx, options = {}) {
111
+ const session = await host.getSession();
112
+ if (options.refresh !== true && String(process.env.WEAVER_MEETING_LOCK_MODE ?? "").trim().toLowerCase() === "eb") {
113
+ return { mode: "eb", smokePath: EB_SMOKE_PATH, fromCache: false, assumed: true, locked: true };
114
+ }
115
+ if (options.refresh === true) {
116
+ return { ...await probeAndPersist(host, ctx), fromCache: false };
117
+ }
118
+ const cache = await readCache(ctx);
119
+ const cached = cache.environments[session.baseUrl];
120
+ if (cached && (cached.mode === "eb" || cached.mode === "standard")) {
121
+ return {
122
+ mode: cached.mode,
123
+ smokePath: cached.smokePath,
124
+ fromCache: true,
125
+ detectedAt: cached.detectedAt
126
+ };
127
+ }
128
+ return { mode: DEFAULT_MEETING_MODE, smokePath: EB_SMOKE_PATH, fromCache: false, assumed: true };
129
+ }
130
+ async function degradeMeetingEnvToStandard(host, ctx, ebError, options = {}) {
131
+ const probed = await probeAndPersist(host, ctx, ebError, options);
132
+ return {
133
+ mode: "standard",
134
+ smokePath: probed.smokePath,
135
+ ebError: probed.ebSmokeError ?? describeEnvError(ebError),
136
+ ...probed.warning ? { warning: probed.warning } : {}
137
+ };
138
+ }
139
+ var meetingEnvDetect = {
140
+ name: "meeting.env.detect",
141
+ resource: "env",
142
+ method: "detect",
143
+ action: "meeting.env.detect",
144
+ summary: "\u63A2\u6D4B\u5F53\u524D\u73AF\u5883\u4F1A\u8BAE\u6A21\u5F0F\uFF1A**\u65E0\u63A2\u6D4B\u7ED3\u8BBA\u65F6\u76F4\u63A5\u6309 EB \u7248\u8FD4\u56DE**\uFF08`assumed=true`\uFF0C\u4E0D\u5192\u70DF\u3001\u4E0D\u5199\u7F13\u5B58\uFF09\uFF1BEB \u8D70\u4E0D\u901A\u65F6\u7531 EB \u8C03\u7528\u94FE\u81EA\u52A8\u5B9E\u63A2\u6807\u51C6\u7248\u5E76\u628A `standard` \u56FA\u5316\u8FDB\u7F13\u5B58\uFF1B`refresh=true` \u5F3A\u5236\u91CD\u65B0\u5192\u70DF",
145
+ capability: "env",
146
+ risk: "read",
147
+ inputSchema: {
148
+ type: "object",
149
+ additionalProperties: false,
150
+ properties: {
151
+ refresh: { type: "boolean", description: 'true=\u5FFD\u7565\u7F13\u5B58\u5F3A\u5236\u91CD\u65B0\u5192\u70DF\u5E76\u66F4\u65B0\u7F13\u5B58\uFF08\u7528\u6237\u8BF4"\u91CD\u65B0\u63A2\u6D4B/\u5237\u65B0\u6A21\u5F0F"\u65F6\u4F7F\u7528\uFF09' },
152
+ profileId: SCHEMA_ID
153
+ }
154
+ },
155
+ handler: async (args, { host, ctx }) => {
156
+ const result = await resolveMeetingEnvMode(host, ctx, { refresh: args.refresh === true });
157
+ const { warning, ...data } = result;
158
+ return meetingSuccess(
159
+ "meeting.env.detect",
160
+ data,
161
+ warning ? { warnings: [warning] } : void 0
162
+ );
163
+ }
164
+ };
165
+ var meetingCalendarBase = {
166
+ name: "meeting.calendar.base",
167
+ resource: "env",
168
+ method: "calendar.base",
169
+ action: "meeting.calendar.base",
170
+ summary: "\u67E5\u8BE2\u65E5\u5386/\u5EFA\u4F1A\u57FA\u7840\u4FE1\u606F\uFF08getCalendarBaseData\uFF09\uFF1AonlyFlowCreate / workFlowBaseIds / repeatWorkFlowBaseIds / existWorkFlow",
171
+ capability: "env",
172
+ risk: "read",
173
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
174
+ handler: async (_args, { host }) => {
175
+ const response = await host.request({
176
+ method: "GET",
177
+ path: STD_CALENDAR_PATH,
178
+ operation: "meeting.calendar.base"
179
+ });
180
+ const createBaseData = response?.data?.createBaseData ?? response?.createBaseData ?? null;
181
+ return meetingSuccess("meeting.calendar.base", { createBaseData, raw: response });
182
+ }
183
+ };
184
+ var meetingDetailField = {
185
+ name: "meeting.detail.field",
186
+ resource: "meeting",
187
+ method: "detail.field",
188
+ action: "meeting.detail.field",
189
+ summary: "\u67E5\u8BE2\u4F1A\u8BAE\u8BE6\u60C5\u8868\u5355\u7ED3\u6784\u4E0E options\uFF08getMeetingDetailField\uFF09\uFF1Aid / operateType / fromWorkflow / isReadOnly",
190
+ capability: "meeting",
191
+ risk: "read",
192
+ inputSchema: {
193
+ type: "object",
194
+ additionalProperties: false,
195
+ properties: {
196
+ id: SCHEMA_ID,
197
+ operateType: { type: "string", description: "\u64CD\u4F5C\u7C7B\u578B\uFF0C\u5982 SUBMIT/UPDATE/CHANGE" },
198
+ fromWorkflow: { type: "integer", enum: [0, 1] },
199
+ isReadOnly: { type: "integer", enum: [0, 1] }
200
+ },
201
+ required: ["id"]
202
+ },
203
+ handler: async (args, { host }) => {
204
+ const query = { id: String(args.id) };
205
+ if (args.operateType !== void 0) query.operateType = args.operateType;
206
+ if (args.fromWorkflow !== void 0) query.fromWorkflow = args.fromWorkflow;
207
+ if (args.isReadOnly !== void 0) query.isReadOnly = args.isReadOnly;
208
+ const response = await host.request({
209
+ method: "GET",
210
+ path: "/api/meeting/detail/getMeetingDetailField",
211
+ operation: "meeting.detail.field",
212
+ query
213
+ });
214
+ return meetingSuccess("meeting.detail.field", { data: response?.data ?? response });
215
+ }
216
+ };
217
+ var meetingEnvOperations = [
218
+ meetingEnvDetect,
219
+ meetingCalendarBase,
220
+ meetingDetailField
221
+ ];
222
+
223
+ export {
224
+ meetingStateDir,
225
+ readCache,
226
+ resolveMeetingEnvMode,
227
+ degradeMeetingEnvToStandard,
228
+ meetingEnvOperations
229
+ };
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  isEsbFlowUnavailable
5
- } from "./chunk-YRVDW4WN.js";
5
+ } from "./chunk-I6QGIBDM.js";
6
6
  import {
7
7
  esbValidationError
8
8
  } from "./chunk-GPMFD4RD.js";
@@ -4,7 +4,7 @@ import {
4
4
  cacheScopeSuffix,
5
5
  readCache,
6
6
  writeCache
7
- } from "./chunk-CVZ2JOSW.js";
7
+ } from "./chunk-F746NKNF.js";
8
8
  import {
9
9
  EB_BASE,
10
10
  SCHEMA_DATETIME_MINUTE,
@@ -13,10 +13,11 @@ import {
13
13
  meetingSuccess,
14
14
  queryBody,
15
15
  schemaOf
16
- } from "./chunk-H6XSTSLM.js";
16
+ } from "./chunk-TC6MZAO3.js";
17
17
 
18
18
  // src/shortcuts/meeting/operations/eb/room-recommend.ts
19
19
  var ROOMS_TTL_MS = 24 * 60 * 60 * 1e3;
20
+ var STALE_NOTICE_MS = 4 * 60 * 60 * 1e3;
20
21
  var FREQUENT_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
21
22
  var FREQUENT_WINDOW_DAYS = 180;
22
23
  var PAGE_SIZE = 100;
@@ -120,7 +121,7 @@ async function loadFrequentRooms(env, options = {}) {
120
121
  const counts = /* @__PURE__ */ new Map();
121
122
  let requests = 0;
122
123
  try {
123
- const { getMeetingOperation } = await import("./registry-TI3CIUXF.js");
124
+ const { getMeetingOperation } = await import("./registry-VRTNC6UR.js");
124
125
  const listOp = getMeetingOperation("meeting.eb.meeting.list");
125
126
  for (let pageNo = 1; pageNo <= 5; pageNo += 1) {
126
127
  const page = await listOp.handler(
@@ -174,6 +175,11 @@ async function recommendRooms(env, input) {
174
175
  const topN = Math.max(1, Math.min(10, input.topN ?? 3));
175
176
  const roomData = await loadRooms(env, { refresh: input.refreshRooms === true });
176
177
  warnings.push(...roomData.warnings);
178
+ if (roomData.fromCache && (roomData.ageSeconds ?? 0) * 1e3 > STALE_NOTICE_MS) {
179
+ warnings.push(
180
+ `\u4F1A\u8BAE\u5BA4\u53F0\u8D26\u6765\u81EA ${Math.round((roomData.ageSeconds ?? 0) / 3600)} \u5C0F\u65F6\u524D\u7684\u7F13\u5B58\uFF08\u5171 ${roomData.rooms.length} \u95F4\uFF09\u3002\u5982\u679C\u6700\u8FD1\u65B0\u5EFA/\u5BFC\u5165/\u5C01\u5B58\u8FC7\u4F1A\u8BAE\u5BA4\uFF0C\u8BF7\u5E26 \`refresh: true\` \u91CD\u65B0\u67E5\u8BE2\uFF0C\u5426\u5219\u770B\u5230\u7684\u662F\u65E7\u6E05\u5355\u3002`
181
+ );
182
+ }
177
183
  const frequent = await loadFrequentRooms(env, { refresh: input.refreshFrequent === true });
178
184
  warnings.push(...frequent.warnings);
179
185
  const busy = await fetchBusyRoomIds(env, input.beginDatetime, input.endDatetime);
@@ -192,9 +198,10 @@ async function recommendRooms(env, input) {
192
198
  busyCount += 1;
193
199
  if (!input.includeBusy) continue;
194
200
  }
201
+ let belowMinCapacity = false;
195
202
  if (memberCount !== null) {
196
203
  if (room.maxNum > 0 && room.maxNum < memberCount) continue;
197
- if (room.minNum > 0 && room.minNum > memberCount) continue;
204
+ if (room.minNum > 0 && room.minNum > memberCount) belowMinCapacity = true;
198
205
  }
199
206
  if (requirement.roomAttr && room.roomAttr !== requirement.roomAttr) continue;
200
207
  if (requirement.mrType && room.mrType !== requirement.mrType) continue;
@@ -216,6 +223,10 @@ async function recommendRooms(env, input) {
216
223
  reasons.push(`\u5BB9\u91CF ${room.maxNum} \u4EBA`);
217
224
  score += 5;
218
225
  }
226
+ if (belowMinCapacity) {
227
+ reasons.push(`\u8BE5\u623F\u95F4\u5EFA\u8BAE\u81F3\u5C11 ${room.minNum} \u4EBA\u4F7F\u7528\uFF08\u672C\u6B21 ${memberCount} \u4EBA\uFF0C\u672A\u8FBE\u5EFA\u8BAE\u4E0B\u9650\uFF0C\u5982\u53EF\u7528\u8BF7\u81EA\u884C\u786E\u8BA4\uFF09`);
228
+ score -= 15;
229
+ }
219
230
  if (requirement.placeKeyword) {
220
231
  reasons.push(`\u5730\u70B9\u5339\u914D\u300C${requirement.placeKeyword}\u300D`);
221
232
  score += 10;
@@ -249,10 +260,27 @@ async function recommendRooms(env, input) {
249
260
  if (leftCap !== rightCap) return leftCap - rightCap;
250
261
  return left.name.localeCompare(right.name, "zh-Hans-CN");
251
262
  });
263
+ if (candidates.length === 0 && roomData.fromCache && input.refreshRooms !== true) {
264
+ const retried = await recommendRooms(env, { ...input, refreshRooms: true, refreshFrequent: true });
265
+ return {
266
+ ...retried,
267
+ meta: { ...retried.meta, cacheRetried: true },
268
+ warnings: [
269
+ `\u7F13\u5B58\u91CC\u7684\u4F1A\u8BAE\u5BA4\u51D1\u4E0D\u51FA\u5019\u9009\uFF08\u7F13\u5B58 ${Math.round((roomData.ageSeconds ?? 0) / 60)} \u5206\u949F\u524D\uFF0C${roomData.rooms.length} \u95F4\uFF09\u2192 \u5DF2\u5F3A\u5236\u91CD\u65B0\u62C9\u53D6\u53F0\u8D26\u540E\u91CD\u7B97`,
270
+ ...retried.warnings
271
+ ]
272
+ };
273
+ }
252
274
  if (candidates.length === 0) {
253
- warnings.push(
254
- `\u6CA1\u6709\u6EE1\u8DB3\u6761\u4EF6\u7684\u7A7A\u95F2\u4F1A\u8BAE\u5BA4\uFF08\u5171 ${roomData.rooms.length} \u95F4\uFF0C\u53EF\u7528 ${usable.length} \u95F4\uFF0C\u8BE5\u65F6\u6BB5\u88AB\u5360\u7528 ${busyCount} \u95F4${memberCount ? `\uFF0C\u4EBA\u6570 ${memberCount}` : ""}\uFF09\u2014\u2014\u8BF7\u653E\u5BBD\u4EBA\u6570/\u5730\u70B9/\u8BBE\u5907\u8981\u6C42\uFF0C\u6216\u6539\u4E3A\u7EBF\u4E0A\u4F1A\u8BAE\u3002`
255
- );
275
+ if (roomData.rooms.length === 0) {
276
+ warnings.push(
277
+ 'EB \u4F1A\u8BAE\u5BA4\u8868\uFF08`uf_mt_room_base`\uFF09\u67E5\u4E0D\u5230\u4EFB\u4F55\u8BB0\u5F55\uFF08roomsTotal=0\uFF09\u3002\u53EF\u80FD\u662F\uFF1A\u2460 \u8BE5\u73AF\u5883\u786E\u5B9E\u8FD8\u6CA1\u5EFA\u8FC7\u4F1A\u8BAE\u5BA4\uFF1B\u2461 \u4F1A\u8BAE\u5E94\u7528\u7684\u300C\u4F1A\u8BAE\u5BA4\u5217\u8868\u300D\u63A5\u53E3/\u89C6\u56FE\u672A\u914D\u7F6E\uFF08`query_meeting_room_list` \u8BFB\u4E0D\u5230\u6570\u636E\uFF0C\u4F46\u8868\u91CC\u53EF\u80FD\u6709\uFF09\u3002**\u7EDD\u5BF9\u4E0D\u8981\u6539\u7528 `meeting.room.list`** \u2014\u2014 \u90A3\u662F\u6807\u51C6\u7248\u4F1A\u8BAE\u5E94\u7528\u7684\u4F1A\u8BAE\u5BA4\uFF0C\u4E0E EB \u662F\u4E24\u5957\u5B8C\u5168\u4E0D\u901A\u7684\u6570\u636E\uFF0C\u62FF\u7ED9\u7528\u6237\u7B49\u4E8E\u51ED\u7A7A\u634F\u9020\u623F\u95F4\u3002\u8BF7\u5982\u5B9E\u544A\u77E5\u7528\u6237"EB \u4F1A\u8BAE\u5BA4\u67E5\u4E0D\u5230"\uFF0C\u5E76\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u4F1A\u8BAE\u5BA4\u914D\u7F6E\uFF0C\u6216\u8BA9\u7528\u6237\u76F4\u63A5\u63D0\u4F9B\u4F1A\u8BAE\u5BA4\u540D\u79F0/\u6539\u7528\u7EBF\u4E0A\u4F1A\u8BAE\u3002'
278
+ );
279
+ } else {
280
+ warnings.push(
281
+ `\u6CA1\u6709\u6EE1\u8DB3\u6761\u4EF6\u7684\u7A7A\u95F2\u4F1A\u8BAE\u5BA4\uFF08\u5171 ${roomData.rooms.length} \u95F4\uFF0C\u53EF\u7528 ${usable.length} \u95F4\uFF0C\u8BE5\u65F6\u6BB5\u88AB\u5360\u7528 ${busyCount} \u95F4${memberCount ? `\uFF0C\u4EBA\u6570 ${memberCount}` : ""}\uFF09\u2014\u2014\u8BF7\u653E\u5BBD\u4EBA\u6570/\u5730\u70B9/\u8BBE\u5907\u8981\u6C42\uFF0C\u6216\u6539\u4E3A\u7EBF\u4E0A\u4F1A\u8BAE\u3002`
282
+ );
283
+ }
256
284
  }
257
285
  return {
258
286
  best: candidates[0] ?? null,
@@ -0,0 +1,68 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ CliError
5
+ } from "./chunk-LUSPKZKY.js";
6
+
7
+ // src/shortcuts/ebuilder-form/errors.ts
8
+ var EbuilderFormCliError = class extends CliError {
9
+ type;
10
+ subtype;
11
+ code;
12
+ retryable;
13
+ stage;
14
+ details;
15
+ constructor(type, subtype, message, options = {}) {
16
+ super(message, options.exitCode ?? 5 /* InternalError */);
17
+ this.name = "EbuilderFormCliError";
18
+ this.type = type;
19
+ this.subtype = subtype;
20
+ this.code = options.code;
21
+ this.retryable = options.retryable ?? false;
22
+ this.stage = options.stage;
23
+ this.details = options.details;
24
+ }
25
+ };
26
+ function ebuilderValidationError(subtype, message, details) {
27
+ return new EbuilderFormCliError("validation", subtype, message, {
28
+ details,
29
+ exitCode: 2 /* UsageError */
30
+ });
31
+ }
32
+ function ebuilderAuthError(subtype, message, details) {
33
+ return new EbuilderFormCliError("authentication", subtype, message, {
34
+ details,
35
+ exitCode: 3 /* AuthError */
36
+ });
37
+ }
38
+ function ebuilderBusinessError(subtype, message, options = {}) {
39
+ return new EbuilderFormCliError("api", subtype, message, {
40
+ code: options.code,
41
+ details: options.details,
42
+ retryable: options.retryable ?? false,
43
+ stage: options.stage,
44
+ exitCode: 1 /* GeneralError */
45
+ });
46
+ }
47
+ function ebuilderNetworkError(subtype, message, options = {}) {
48
+ return new EbuilderFormCliError("network", subtype, message, {
49
+ details: options.details,
50
+ retryable: options.retryable ?? true,
51
+ stage: options.stage,
52
+ exitCode: 4 /* NetworkError */
53
+ });
54
+ }
55
+ function ebuilderConfirmationError(action, details) {
56
+ return new EbuilderFormCliError("confirmation", "required", "\u8BE5 eBuilder \u8868\u5355\u5199\u64CD\u4F5C\u9700\u8981\u660E\u786E\u786E\u8BA4", {
57
+ details: { action, ...details },
58
+ exitCode: 10 /* ConfirmationRequired */
59
+ });
60
+ }
61
+
62
+ export {
63
+ ebuilderValidationError,
64
+ ebuilderAuthError,
65
+ ebuilderBusinessError,
66
+ ebuilderNetworkError,
67
+ ebuilderConfirmationError
68
+ };