weaver-work-cli 0.1.39 → 0.1.40

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 (103) hide show
  1. package/README.md +4 -2
  2. package/dist/chunks/{archive-ENZYBBME.js → archive-JHTONRST.js} +2 -2
  3. package/dist/chunks/{archive-oa-YWLEC5V4.js → archive-oa-FCHLCPHC.js} +2 -2
  4. package/dist/chunks/{asset-OOV6DWPA.js → asset-RLIHC7DB.js} +2 -2
  5. package/dist/chunks/{asset-idle-RE632MY5.js → asset-idle-KVOFTLCP.js} +2 -2
  6. package/dist/chunks/{attachment-content-RWN2FCLL.js → attachment-content-RZYDB3MB.js} +3 -3
  7. package/dist/chunks/{blog-PEPOJAL7.js → blog-42OZTJNP.js} +2 -2
  8. package/dist/chunks/{caizhilian-WYIQDVPJ.js → caizhilian-KRK547K5.js} +2 -2
  9. package/dist/chunks/{calendar-CIARBAOX.js → calendar-RTWAMKHD.js} +2 -2
  10. package/dist/chunks/{chunk-L4N7B7ZD.js → chunk-4CTESSKI.js} +4 -4
  11. package/dist/chunks/{chunk-XXJOSZTQ.js → chunk-4TEDNCON.js} +43 -5
  12. package/dist/chunks/chunk-57IECMWX.js +487 -0
  13. package/dist/chunks/{chunk-CQHGNCK2.js → chunk-7BRU4EFH.js} +13 -7
  14. package/dist/chunks/{chunk-KTCB5R5H.js → chunk-7E6MUOEK.js} +2 -2
  15. package/dist/chunks/{chunk-I2HB737U.js → chunk-7U577Q7U.js} +2 -2
  16. package/dist/chunks/{chunk-BJGXMFGD.js → chunk-CAQNBBQA.js} +2 -2
  17. package/dist/chunks/{chunk-MUQUHKPG.js → chunk-CXRQWOZ5.js} +2 -2
  18. package/dist/chunks/{chunk-T7JDJJ7H.js → chunk-FLS4DPGP.js} +110 -16
  19. package/dist/chunks/{chunk-P2DAISYW.js → chunk-I566ZYNF.js} +1 -1
  20. package/dist/chunks/{chunk-36DIFZAH.js → chunk-IZSSVYAG.js} +2 -2
  21. package/dist/chunks/{chunk-EINRJHQ3.js → chunk-JWRZM2H2.js} +3 -3
  22. package/dist/chunks/{chunk-F2EQXUEE.js → chunk-LFMSDBZN.js} +97 -14
  23. package/dist/chunks/{chunk-GVPJZXJ2.js → chunk-LN447PY2.js} +91 -50
  24. package/dist/chunks/{chunk-K3RUEEOL.js → chunk-NETCCARD.js} +2 -2
  25. package/dist/chunks/{chunk-YS5DPN4T.js → chunk-NJKREDA3.js} +1 -1
  26. package/dist/chunks/{chunk-ZXRNHZTE.js → chunk-SPRHHSVC.js} +2 -2
  27. package/dist/chunks/{chunk-HJYVHXUQ.js → chunk-T6EGVBKU.js} +1 -1
  28. package/dist/chunks/{chunk-NLK2RZKG.js → chunk-VNBU55SL.js} +428 -145
  29. package/dist/chunks/{chunk-EZGFHJFW.js → chunk-WFFNM65B.js} +26 -7
  30. package/dist/chunks/{conflict-DRMDOL56.js → conflict-VR55AOOO.js} +2 -2
  31. package/dist/chunks/{contract-73MERZWN.js → contract-HI4FNPYE.js} +2 -2
  32. package/dist/chunks/{cowork-HNGBPD7A.js → cowork-HJLI353D.js} +12 -5
  33. package/dist/chunks/{ebuilder-form-OY6DVNRK.js → ebuilder-form-HTGI63UU.js} +3 -3
  34. package/dist/chunks/{ehr-RAQNEQO7.js → ehr-GYXIYH3A.js} +2 -2
  35. package/dist/chunks/env-DW3G4HUO.js +19 -0
  36. package/dist/chunks/{esb-6XV7C7YV.js → esb-I5INCEFE.js} +4 -4
  37. package/dist/chunks/factory-TKXGXS6L.js +30 -0
  38. package/dist/chunks/{fna-XTSRB7G7.js → fna-K2MHTQ24.js} +2 -2
  39. package/dist/chunks/group-chat-VYBNMJLG.js +18 -0
  40. package/dist/chunks/{host-VGPVP7YF.js → host-256GVCAH.js} +3 -3
  41. package/dist/chunks/{host-A7J6GDUP.js → host-D5SERMAJ.js} +3 -3
  42. package/dist/chunks/{host-3F5UM5GN.js → host-JM4YVHFM.js} +3 -3
  43. package/dist/chunks/{host-YAQAPYNP.js → host-L3VLITMT.js} +3 -3
  44. package/dist/chunks/{host-YMBXWFWX.js → host-ZUQTJYYK.js} +3 -3
  45. package/dist/chunks/{hrm-TLHKC545.js → hrm-VLRBKTZB.js} +3 -3
  46. package/dist/chunks/{im-YOUCFMUK.js → im-QK3VTLXK.js} +8 -8
  47. package/dist/chunks/{invoice-WNBS2B4C.js → invoice-T5JTA32H.js} +3 -3
  48. package/dist/chunks/{jiuchuanhui-XABWS5RN.js → jiuchuanhui-P2FNEQVZ.js} +2 -2
  49. package/dist/chunks/{lazy-dispatch-NLZ5UQQI.js → lazy-dispatch-XRRI46M6.js} +4 -4
  50. package/dist/chunks/{mail-LRYMBFNL.js → mail-3Y7MJ6PS.js} +9 -4
  51. package/dist/chunks/{meeting-ESXL6MFI.js → meeting-M7LTXGJE.js} +11 -10
  52. package/dist/chunks/{okr-EOV65SSF.js → okr-OBC6S67L.js} +2 -2
  53. package/dist/chunks/{plan-YFPVKW6Y.js → plan-5H6I53SK.js} +2 -2
  54. package/dist/chunks/{project-MDVZUYQW.js → project-L75QZV4S.js} +2 -2
  55. package/dist/chunks/{registry-QCLZEDAP.js → registry-KMHCPAAD.js} +9 -8
  56. package/dist/chunks/{registry-OZSMDVPP.js → registry-QGHFNUWS.js} +2 -2
  57. package/dist/chunks/{registry-VT5Y2HLA.js → registry-RXPN6BBT.js} +4 -4
  58. package/dist/chunks/{registry-YX4CSEMD.js → registry-UGRBCBHO.js} +2 -2
  59. package/dist/chunks/{room-recommend-L3MWH4JW.js → room-recommend-A3UDC3CA.js} +4 -4
  60. package/dist/chunks/{schedule-UASAVDVD.js → schedule-5GCACCK7.js} +4 -4
  61. package/dist/chunks/{workflow-KDGIUCNW.js → workflow-M5ZJ7DWF.js} +6 -6
  62. package/dist/index.js +28 -28
  63. package/dist/internal/e10/auth/commands.js +109 -56
  64. package/dist/internal/e10/auth/session.js +11 -1
  65. package/dist/internal/e10/auth/xiaoe.js +29 -4
  66. package/dist/internal/e10/client.js +13 -0
  67. package/dist/internal/e10/context.js +14 -6
  68. package/dist/internal/e10/request-runtime.js +9 -0
  69. package/dist/shortcuts/cowork/operations/item-write.js +10 -2
  70. package/dist/shortcuts/mail/operations/mail-send.js +8 -2
  71. package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -1
  72. package/dist/shortcuts/meeting/operations/eb/create-flow.js +381 -104
  73. package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
  74. package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
  75. package/dist/shortcuts/meeting/operations/eb/group-chat.js +583 -0
  76. package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
  77. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +19 -3
  78. package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
  79. package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
  80. package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
  81. package/dist/shortcuts/workflow/operations/form.js +21 -2
  82. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +52 -1
  83. package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +10 -9
  84. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +28 -2
  85. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
  86. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +17 -9
  87. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +1 -0
  88. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +14 -2
  89. package/docs/e10-auth.md +15 -0
  90. package/package.json +1 -1
  91. package/scripts/mcp-meeting.mjs +234 -0
  92. package/skills/weaver-e10-cowork/references/cowork-write.md +1 -1
  93. package/skills/weaver-e10-mail/references/mail-send.md +2 -0
  94. package/skills/weaver-e10-meeting/SKILL.md +88 -25
  95. package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
  96. package/skills/weaver-e10-meeting.zip +0 -0
  97. package/skills/weaver-e10-shared/SKILL.md +1 -1
  98. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +1 -1
  99. package/skills/weaver-e10-workflow/SKILL.md +4 -0
  100. package/skills/weaver-e10-workflow/aigroup/default.json +12 -0
  101. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +17 -11
  102. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +73 -23
  103. package/dist/chunks/{chunk-2LV74IWP.js → chunk-E7OK5WD5.js} +5 -5
@@ -0,0 +1,487 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ meetingStateDir
5
+ } from "./chunk-NJKREDA3.js";
6
+ import {
7
+ meetingSuccess,
8
+ meetingValidationError,
9
+ schemaOf
10
+ } from "./chunk-7BRU4EFH.js";
11
+
12
+ // src/shortcuts/meeting/operations/eb/group-chat.ts
13
+ import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
14
+ import { resolve } from "node:path";
15
+ var DEFAULT_MEETING_GROUP_FLOW_ID = "1333212605456498718";
16
+ var GROUP_FIELD = "imchat_groupid";
17
+ var PENDING_DIR = "pending-forms";
18
+ async function buildEsbEnv(env) {
19
+ const { createEsbHost } = await import("./host-256GVCAH.js");
20
+ const { createEsbContinuationSigner } = await import("./continuation-NLECEJPX.js");
21
+ return { ctx: env.ctx, host: createEsbHost(env.ctx), continuation: createEsbContinuationSigner(env.ctx) };
22
+ }
23
+ async function buildImEnv(env) {
24
+ const { createImHost } = await import("./host-JM4YVHFM.js");
25
+ const { createImContinuationSigner } = await import("./continuation-2CKSBLA6.js");
26
+ return { ctx: env.ctx, host: createImHost(env.ctx), continuation: createImContinuationSigner(env.ctx) };
27
+ }
28
+ async function buildWorkflowEnv(env) {
29
+ const { createWorkflowHost } = await import("./host-L3VLITMT.js");
30
+ const { createWorkflowContinuationSigner } = await import("./continuation-HZIZRZBX.js");
31
+ return { ctx: env.ctx, host: createWorkflowHost(env.ctx), continuation: createWorkflowContinuationSigner(env.ctx) };
32
+ }
33
+ function parseLocalTime(value) {
34
+ const text = String(value ?? "").trim();
35
+ if (text === "") return 0;
36
+ const normalized = /^\d{4}-\d{2}-\d{2}$/u.test(text) ? `${text} 00:00:00` : text;
37
+ const ts = new Date(normalized.replace(/-/g, "/")).getTime();
38
+ return Number.isFinite(ts) ? ts : 0;
39
+ }
40
+ function formatLocalTime(date) {
41
+ const pad = (n) => String(n).padStart(2, "0");
42
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
43
+ }
44
+ function pendingDirOf(env) {
45
+ return resolve(meetingStateDir(env.ctx), PENDING_DIR);
46
+ }
47
+ async function savePendingForm(env, record) {
48
+ try {
49
+ const dir = pendingDirOf(env);
50
+ await mkdir(dir, { recursive: true });
51
+ const preparedAt = String(record.preparedAt ?? "").trim() || formatLocalTime(/* @__PURE__ */ new Date());
52
+ let baselineRequestId = "";
53
+ try {
54
+ const latest = await searchMyRequests(env, {
55
+ ...record.workflowId ? { workflowId: record.workflowId } : {}
56
+ });
57
+ baselineRequestId = latest[0]?.requestId ?? "";
58
+ } catch {
59
+ baselineRequestId = "";
60
+ }
61
+ const body = { ...record, preparedAt, baselineRequestId };
62
+ const file = resolve(dir, `${Date.now()}-${String(record.workflowId || "wf")}.json`);
63
+ await writeFile(file, `${JSON.stringify(body, null, 2)}
64
+ `, "utf8");
65
+ const files = (await readdir(dir)).filter((one) => one.endsWith(".json")).sort();
66
+ for (const stale of files.slice(0, Math.max(0, files.length - 30))) {
67
+ await rm(resolve(dir, stale), { force: true });
68
+ }
69
+ } catch {
70
+ }
71
+ }
72
+ async function loadLatestPending(env) {
73
+ try {
74
+ const dir = pendingDirOf(env);
75
+ const files = (await readdir(dir)).filter((one) => one.endsWith(".json")).sort().reverse();
76
+ for (const file of files) {
77
+ try {
78
+ const parsed = JSON.parse(await readFile(resolve(dir, file), "utf8"));
79
+ if (parsed && String(parsed.groupId ?? "").trim() !== "") return parsed;
80
+ } catch {
81
+ }
82
+ }
83
+ return null;
84
+ } catch {
85
+ return null;
86
+ }
87
+ }
88
+ function pickGroupId(value, depth = 0) {
89
+ if (value === null || value === void 0 || depth > 6) return "";
90
+ if (Array.isArray(value)) {
91
+ for (const one of value) {
92
+ const hit = pickGroupId(one, depth + 1);
93
+ if (hit) return hit;
94
+ }
95
+ return "";
96
+ }
97
+ if (typeof value !== "object") return "";
98
+ const obj = value;
99
+ for (const [key, raw] of Object.entries(obj)) {
100
+ const normalized = key.toLowerCase().replace(/[_-]/gu, "");
101
+ if (normalized.includes("group") || normalized.includes("chat")) {
102
+ const text = raw === null || raw === void 0 ? "" : String(raw).trim();
103
+ if (/^\d{6,}$/u.test(text)) return text;
104
+ }
105
+ }
106
+ for (const raw of Object.values(obj)) {
107
+ const hit = pickGroupId(raw, depth + 1);
108
+ if (hit) return hit;
109
+ }
110
+ return "";
111
+ }
112
+ async function findGroupByName(env, name) {
113
+ const target = name.trim();
114
+ if (target === "") return null;
115
+ try {
116
+ const { getImOperation } = await import("./registry-QGHFNUWS.js");
117
+ const search = getImOperation("im.group.search");
118
+ const imEnv = await buildImEnv(env);
119
+ const found = await search.handler({ name: target }, imEnv);
120
+ const groups = (found?.data?.groups ?? []).map((one) => ({
121
+ id: String(one.id ?? "").trim(),
122
+ name: String(one.name ?? "").trim(),
123
+ createTime: String(one.createTime ?? "").trim()
124
+ })).filter((one) => one.id !== "");
125
+ if (groups.length === 0) return null;
126
+ const exact = groups.filter((one) => one.name === target);
127
+ const pool = exact.length > 0 ? exact : groups;
128
+ if (exact.length === 0 && pool.length > 1) return null;
129
+ pool.sort((a, b) => parseLocalTime(b.createTime) - parseLocalTime(a.createTime));
130
+ return { ...pool[0], exact: exact.length > 0 };
131
+ } catch {
132
+ return null;
133
+ }
134
+ }
135
+ async function findGroupWithRetry(env, name) {
136
+ const delays = [0, 1200, 2500, 4e3];
137
+ for (let index = 0; index < delays.length; index += 1) {
138
+ if (delays[index] > 0) await new Promise((done) => setTimeout(done, delays[index]));
139
+ const hit = await findGroupByName(env, name);
140
+ if (hit) return hit;
141
+ }
142
+ return null;
143
+ }
144
+ async function triggerGroupFlow(env, input, meetingName, memberIds) {
145
+ const session = await env.host.getSession();
146
+ const employeeId = String(input.employeeId ?? session?.userId ?? "").trim();
147
+ if (!employeeId) {
148
+ return { actionData: null, error: "\u53D6\u4E0D\u5230\u5F53\u524D\u767B\u5F55\u7528\u6237 id\uFF0C\u65E0\u6CD5\u89E6\u53D1\u5EFA\u7FA4\u52A8\u4F5C\u6D41" };
149
+ }
150
+ const mainTable = {
151
+ mt_name: meetingName,
152
+ begindatetime: String(input.beginDatetime ?? ""),
153
+ enddatetime: String(input.endDatetime ?? ""),
154
+ hrmmembers: memberIds.join(",")
155
+ };
156
+ if (input.address) mainTable.address = input.address;
157
+ try {
158
+ const { getEsbOperation } = await import("./registry-RXPN6BBT.js");
159
+ const esbEnv = await buildEsbEnv(env);
160
+ const prepare = getEsbOperation("esb.trigger.prepare");
161
+ const apply = getEsbOperation("esb.trigger.apply");
162
+ const pre = await prepare.handler(
163
+ {
164
+ esbFlowId: String(input.flowId ?? "").trim() || DEFAULT_MEETING_GROUP_FLOW_ID,
165
+ employeeId,
166
+ customParams: { mainTable },
167
+ moduleSource: ""
168
+ },
169
+ esbEnv
170
+ );
171
+ const applied = await apply.handler(
172
+ { continuation: pre?.data?.continuation, confirm: true },
173
+ esbEnv
174
+ );
175
+ if (applied?.ok === false) {
176
+ return {
177
+ actionData: applied?.data ?? null,
178
+ error: String(applied?.error?.message ?? applied?.message ?? "\u5EFA\u7FA4\u52A8\u4F5C\u6D41\u6267\u884C\u5931\u8D25").slice(0, 300)
179
+ };
180
+ }
181
+ return { actionData: applied?.data?.actionData ?? null };
182
+ } catch (error) {
183
+ return { actionData: null, error: String(error?.message ?? error).slice(0, 300) };
184
+ }
185
+ }
186
+ async function bindGroupToMeeting(env, meetingId, groupId) {
187
+ const id = String(meetingId).trim();
188
+ const group = String(groupId).trim();
189
+ if (id === "" || group === "") return { ok: false, error: "\u6CA1\u6709\u4F1A\u8BAE id \u6216\u7FA4 id" };
190
+ try {
191
+ const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-TKXGXS6L.js");
192
+ const session = await env.host.getSession();
193
+ await env.host.request({
194
+ method: "POST",
195
+ path: `${EB_BASE}/updateFormData/change_meeting`,
196
+ query: { id },
197
+ operation: "meeting.eb.meeting.group.ensure",
198
+ body: writeBody(String(session.userId), {
199
+ mainTable: { id, operate_type: "UPDATE", [GROUP_FIELD]: group },
200
+ details: {},
201
+ operateType: {}
202
+ }),
203
+ acceptBusiness: ebBusinessSuccess
204
+ });
205
+ } catch (error) {
206
+ return { ok: false, error: String(error?.message ?? error).slice(0, 300) };
207
+ }
208
+ try {
209
+ const { getMeetingOperation } = await import("./registry-KMHCPAAD.js");
210
+ const detail = getMeetingOperation("meeting.eb.meeting.detail");
211
+ const read = await detail.handler({ id }, env);
212
+ const main = read?.data?.data ?? read?.data?.main ?? {};
213
+ const value = main[GROUP_FIELD];
214
+ if (value === void 0 || value === null) return { ok: true };
215
+ const text = String(value).trim();
216
+ if (text === group) return { ok: true, readBack: text };
217
+ if (text !== "") return { ok: false, error: `\u56DE\u8BFB\u4E0D\u4E00\u81F4\uFF1A${text}` };
218
+ return { ok: true };
219
+ } catch {
220
+ return { ok: true };
221
+ }
222
+ }
223
+ async function searchMyRequests(env, options = {}) {
224
+ try {
225
+ const { getWorkflowOperation } = await import("./registry-UGRBCBHO.js");
226
+ const op = getWorkflowOperation("workflow.search");
227
+ const wfEnv = await buildWorkflowEnv(env);
228
+ const args = { category: "mine", pageSize: 20, sort: "createTime:desc" };
229
+ if (options.sinceMs) {
230
+ const from = formatLocalTime(new Date(options.sinceMs)).slice(0, 16);
231
+ const to = formatLocalTime(/* @__PURE__ */ new Date()).slice(0, 16);
232
+ args.createTime = `${from}~${to}`;
233
+ }
234
+ const res = await op.handler(args, wfEnv);
235
+ const cards = (res?.data?.cards ?? []).map((one) => ({
236
+ requestId: String(one.requestId ?? "").trim(),
237
+ flowName: String(one.flowName ?? "").trim(),
238
+ workflowId: String(one.workflowId ?? "").trim(),
239
+ createdAt: String(one.createdAt ?? one.createTime ?? "").trim()
240
+ })).filter((one) => one.requestId !== "");
241
+ return cards.filter((one) => {
242
+ if (options.workflowId && one.workflowId !== options.workflowId) return false;
243
+ if (options.sinceMs) {
244
+ const created = parseLocalTime(one.createdAt);
245
+ if (created !== 0 && created < options.sinceMs) return false;
246
+ }
247
+ return true;
248
+ });
249
+ } catch {
250
+ return [];
251
+ }
252
+ }
253
+ async function resolveMeetingByRequestId(env, requestId, sinceMs) {
254
+ const target = String(requestId).trim();
255
+ if (target === "") return null;
256
+ try {
257
+ const { getMeetingOperation } = await import("./registry-KMHCPAAD.js");
258
+ const list = getMeetingOperation("meeting.eb.meeting.list");
259
+ const detail = getMeetingOperation("meeting.eb.meeting.detail");
260
+ const page = await list.handler({ pageSize: 30 }, env);
261
+ const rows = (page?.data?.rows ?? []).map((row) => row?.mainTable ?? row ?? {}).filter((main) => String(main.id ?? "").trim() !== "");
262
+ const candidates = rows.filter((main) => {
263
+ const created = parseLocalTime(main.create_time);
264
+ return created === 0 || sinceMs === 0 || created >= sinceMs - 12e4;
265
+ }).slice(0, 10);
266
+ for (const candidate of candidates) {
267
+ const id = String(candidate.id).trim();
268
+ try {
269
+ const read = await detail.handler({ id }, env);
270
+ const main = read?.data?.data ?? read?.data?.main ?? {};
271
+ if (String(main.request_id ?? "").trim() === target) {
272
+ return {
273
+ id,
274
+ name: String(main.mt_name ?? candidate.mt_name ?? "").trim(),
275
+ begin: String(main.begin_datetime ?? candidate.begin_datetime ?? "").trim(),
276
+ requestId: target
277
+ };
278
+ }
279
+ } catch {
280
+ }
281
+ }
282
+ return null;
283
+ } catch {
284
+ return null;
285
+ }
286
+ }
287
+ async function ensureMeetingGroupChat(env, input) {
288
+ const memberIds = (input.memberIds ?? []).map((one) => String(one).trim()).filter((one) => one !== "");
289
+ const pending = input.lookupPending === true ? await loadLatestPending(env) : null;
290
+ let meetingName = String(input.meetingName ?? pending?.mtName ?? "").trim();
291
+ let meetingId = String(input.meetingId ?? "").trim();
292
+ let requestId = String(input.requestId ?? "").trim();
293
+ let meetingLookup = null;
294
+ let requestCandidates;
295
+ if (meetingId === "" && (input.lookupPending === true || requestId !== "")) {
296
+ const sinceMs = parseLocalTime(pending?.preparedAt) || Date.now() - 2 * 36e5;
297
+ if (requestId === "") {
298
+ const requests = await searchMyRequests(env, {
299
+ ...pending?.workflowId ? { workflowId: pending.workflowId } : {}
300
+ });
301
+ const baseline = String(pending?.baselineRequestId ?? "").trim();
302
+ const baselineIndex = baseline === "" ? -1 : requests.findIndex((one) => one.requestId === baseline);
303
+ const fresh = baselineIndex > 0 ? requests.slice(0, baselineIndex) : baselineIndex === 0 ? [] : requests.slice(0, 3);
304
+ if (fresh.length === 1) {
305
+ requestId = fresh[0].requestId;
306
+ } else if (fresh.length > 1) {
307
+ requestCandidates = fresh.slice(0, 5).map((one) => ({
308
+ requestId: one.requestId,
309
+ flowName: one.flowName,
310
+ createdAt: one.createdAt
311
+ }));
312
+ }
313
+ }
314
+ if (requestId !== "") {
315
+ meetingLookup = await resolveMeetingByRequestId(env, requestId, sinceMs);
316
+ if (meetingLookup) {
317
+ meetingId = meetingLookup.id;
318
+ if (meetingName === "") meetingName = meetingLookup.name;
319
+ }
320
+ }
321
+ }
322
+ if (meetingName === "" && input.groupId === void 0 && pending === null) {
323
+ return {
324
+ ok: false,
325
+ groupId: null,
326
+ groupName: null,
327
+ created: false,
328
+ bound: false,
329
+ meetingId: meetingId || null,
330
+ requestId: requestId || null,
331
+ error: "\u65E2\u6CA1\u6709\u4F1A\u8BAE\u540D\u79F0\uFF0C\u4E5F\u6CA1\u6709\u672C\u673A\u5F85\u7ED1\u8BB0\u5F55/\u7FA4 id\uFF0C\u65E0\u6CD5\u5EFA\u7FA4\u6216\u8865\u7ED1"
332
+ };
333
+ }
334
+ const knownGroupId = String(input.groupId ?? pending?.groupId ?? "").trim();
335
+ if (knownGroupId !== "") {
336
+ const bound2 = meetingId ? await bindGroupToMeeting(env, meetingId, knownGroupId) : {
337
+ ok: false,
338
+ error: requestCandidates ? "\u540C\u4E00\u65F6\u95F4\u7A97\u6709\u591A\u4E2A\u6D41\u7A0B\u5355\uFF0C\u5148\u8BA9\u7528\u6237\u786E\u8BA4\u662F\u54EA\u4E00\u5F20\uFF08\u89C1 requestCandidates\uFF09\uFF0C\u518D\u4F20 requestId" : requestId ? `\u6D41\u7A0B\u5355 ${requestId} \u5BF9\u5E94\u4E0D\u5230\u4F1A\u8BAE\uFF08\u53EF\u80FD\u8FD8\u5728\u5BA1\u6279\u3001\u6216\u4F1A\u8BAE\u5C1A\u672A\u540C\u6B65\uFF09` : "\u6CA1\u62FF\u5230\u6D41\u7A0B\u5355 id\uFF0C\u65E0\u6CD5\u5B9A\u4F4D\u4F1A\u8BAE"
339
+ };
340
+ return {
341
+ ok: bound2.ok,
342
+ groupId: knownGroupId,
343
+ groupName: pending?.groupName ?? null,
344
+ created: false,
345
+ bound: bound2.ok,
346
+ meetingId: meetingId || null,
347
+ requestId: requestId || null,
348
+ ...input.lookupPending === true || requestId !== "" ? { meetingLookup } : {},
349
+ ...requestCandidates ? { requestCandidates } : {},
350
+ ...bound2.readBack ? { readBack: bound2.readBack } : {},
351
+ ...bound2.error ? { error: bound2.error } : {}
352
+ };
353
+ }
354
+ const existing = await findGroupByName(env, meetingName);
355
+ let groupId = existing?.id ?? "";
356
+ let groupName = existing?.name ?? "";
357
+ let created = false;
358
+ let error;
359
+ if (groupId === "") {
360
+ const triggered = await triggerGroupFlow(env, input, meetingName, memberIds);
361
+ error = triggered.error;
362
+ groupId = pickGroupId(triggered.actionData);
363
+ if (groupId === "") {
364
+ const newest = await findGroupWithRetry(env, meetingName);
365
+ groupId = newest?.id ?? "";
366
+ groupName = newest?.name ?? "";
367
+ }
368
+ created = groupId !== "";
369
+ }
370
+ if (groupId === "") {
371
+ return {
372
+ ok: false,
373
+ groupId: null,
374
+ groupName: null,
375
+ created: false,
376
+ bound: false,
377
+ meetingId: meetingId || null,
378
+ requestId: requestId || null,
379
+ ...requestCandidates ? { requestCandidates } : {},
380
+ ...error ? { error } : { error: "\u5EFA\u7FA4\u52A8\u4F5C\u6D41\u5DF2\u89E6\u53D1\uFF0C\u4F46\u6CA1\u80FD\u53CD\u67E5\u5230\u7FA4 id\uFF08\u7FA4\u540D\u4E0E\u4F1A\u8BAE\u540D\u79F0\u4E0D\u4E00\u81F4\uFF1F\uFF09" }
381
+ };
382
+ }
383
+ if (meetingId === "") {
384
+ return {
385
+ ok: true,
386
+ groupId,
387
+ groupName: groupName || meetingName,
388
+ created,
389
+ bound: false,
390
+ meetingId: null,
391
+ requestId: requestId || null,
392
+ ...requestCandidates ? { requestCandidates } : {},
393
+ ...input.lookupPending === true && !requestCandidates ? { error: "\u7FA4\u5DF2\u5EFA\u597D\uFF0C\u4F46\u8FD8\u6CA1\u627E\u5230\u5BF9\u5E94\u6D41\u7A0B\u5355\uFF08\u53EF\u80FD\u7528\u6237\u8FD8\u6CA1\u63D0\u4EA4\uFF0C\u6216\u521A\u63D0\u4EA4\u8FD8\u6CA1\u540C\u6B65\uFF09" } : {}
394
+ };
395
+ }
396
+ const bound = await bindGroupToMeeting(env, meetingId, groupId);
397
+ return {
398
+ ok: bound.ok,
399
+ groupId,
400
+ groupName: groupName || meetingName,
401
+ created,
402
+ bound: bound.ok,
403
+ meetingId,
404
+ requestId: requestId || null,
405
+ ...input.lookupPending === true || requestId !== "" ? { meetingLookup } : {},
406
+ ...requestCandidates ? { requestCandidates } : {},
407
+ ...bound.readBack ? { readBack: bound.readBack } : {},
408
+ ...bound.error ? { error: bound.error } : {}
409
+ };
410
+ }
411
+ var ebMeetingGroupEnsure = {
412
+ name: "meeting.eb.meeting.group.ensure",
413
+ resource: "eb",
414
+ method: "meeting.eb.meeting.group.ensure",
415
+ action: "meeting.eb.meeting.group.ensure",
416
+ summary: "\u5EFA\u4F1A\u540C\u6B65\u5EFA\u7FA4\u804A\uFF1A\u6309\u4F1A\u8BAE\u540D\u79F0/\u8D77\u6B62/\u53C2\u4F1A\u4EBA\u8C03\u5EFA\u7FA4\u52A8\u4F5C\u6D41\uFF08\u7FA4\u5185\u53D1\u4F1A\u8BAE\u4FE1\u606F\uFF09\uFF0C\u53CD\u67E5\u7FA4 id\uFF1B\u8865\u7ED1\u4F1A\u8BAE\u8BB0\u5F55\u65F6\u6309 requestId \u53CD\u67E5\uFF08\u4E0D\u6309\u4F1A\u8BAE\u540D\u79F0\uFF09",
417
+ capability: "eb.meeting",
418
+ // 建群是写操作但不破坏数据(可解散重建),按「先确认会议要素再调」的口径标注
419
+ risk: "read-before-write",
420
+ inputSchema: schemaOf(
421
+ {
422
+ mt_name: { type: "string", description: "\u5EFA\u4F1A\u65F6\u7684\u4F1A\u8BAE\u540D\u79F0\uFF08=\u7FA4\u540D\u79F0\uFF09\u3002\u8865\u7ED1\u65F6\u53EF\u4E0D\u4F20\uFF0C\u81EA\u52A8\u8BFB\u672C\u673A\u5F85\u7ED1\u8BB0\u5F55" },
423
+ begin_datetime: { type: "string", description: "\u4F1A\u8BAE\u5F00\u59CB\u65F6\u95F4\uFF08yyyy-MM-dd HH:mm\uFF09" },
424
+ end_datetime: { type: "string", description: "\u4F1A\u8BAE\u7ED3\u675F\u65F6\u95F4\uFF08yyyy-MM-dd HH:mm\uFF09" },
425
+ hrm_members: { type: "string", description: "\u53C2\u4F1A\u4EBA\u5458\u5458\u5DE5 id\uFF0C\u9017\u53F7\u5206\u9694\uFF08\u52A8\u4F5C\u6D41\u8981\u6C42 id\uFF0C\u4E0D\u8981\u4F20\u59D3\u540D\uFF09" },
426
+ address: { type: "string", description: "\u4F1A\u8BAE\u5BA4 id\uFF08\u53EF\u9009\uFF09" },
427
+ meetingId: { type: "string", description: "\u4F1A\u8BAE id\uFF1A\u4F20\u4E86\u5C31\u53EA\u505A\u7ED1\u7FA4" },
428
+ requestId: { type: "string", description: "\u6D41\u7A0B\u5355\u636E id\uFF1A\u6309\u5B83\u53CD\u67E5\u4F1A\u8BAE\uFF08\u4F1A\u8BAE\u8BB0\u5F55\u7684 request_id\uFF09\uFF0C\u6BD4\u540D\u79F0\u53EF\u9760" },
429
+ groupId: { type: "string", description: "\u5DF2\u77E5\u7FA4 id\uFF1A\u4F20\u5165\u5219\u8DF3\u8FC7\u5EFA\u7FA4\uFF0C\u76F4\u63A5\u7ED1\u5B9A" },
430
+ lookupPending: {
431
+ type: "boolean",
432
+ description: "\u8865\u7ED1\u6A21\u5F0F\uFF1A\u8BFB\u672C\u673A\u300C\u8868\u5355\u5DF2\u53D1\u51FA\u300D\u8BB0\u5F55\uFF0C\u6309\u6D41\u7A0B\u5355\u53CD\u67E5\u4F1A\u8BAE\u518D\u7ED1\u7FA4\uFF08\u7528\u6237\u70B9\u63D0\u4EA4\u540E\u7528\u8FD9\u4E2A\uFF09"
433
+ },
434
+ flowId: { type: "string", description: `\u8986\u76D6\u5EFA\u7FA4\u52A8\u4F5C\u6D41 id\uFF08\u9ED8\u8BA4 ${DEFAULT_MEETING_GROUP_FLOW_ID}\uFF09` },
435
+ employeeId: { type: "string", description: "\u8986\u76D6\u89E6\u53D1\u4EBA\u5458 id\uFF08\u9ED8\u8BA4\u5F53\u524D\u767B\u5F55\u7528\u6237\uFF09" }
436
+ },
437
+ {}
438
+ ),
439
+ handler: async (args, env) => {
440
+ const result = await ensureMeetingGroupChat(env, {
441
+ ...args.mt_name ? { meetingName: String(args.mt_name).trim() } : {},
442
+ ...args.begin_datetime ? { beginDatetime: String(args.begin_datetime).trim() } : {},
443
+ ...args.end_datetime ? { endDatetime: String(args.end_datetime).trim() } : {},
444
+ memberIds: String(args.hrm_members ?? "").split(/[,;,;\s]+/u).map((one) => one.trim()).filter((one) => one !== ""),
445
+ ...args.address ? { address: String(args.address).trim() } : {},
446
+ ...args.meetingId ? { meetingId: String(args.meetingId).trim() } : {},
447
+ ...args.requestId ? { requestId: String(args.requestId).trim() } : {},
448
+ ...args.groupId ? { groupId: String(args.groupId).trim() } : {},
449
+ ...args.lookupPending === true ? { lookupPending: true } : {},
450
+ ...args.flowId ? { flowId: String(args.flowId).trim() } : {},
451
+ ...args.employeeId ? { employeeId: String(args.employeeId).trim() } : {}
452
+ });
453
+ if (!result.ok && !result.groupId) {
454
+ throw meetingValidationError(
455
+ "group_create_failed",
456
+ result.error ?? "\u5EFA\u7FA4\u5931\u8D25",
457
+ { requestId: result.requestId ?? null, requestCandidates: result.requestCandidates ?? [] }
458
+ );
459
+ }
460
+ const warnings = [];
461
+ if (result.requestCandidates && result.requestCandidates.length > 0) {
462
+ warnings.push(
463
+ `\u540C\u4E00\u65F6\u95F4\u7A97\u67E5\u5230 ${result.requestCandidates.length} \u5F20\u6D41\u7A0B\u5355\uFF0C\u6CA1\u6CD5\u786E\u5B9A\u662F\u54EA\u4E00\u5F20\uFF1A` + result.requestCandidates.map((one) => `${one.flowName || "(\u65E0\u6807\u9898)"} ${one.requestId}`).join("\u3001") + "\u3002\u26D4 \u4E0D\u8981\u81EA\u5DF1\u731C \u2014\u2014 \u8BA9\u7528\u6237\u786E\u8BA4\u662F\u54EA\u4E00\u5F20\uFF0C\u518D\u628A\u5B83\u7684 requestId \u4F20\u8FDB\u6765\u3002"
464
+ );
465
+ }
466
+ if (result.bound) {
467
+ warnings.push(`\u7FA4\u5DF2\u7ED1\u5B9A\u5230\u4F1A\u8BAE\u8BB0\u5F55\uFF08imchat_groupid=${result.groupId}${result.readBack ? "\uFF0C\u56DE\u8BFB\u4E00\u81F4" : ""}\uFF09\u3002`);
468
+ } else if (!result.meetingId) {
469
+ warnings.push(
470
+ result.error ? `\u7FA4\u5DF2\u5EFA\u597D\uFF08\u7FA4 id ${result.groupId}\uFF09\uFF0C\u4F46\u8FD8\u6CA1\u7ED1\u4E0A\uFF1A${result.error}` : "\u7FA4\u5DF2\u5EFA\u597D\uFF0C\u4F46\u8FD8\u6CA1\u6709\u4F1A\u8BAE id\uFF1A\u7528\u6237\u63D0\u4EA4\u540E\u5E26 lookupPending:true\uFF08\u6216 requestId\uFF09\u518D\u8DD1\u4E00\u6B21\u5373\u53EF\u8865\u7ED1\u3002"
471
+ );
472
+ }
473
+ return meetingSuccess(
474
+ "meeting.eb.meeting.group.ensure",
475
+ { ...result },
476
+ warnings.length > 0 ? { warnings } : {}
477
+ );
478
+ }
479
+ };
480
+ var meetingEbGroupChatOperations = [ebMeetingGroupEnsure];
481
+
482
+ export {
483
+ DEFAULT_MEETING_GROUP_FLOW_ID,
484
+ savePendingForm,
485
+ ensureMeetingGroupChat,
486
+ meetingEbGroupChatOperations
487
+ };
@@ -4,6 +4,9 @@ import {
4
4
  CliError
5
5
  } from "./chunk-LUSPKZKY.js";
6
6
 
7
+ // src/shortcuts/meeting/operations/eb/factory.ts
8
+ import { createHash } from "node:crypto";
9
+
7
10
  // src/shortcuts/meeting/errors.ts
8
11
  var MeetingCliError = class extends CliError {
9
12
  type;
@@ -194,9 +197,6 @@ async function assertMeetingExists(id, host, operation) {
194
197
  }
195
198
  }
196
199
 
197
- // src/shortcuts/meeting/operations/eb/factory.ts
198
- import { createHash } from "node:crypto";
199
-
200
200
  // src/shortcuts/meeting/operations/eb/attendance-summary.ts
201
201
  function toText(value) {
202
202
  return value === void 0 || value === null ? "" : String(value).trim();
@@ -378,7 +378,9 @@ function summarizeRoomRows(rows) {
378
378
  allowMinNum: toText2(main.allow_minnum),
379
379
  allowMaxNum: toText2(main.allow_maxnum),
380
380
  place: toText2(main.place),
381
- equipments: toText2(main.equipments)
381
+ equipments: toText2(main.equipments),
382
+ // 会议室描述:列表接口本来就返回 `room_desc`(2026-11-02 核实),之前漏映射导致推荐时用不上
383
+ roomDesc: toText2(main.room_desc)
382
384
  };
383
385
  });
384
386
  return {
@@ -697,9 +699,12 @@ var EB_ENDPOINTS = [
697
699
  "hrmmember",
698
700
  "attend_user",
699
701
  "reporting_user",
700
- "topic_presenter",
701
- "request_id"
702
+ "topic_presenter"
702
703
  ],
704
+ // 群 id 走 body `datajson.mainTable` 精确匹配(2026-11-02 实测:按它查回 1 条,准)。
705
+ // ⛔ `request_id` 不能当筛选条件:接口文档里它**不是入参**,URL query 传了被忽略,
706
+ // 出参是「按显示名称」(返回流程标题,不是单号)—— 想按单号找会议,只能取列表再逐条 detail 比对。
707
+ mainTableParams: ["imchat_groupid"],
703
708
  summary: "EB \u7248\u4F1A\u8BAE\u5217\u8868\uFF08query_mtDetail_list + count\uFF09\uFF1AURL query \u4F20\u7B5B\u9009\u6761\u4EF6\uFF0Cbody \u5E26 datajson",
704
709
  notes: [
705
710
  "hrmmember \u7B49\u4EBA\u5458\u53C2\u6570\u5FC5\u987B\u4F20\u5458\u5DE5 id\uFF0C\u4E0D\u80FD\u4F20\u59D3\u540D\u6587\u672C\u3002",
@@ -2251,7 +2256,7 @@ function buildWriteOperations(endpoint, preflight, afterWrite) {
2251
2256
  );
2252
2257
  }
2253
2258
  if (endpoint.interfacePk === "create_meeting") {
2254
- const { fetchEbAppSettings, assertEbCreatePathAllowed } = await import("./conflict-DRMDOL56.js");
2259
+ const { fetchEbAppSettings, assertEbCreatePathAllowed } = await import("./conflict-VR55AOOO.js");
2255
2260
  assertEbCreatePathAllowed(await fetchEbAppSettings(env, applyName));
2256
2261
  }
2257
2262
  const pkQuery = writePkQuery(endpoint, payload);
@@ -2335,6 +2340,7 @@ export {
2335
2340
  queryBody,
2336
2341
  writeBody,
2337
2342
  extractEbRows,
2343
+ extractEbCount,
2338
2344
  normalizeEbWrite,
2339
2345
  buildEbOperations
2340
2346
  };
@@ -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-YS5DPN4T.js";
5
+ } from "./chunk-NJKREDA3.js";
6
6
  import {
7
7
  SCHEMA_ID,
8
8
  meetingSuccess,
9
9
  meetingValidationError,
10
10
  schemaOf
11
- } from "./chunk-CQHGNCK2.js";
11
+ } from "./chunk-7BRU4EFH.js";
12
12
 
13
13
  // src/shortcuts/meeting/operations/attachment-content.ts
14
14
  import { mkdir, writeFile } from "node:fs/promises";
@@ -11,11 +11,11 @@ import {
11
11
  createE10RequestRuntime,
12
12
  isE10SessionExpiredResponse,
13
13
  requireE10Session
14
- } from "./chunk-EZGFHJFW.js";
14
+ } from "./chunk-WFFNM65B.js";
15
15
  import {
16
16
  E10_SESSION_EXPIRED_MESSAGE,
17
17
  getActiveProfile
18
- } from "./chunk-XXJOSZTQ.js";
18
+ } from "./chunk-4TEDNCON.js";
19
19
 
20
20
  // src/shortcuts/im/host.ts
21
21
  import { createHash } from "node:crypto";
@@ -14,11 +14,11 @@ import {
14
14
  createE10RequestRuntime,
15
15
  isE10SessionExpiredResponse,
16
16
  requireE10Session
17
- } from "./chunk-EZGFHJFW.js";
17
+ } from "./chunk-WFFNM65B.js";
18
18
  import {
19
19
  E10_SESSION_EXPIRED_MESSAGE,
20
20
  getActiveProfile
21
- } from "./chunk-XXJOSZTQ.js";
21
+ } from "./chunk-4TEDNCON.js";
22
22
 
23
23
  // src/shortcuts/esb/host.ts
24
24
  var ESB_PATHS = {
@@ -10,10 +10,10 @@ import {
10
10
  createE10RequestRuntime,
11
11
  isE10SessionExpiredResponse,
12
12
  requireE10Session
13
- } from "./chunk-EZGFHJFW.js";
13
+ } from "./chunk-WFFNM65B.js";
14
14
  import {
15
15
  getActiveProfile
16
- } from "./chunk-XXJOSZTQ.js";
16
+ } from "./chunk-4TEDNCON.js";
17
17
 
18
18
  // src/shortcuts/ebuilder-form/host.ts
19
19
  import { randomUUID } from "node:crypto";