weaver-work-cli 0.1.29 → 0.1.31

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 (185) hide show
  1. package/dist/chunks/archive-U766FTFH.js +2537 -0
  2. package/dist/chunks/archive-oa-DMWEKX3L.js +1317 -0
  3. package/dist/chunks/asset-TCR7VDEV.js +2109 -0
  4. package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
  5. package/dist/chunks/blog-EVZWGDVM.js +2157 -0
  6. package/dist/chunks/caizhilian-JOWS6SL5.js +10087 -0
  7. package/dist/chunks/calendar-5WNCV66Q.js +1195 -0
  8. package/dist/chunks/chunk-2DUV44UX.js +15606 -0
  9. package/dist/chunks/chunk-324YPTC2.js +1607 -0
  10. package/dist/chunks/chunk-65QMVWHS.js +231 -0
  11. package/dist/chunks/chunk-6V7ZLF34.js +387 -0
  12. package/dist/chunks/chunk-AC7KJWC5.js +358 -0
  13. package/dist/chunks/chunk-AJ62BGAW.js +29 -0
  14. package/dist/chunks/chunk-BUSC6UAE.js +43 -0
  15. package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
  16. package/dist/chunks/chunk-D4LTJSJD.js +477 -0
  17. package/dist/chunks/chunk-EG6ZU444.js +654 -0
  18. package/dist/chunks/chunk-EZALDOQH.js +383 -0
  19. package/dist/chunks/chunk-FMPJJYYI.js +106 -0
  20. package/dist/chunks/chunk-G2JSIUWF.js +769 -0
  21. package/dist/chunks/chunk-GCG2NMWR.js +703 -0
  22. package/dist/chunks/chunk-GPMFD4RD.js +75 -0
  23. package/dist/chunks/chunk-H3WDBYJW.js +508 -0
  24. package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
  25. package/dist/chunks/chunk-J7RJTZSV.js +5556 -0
  26. package/dist/chunks/chunk-LUSPKZKY.js +53 -0
  27. package/dist/chunks/chunk-NIAJ5ZCG.js +73 -0
  28. package/dist/chunks/chunk-NOODWMCL.js +584 -0
  29. package/dist/chunks/chunk-OOUTBLZ4.js +51 -0
  30. package/dist/chunks/chunk-P26ZWSKU.js +73 -0
  31. package/dist/chunks/chunk-QWY6PGL6.js +3472 -0
  32. package/dist/chunks/chunk-R2IJAK7T.js +464 -0
  33. package/dist/chunks/chunk-R7O5PUWO.js +205 -0
  34. package/dist/chunks/chunk-RCGYCOMG.js +6962 -0
  35. package/dist/chunks/chunk-VZTXRG6X.js +403 -0
  36. package/dist/chunks/chunk-WHD4XMRP.js +161 -0
  37. package/dist/chunks/chunk-YLCYX7LE.js +371 -0
  38. package/dist/chunks/chunk-ZEDWSH32.js +68 -0
  39. package/dist/chunks/continuation-2CKSBLA6.js +11 -0
  40. package/dist/chunks/continuation-HZIZRZBX.js +13 -0
  41. package/dist/chunks/continuation-NLECEJPX.js +11 -0
  42. package/dist/chunks/ebuilder-form-NJ4YK6CC.js +2276 -0
  43. package/dist/chunks/ehr-MMYN36VA.js +5241 -0
  44. package/dist/chunks/employee-SAK2QYXX.js +11 -0
  45. package/dist/chunks/esb-HIWHOU7Q.js +141 -0
  46. package/dist/chunks/fna-KBACQTA5.js +1444 -0
  47. package/dist/chunks/host-3OHS5QUX.js +21 -0
  48. package/dist/chunks/host-IG6KEH5Q.js +19 -0
  49. package/dist/chunks/host-KQL5N4HO.js +23 -0
  50. package/dist/chunks/host-LLSZQCWR.js +17 -0
  51. package/dist/chunks/hrm-LYEC67ZQ.js +244 -0
  52. package/dist/chunks/im-RN2UKAEU.js +252 -0
  53. package/dist/chunks/invoice-EEPHLAF6.js +5179 -0
  54. package/dist/chunks/jiuchuanhui-WVVZYSJE.js +1940 -0
  55. package/dist/chunks/lazy-dispatch-MDOFFL2S.js +28 -0
  56. package/dist/chunks/mail-LNQLTF6L.js +2695 -0
  57. package/dist/chunks/meeting-XSD3BDVQ.js +504 -0
  58. package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
  59. package/dist/chunks/okr-TMWTIU2K.js +2482 -0
  60. package/dist/chunks/plan-A2FSFA7T.js +2025 -0
  61. package/dist/chunks/project-T26QLBQF.js +1361 -0
  62. package/dist/chunks/registry-2VLUAESA.js +14 -0
  63. package/dist/chunks/registry-JCFEYXOE.js +18 -0
  64. package/dist/chunks/registry-NYPYMZXG.js +16 -0
  65. package/dist/chunks/registry-Q7OQJ3SU.js +19 -0
  66. package/dist/chunks/registry-ZJMJVWFA.js +19 -0
  67. package/dist/chunks/room-recommend-UR4ZDZS6.js +20 -0
  68. package/dist/chunks/schedule-5L2PM4M6.js +24 -0
  69. package/dist/chunks/state-Y2XBP6YE.js +15 -0
  70. package/dist/chunks/workflow-TR6PG2SL.js +245 -0
  71. package/dist/cmd/argv.js +45 -0
  72. package/dist/cmd/docs/index.js +3 -3
  73. package/dist/cmd/lazy-dispatch.js +20 -0
  74. package/dist/cmd/root.js +2 -4
  75. package/dist/cmd/setup/index.js +2 -2
  76. package/dist/cmd/skills/index.js +2 -2
  77. package/dist/core/package-paths.js +47 -0
  78. package/dist/index.js +163 -7
  79. package/dist/internal/e10/auth/xiaoe.js +3 -3
  80. package/dist/internal/e10/request-runtime.js +18 -62
  81. package/dist/internal/skills/detector.js +2 -2
  82. package/dist/shortcuts/contract/data/performance-catalog.js +1306 -0
  83. package/dist/shortcuts/contract/host.js +91 -35
  84. package/dist/shortcuts/contract/index.js +213 -0
  85. package/dist/shortcuts/contract/manifest.js +928 -0
  86. package/dist/shortcuts/contract/ooxml/docx.js +295 -0
  87. package/dist/shortcuts/contract/ooxml/xlsx.js +221 -0
  88. package/dist/shortcuts/contract/ooxml/zip.js +158 -0
  89. package/dist/shortcuts/contract/operations/assistant.js +1156 -0
  90. package/dist/shortcuts/contract/operations/clause-library.js +522 -0
  91. package/dist/shortcuts/contract/operations/compare.js +193 -0
  92. package/dist/shortcuts/contract/operations/credit-page.js +34 -0
  93. package/dist/shortcuts/contract/operations/flow.js +98 -0
  94. package/dist/shortcuts/contract/operations/page.js +66 -0
  95. package/dist/shortcuts/contract/operations/performance.js +733 -0
  96. package/dist/shortcuts/contract/operations/quote.js +557 -0
  97. package/dist/shortcuts/contract/operations/recommend.js +78 -0
  98. package/dist/shortcuts/contract/operations/registry.js +18 -0
  99. package/dist/shortcuts/contract/operations/review.js +83 -0
  100. package/dist/shortcuts/contract/operations/shared.js +37 -0
  101. package/dist/shortcuts/contract/operations/upload.js +108 -0
  102. package/dist/shortcuts/contract/operations/write.js +3 -2
  103. package/dist/shortcuts/index.js +140 -40
  104. package/dist/shortcuts/invoice/manifest.js +34 -11
  105. package/dist/shortcuts/invoice/operations/reim-auto.js +9 -0
  106. package/dist/shortcuts/invoice/operations/reim.js +81 -5
  107. package/dist/shortcuts/invoice/operations/shared.js +12 -5
  108. package/dist/shortcuts/meeting/host.js +45 -3
  109. package/dist/shortcuts/meeting/invitation/docx.js +442 -0
  110. package/dist/shortcuts/meeting/operations/attachment-content.js +418 -0
  111. package/dist/shortcuts/meeting/operations/attachment.js +442 -0
  112. package/dist/shortcuts/meeting/operations/eb/cache.js +57 -0
  113. package/dist/shortcuts/meeting/operations/eb/catalog.js +343 -28
  114. package/dist/shortcuts/meeting/operations/eb/conflict.js +372 -11
  115. package/dist/shortcuts/meeting/operations/eb/create-flow.js +710 -0
  116. package/dist/shortcuts/meeting/operations/eb/decision.js +47 -1
  117. package/dist/shortcuts/meeting/operations/eb/factory.js +129 -11
  118. package/dist/shortcuts/meeting/operations/eb/index.js +122 -2
  119. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +378 -0
  120. package/dist/shortcuts/meeting/operations/eb/room-summary.js +84 -0
  121. package/dist/shortcuts/meeting/operations/eb/schedule.js +450 -0
  122. package/dist/shortcuts/meeting/operations/from-group-chat.js +576 -0
  123. package/dist/shortcuts/meeting/operations/invitation.js +458 -0
  124. package/dist/shortcuts/meeting/operations/minute-content.js +266 -0
  125. package/dist/shortcuts/meeting/operations/pipeline.js +489 -0
  126. package/dist/shortcuts/meeting/operations/qrcode.js +131 -0
  127. package/dist/shortcuts/meeting/operations/receipts.js +1 -1
  128. package/dist/shortcuts/meeting/operations/registry.js +18 -0
  129. package/dist/shortcuts/meeting/operations/summary.js +276 -0
  130. package/dist/shortcuts/meeting/operations/task-notify.js +325 -0
  131. package/dist/shortcuts/meeting/operations.js +42 -1
  132. package/dist/shortcuts/meeting/qr/encoder.js +427 -0
  133. package/dist/shortcuts/meeting/qr/render.js +103 -0
  134. package/dist/shortcuts/workflow/operations/form.js +17 -5
  135. package/docs/contract.md +39 -4
  136. package/docs/invoice.md +5 -5
  137. package/package.json +3 -2
  138. package/scripts/bundle.mjs +63 -0
  139. package/skill-template/business-info.json +25 -4
  140. package/skill-template/domains/jinchengda.md +16 -3
  141. package/skill-template/domains/yepiaotong.md +1 -1
  142. package/skills/weaver-e10-jinchengda/SKILL.md +111 -31
  143. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -13
  144. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +150 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +87 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +111 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +0 -15
  148. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +0 -13
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +50 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +4 -2
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +74 -0
  152. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +84 -0
  153. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +29 -0
  154. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +28 -0
  155. package/skills/weaver-e10-jinchengda/references/contract-request-status.md +2 -21
  156. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +0 -24
  157. package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +0 -15
  158. package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +0 -17
  159. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +70 -0
  160. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -15
  161. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +0 -15
  162. package/skills/weaver-e10-jinchengda/references/source-manifest.json +1168 -152
  163. package/skills/weaver-e10-meeting/SKILL.md +493 -17
  164. package/skills/weaver-e10-meeting/references/meeting-change.md +4 -4
  165. package/skills/weaver-e10-meeting/references/meeting-create.md +6 -6
  166. package/skills/weaver-e10-meeting/references/meeting-eb.md +503 -27
  167. package/skills/weaver-e10-meeting/references/meeting-invitation.md +113 -0
  168. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +6 -6
  169. package/skills/weaver-e10-meeting/references/meeting-minute-file.md +425 -0
  170. package/skills/weaver-e10-meeting/references/meeting-queries.md +4 -4
  171. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +15 -15
  172. package/skills/weaver-e10-meeting/references/meeting-verification.md +19 -11
  173. package/skills/weaver-e10-meeting.zip +0 -0
  174. package/skills/weaver-e10-yepiaotong/SKILL.md +9 -5
  175. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
  176. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +6 -5
  177. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +14 -11
  178. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +97 -56
  179. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +84 -60
  180. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +142 -105
  181. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +53 -194
  182. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -7
  183. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +164 -72
  184. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +6 -0
  185. package/templates/meeting/invitation.docx +0 -0
@@ -0,0 +1,504 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ getMeetingOperation,
5
+ meetingOperationDefinitions
6
+ } from "./chunk-RCGYCOMG.js";
7
+ import "./chunk-VZTXRG6X.js";
8
+ import "./chunk-AC7KJWC5.js";
9
+ import "./chunk-CVZ2JOSW.js";
10
+ import "./chunk-GCG2NMWR.js";
11
+ import {
12
+ MeetingCliError,
13
+ asObject,
14
+ assertNoForbiddenKeys,
15
+ meetingAuthError,
16
+ meetingNetworkError,
17
+ meetingStateDir,
18
+ meetingValidationError
19
+ } from "./chunk-H6XSTSLM.js";
20
+ import {
21
+ E10ApiError,
22
+ createE10RequestRuntime,
23
+ requireE10Session
24
+ } from "./chunk-H3WDBYJW.js";
25
+ import {
26
+ E10_SESSION_EXPIRED_MESSAGE,
27
+ getActiveProfile
28
+ } from "./chunk-324YPTC2.js";
29
+ import {
30
+ isCliError,
31
+ toErrorEnvelope
32
+ } from "./chunk-LUSPKZKY.js";
33
+ import "./chunk-BUSC6UAE.js";
34
+
35
+ // src/shortcuts/meeting/index.ts
36
+ import { readFile as readFile2 } from "node:fs/promises";
37
+
38
+ // src/shortcuts/meeting/continuation.ts
39
+ import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
40
+ import { existsSync } from "node:fs";
41
+ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
42
+ import { homedir } from "node:os";
43
+ import { resolve } from "node:path";
44
+ function stateRoot(ctx) {
45
+ const configured = ctx?.config?.path();
46
+ if (configured) return resolve(configured, "..");
47
+ return process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), ".weaver-work-cli");
48
+ }
49
+ async function loadKey(ctx) {
50
+ const keysDir = resolve(stateRoot(ctx), "keys");
51
+ const filename = resolve(keysDir, "meeting-continuation.key");
52
+ await mkdir(keysDir, { recursive: true, mode: 448 });
53
+ if (existsSync(filename)) return readFile(filename);
54
+ const key = randomBytes(32);
55
+ try {
56
+ await writeFile(filename, key, { flag: "wx", mode: 384 });
57
+ if (process.platform !== "win32") await chmod(filename, 384).catch(() => void 0);
58
+ return key;
59
+ } catch {
60
+ return readFile(filename);
61
+ }
62
+ }
63
+ function encode(value) {
64
+ return Buffer.from(JSON.stringify(value)).toString("base64url");
65
+ }
66
+ function signature(payload, key) {
67
+ return createHmac("sha256", key).update(payload).digest("base64url");
68
+ }
69
+ function createMeetingContinuationSigner(ctx) {
70
+ return {
71
+ async issue(payload, ttlMs = 10 * 6e4) {
72
+ const issuedAt = Date.now();
73
+ const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
74
+ const sig = signature(body, await loadKey(ctx));
75
+ return `${body}.${sig}`;
76
+ },
77
+ async verify(token, expectedOperation) {
78
+ if (typeof token !== "string" || !token.includes(".")) {
79
+ throw meetingValidationError("continuation_invalid", "continuation \u65E0\u6548");
80
+ }
81
+ const [body, provided] = token.split(".");
82
+ const expected = signature(body, await loadKey(ctx));
83
+ const valid = provided.length === expected.length && timingSafeEqual(Buffer.from(provided), Buffer.from(expected));
84
+ if (!valid) throw meetingValidationError("continuation_invalid", "continuation \u7B7E\u540D\u6821\u9A8C\u5931\u8D25");
85
+ let value;
86
+ try {
87
+ value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
88
+ } catch {
89
+ throw meetingValidationError("continuation_invalid", "continuation \u5185\u5BB9\u65E0\u6CD5\u89E3\u6790");
90
+ }
91
+ if (value.operation !== expectedOperation) {
92
+ throw meetingValidationError("continuation_mismatch", "continuation \u4E0D\u5C5E\u4E8E\u5F53\u524D\u64CD\u4F5C");
93
+ }
94
+ if (!Number.isSafeInteger(value.expiresAt) || value.expiresAt < Date.now()) {
95
+ throw meetingValidationError("continuation_expired", "continuation \u5DF2\u8FC7\u671F");
96
+ }
97
+ return value;
98
+ }
99
+ };
100
+ }
101
+
102
+ // src/shortcuts/meeting/host.ts
103
+ function inferProfile(ctx) {
104
+ const options = ctx.getGlobalOptions();
105
+ return options.profile || getActiveProfile();
106
+ }
107
+ function isBusinessSuccess(value) {
108
+ if (!value || typeof value !== "object") return false;
109
+ if (typeof value.status === "boolean") return value.status;
110
+ if (value.code !== void 0 && value.code !== null) return Number(value.code) === 200;
111
+ return false;
112
+ }
113
+ function businessMessage(value) {
114
+ if (!value || typeof value !== "object") return "\u6CDB\u5FAE\u63A5\u53E3\u8FD4\u56DE\u4E1A\u52A1\u5931\u8D25";
115
+ const candidates = [
116
+ value.msg,
117
+ value.message,
118
+ value.errMsg,
119
+ value.actionMsg?.message,
120
+ value.actionMsg?.msg,
121
+ value.data?.message,
122
+ value.data?.msg,
123
+ // EB(eBuilder formdata)把业务提示放在 datajson 内层:漏掉它时 EB 失败只剩一句
124
+ // “泛微接口返回业务失败”,真实原因(字段/权限/参数)全丢,排查成本极高。
125
+ value.datajson?.msg,
126
+ value.datajson?.message,
127
+ value.datajson?.errMsg,
128
+ value.datajson?.errorMsg,
129
+ value.datajson?.errorMessage
130
+ ];
131
+ for (const item of candidates) {
132
+ if (typeof item === "string" && item.trim()) return item;
133
+ }
134
+ try {
135
+ const raw = JSON.stringify(value);
136
+ if (raw && raw !== "{}" && raw !== "null") return `\u6CDB\u5FAE\u63A5\u53E3\u8FD4\u56DE\u4E1A\u52A1\u5931\u8D25\uFF1A${raw.slice(0, 300)}`;
137
+ } catch {
138
+ }
139
+ return "\u6CDB\u5FAE\u63A5\u53E3\u8FD4\u56DE\u4E1A\u52A1\u5931\u8D25";
140
+ }
141
+ function businessCode(value) {
142
+ if (!value || typeof value !== "object") return void 0;
143
+ const code = value.code ?? value.status;
144
+ if (typeof code === "string" || typeof code === "number") return code;
145
+ return void 0;
146
+ }
147
+ function assertPath(requestPath) {
148
+ if (typeof requestPath !== "string" || !requestPath.startsWith("/") || requestPath.startsWith("//")) {
149
+ throw meetingValidationError("path_invalid", "\u8BF7\u6C42\u8DEF\u5F84\u5FC5\u987B\u662F\u76F8\u5BF9\u7EDD\u5BF9\u8DEF\u5F84");
150
+ }
151
+ if (/^https?:/i.test(requestPath) || /[\r\n]/.test(requestPath) || requestPath.includes("/../")) {
152
+ throw meetingValidationError("path_invalid", "\u8BF7\u6C42\u8DEF\u5F84\u4E0D\u5141\u8BB8\u8DE8\u57DF\u6216\u8DEF\u5F84\u9003\u9038");
153
+ }
154
+ if (!requestPath.startsWith("/api/")) {
155
+ throw meetingValidationError("path_not_allowed", "\u4F1A\u8BAE\u6A21\u5757\u53EA\u80FD\u8C03\u7528 /api/ \u8DEF\u5F84");
156
+ }
157
+ }
158
+ function omitEmptyQueryValues(query) {
159
+ if (!query) return void 0;
160
+ return Object.fromEntries(Object.entries(query).filter(([, value]) => value !== "" && value !== void 0));
161
+ }
162
+ function mapRuntimeNetworkError(error) {
163
+ if (error instanceof E10ApiError && error.type === "network") {
164
+ throw meetingNetworkError(error.subtype, error.message, {
165
+ retryable: error.retryable,
166
+ details: error.details
167
+ });
168
+ }
169
+ throw error;
170
+ }
171
+ function createMeetingHost(ctx, dependencies = {}) {
172
+ let e10Session = null;
173
+ let sessionContext = null;
174
+ const requireSession = dependencies.requireSession || requireE10Session;
175
+ async function ensureSession() {
176
+ if (!e10Session) {
177
+ e10Session = await requireSession(ctx);
178
+ sessionContext = {
179
+ baseUrl: e10Session.getBaseUrl(),
180
+ profile: inferProfile(ctx),
181
+ userId: e10Session.userId,
182
+ tenantKey: e10Session.tenantKey,
183
+ eteamsId: e10Session.eteamsId
184
+ };
185
+ }
186
+ return e10Session;
187
+ }
188
+ async function getSession() {
189
+ await ensureSession();
190
+ return sessionContext;
191
+ }
192
+ async function download(request2) {
193
+ const session = await ensureSession();
194
+ const url = new URL(request2.path, session.getBaseUrl());
195
+ for (const [key, value] of Object.entries(request2.query ?? {})) {
196
+ if (value !== void 0 && value !== null && String(value) !== "") url.searchParams.set(key, String(value));
197
+ }
198
+ const controller = new AbortController();
199
+ const timer = setTimeout(() => controller.abort(), request2.timeoutMs ?? 6e4);
200
+ try {
201
+ const response = await (dependencies.fetch || globalThis.fetch)(url.toString(), {
202
+ headers: {
203
+ accept: "*/*",
204
+ cookie: session.cookieHeader(),
205
+ eteamsid: session.eteamsId,
206
+ "user-agent": session.uaHeader(),
207
+ origin: session.getBaseUrl()
208
+ },
209
+ redirect: "manual",
210
+ signal: controller.signal
211
+ });
212
+ if (response.status === 401 || response.status === 302) {
213
+ throw meetingAuthError("session_expired", "\u767B\u5F55\u6001\u5DF2\u5931\u6548\uFF1A\u4E0B\u8F7D\u9700\u6709\u6548\u767B\u5F55\u6001\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u540E\u91CD\u8BD5", { httpStatus: response.status });
214
+ }
215
+ if (response.status !== 200) {
216
+ throw new MeetingCliError("api", "download_failed", `\u4E0B\u8F7D\u5931\u8D25 HTTP ${response.status}`, {
217
+ code: response.status,
218
+ exitCode: 1
219
+ });
220
+ }
221
+ return {
222
+ buffer: Buffer.from(await response.arrayBuffer()),
223
+ contentType: response.headers.get("content-type") ?? "",
224
+ contentDisposition: response.headers.get("content-disposition") ?? ""
225
+ };
226
+ } finally {
227
+ clearTimeout(timer);
228
+ }
229
+ }
230
+ async function runtime() {
231
+ return createE10RequestRuntime(ctx, await ensureSession(), {
232
+ interceptors: dependencies.interceptors,
233
+ fetch: dependencies.fetch
234
+ });
235
+ }
236
+ async function request(request2) {
237
+ const { method, path, query, body, formData, operation, headers: extraHeaders = {}, timeoutMs = 3e4 } = request2;
238
+ assertPath(path);
239
+ const resolvedMethod = method || (body === void 0 && formData === void 0 ? "GET" : "POST");
240
+ let response;
241
+ try {
242
+ response = await (await runtime()).requestJson({
243
+ module: "meeting",
244
+ operation,
245
+ method: resolvedMethod,
246
+ path,
247
+ query: omitEmptyQueryValues(query),
248
+ body,
249
+ // 文件上传:multipart 体由 runtime 直接交给 fetch(不设 Content-Type,交给 fetch 生成 boundary)
250
+ ...formData ? { formData } : {},
251
+ headers: { ...extraHeaders },
252
+ // 会议接口存在裸数字长 ID(如 meetingExtend.mtId / creater),超 2^53 会被
253
+ // JSON.parse 舍入;开启大整数保护后按字符串保留,保证 ID 回查不失真。
254
+ bigIntStrings: true,
255
+ timeoutMs
256
+ });
257
+ } catch (error) {
258
+ mapRuntimeNetworkError(error);
259
+ }
260
+ if (response.status === 401 || response.status === 302) {
261
+ throw meetingAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
262
+ }
263
+ if (response.parseError) {
264
+ if (response.status < 200 || response.status >= 300) {
265
+ throw new MeetingCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
266
+ code: response.status,
267
+ details: { status: response.status },
268
+ exitCode: 1
269
+ });
270
+ }
271
+ throw meetingNetworkError("protocol", `\u63A5\u53E3\u8FD4\u56DE\u4E0D\u662F\u5408\u6CD5 JSON\uFF08HTTP ${response.status}\uFF09`, { retryable: false });
272
+ }
273
+ if (response.status < 200 || response.status >= 300) {
274
+ throw new MeetingCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
275
+ code: response.status,
276
+ details: { status: response.status, message: businessMessage(response.value) },
277
+ exitCode: 1
278
+ });
279
+ }
280
+ const acceptBusiness = request2.acceptBusiness ?? isBusinessSuccess;
281
+ if (!acceptBusiness(response.value)) {
282
+ const code = businessCode(response.value);
283
+ const message = businessMessage(response.value);
284
+ if (code === 403) {
285
+ throw new MeetingCliError("api", "permission_denied", message || "\u5F53\u524D\u79DF\u6237\u672A\u5F00\u653E\u8BE5\u4F1A\u8BAE\u63A5\u53E3\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458", {
286
+ code,
287
+ details: { code, message },
288
+ exitCode: 1
289
+ });
290
+ }
291
+ throw new MeetingCliError("api", "business_error", message, {
292
+ code,
293
+ details: { code, message },
294
+ exitCode: 1
295
+ });
296
+ }
297
+ return response.value;
298
+ }
299
+ return { request, getSession, download };
300
+ }
301
+
302
+ // src/shortcuts/meeting/manifest.ts
303
+ var WITHHELD = [
304
+ {
305
+ name: "meeting.create.workflow",
306
+ reason: "onlyFlowCreate=1 \u6216\u5468\u671F\u4F1A\u8BAE\u914D\u7F6E\u5DE5\u4F5C\u6D41\u65F6\u5FC5\u987B\u8D70\u6D41\u7A0B\u5EFA\u4F1A\uFF1BCLI v1 \u672A\u96C6\u6210\u5DE5\u4F5C\u6D41\u53D1\u8D77\uFF0Ccreate.prepare \u4F1A\u4E3B\u52A8\u62D2\u7EDD\u3002"
307
+ },
308
+ {
309
+ name: "meeting.over",
310
+ reason: "\u670D\u52A1\u7AEF\u63D0\u524D\u7ED3\u675F\u4F1A\u8BAE\uFF08overMeeting\uFF09\u4E3A\u7A7A\u5B9E\u73B0\uFF1AMeetingDetailController.overMeetingDetail \u4E2D service \u8C03\u7528\u88AB\u6CE8\u91CA\uFF0C\u63A5\u53E3\u76F4\u63A5\u8FD4\u56DE\u6210\u529F\u4F46\u4E0D\u751F\u6548\uFF1BCLI \u4E0D\u63D0\u4F9B\u8BE5\u80FD\u529B\uFF0C\u7981\u6B62\u7ED5\u8FC7\uFF08\u8C03\u7528\u53EA\u4F1A\u5F97\u5230\u201C\u5047\u6210\u529F\u201D\uFF09\u3002"
311
+ },
312
+ {
313
+ name: "meeting.sign.qrcode",
314
+ reason: "\u7B7E\u5230\u4E8C\u7EF4\u7801\uFF08getQrCode / downLoadQrCode\uFF09\u4E0E\u5927\u5C4F\u7B7E\u5230\u672A\u5B9E\u73B0\uFF1A\u5165\u53C2\u5951\u7EA6\u672A\u786E\u8BA4\u4E14\u5C5E\u5927\u5C4F/\u626B\u7801\u573A\u666F\uFF0C\u4E0D\u5F97\u731C\u6D4B\u53C2\u6570\u3002"
315
+ },
316
+ {
317
+ name: "meeting.sign.scan",
318
+ reason: "\u672C\u4EBA\u626B\u7801\u7B7E\u5230\uFF08signMeeting\uFF09\u4E0D\u63D0\u4F9B\uFF1A\u4F9D\u8D56\u73B0\u573A\u4E8C\u7EF4\u7801\u7968\u636E\uFF08qrticket\uFF09\u4E0E\u8BBE\u5907 IP\uFF0C\u7531 AI \u4EE3\u7B7E\u4F1A\u7834\u574F\u7B7E\u5230\u771F\u5B9E\u6027\uFF1B\u8BF7\u5F15\u5BFC\u7528\u6237\u73B0\u573A\u626B\u7801\u6216\u8D70 H5 \u7B7E\u5230\u3002\u8865\u7B7E/\u8865\u7B7E\u9000/\u6E05\u9664\u7B7E\u5230\u8BF7\u7528 meeting.sign.mark/back/clear\uFF08\u9700\u786E\u8BA4\u94FE\uFF09\u3002"
319
+ },
320
+ {
321
+ name: "meeting.recycle.*",
322
+ reason: "\u56DE\u6536\u7AD9\uFF08getMeetingRecycleList / restoreMeetingRecycle / forceRestoreMeetingRecycle / cleanMeetingRecycleList\uFF09\u672A\u5B9E\u73B0\u3002\u6CE8\u610F delete \u662F\u8F6F\u5220\uFF08mt_detail.delete_type=2\uFF0C\u4F1A\u8BAE\u8FDB\u56DE\u6536\u7AD9\u53EF\u8FD8\u539F\uFF09\uFF0CCLI \u6682\u65E0\u8FD8\u539F\u80FD\u529B\uFF0C\u5982\u9700\u6062\u590D\u8BF7\u5F15\u5BFC\u7528\u6237\u5230\u4F1A\u8BAE\u56DE\u6536\u7AD9\u9875\u9762\u64CD\u4F5C\u3002"
323
+ },
324
+ {
325
+ name: "meeting.room.admin / meeting.type.admin",
326
+ reason: "**\u6807\u51C6\u7248**\u4F1A\u8BAE\u5BA4/\u4F1A\u8BAE\u7C7B\u578B\u7BA1\u7406\u63A5\u53E3\uFF08add/update/delete/lock\uFF09\u672A\u5B9E\u73B0\uFF1BEB \u7248\u8BF7\u7528 meeting.eb.room.create/update/delete \u4E0E meeting.eb.type.create/delete\u3002"
327
+ }
328
+ ];
329
+ function buildOperations() {
330
+ return meetingOperationDefinitions().map((definition) => ({
331
+ name: definition.name,
332
+ resource: definition.resource,
333
+ summary: definition.summary,
334
+ capability: definition.capability,
335
+ risk: definition.risk,
336
+ ...definition.requiresConfirmation ? { requiresConfirmation: true } : {},
337
+ inputSchema: definition.inputSchema
338
+ }));
339
+ }
340
+ var meetingManifest = {
341
+ schemaVersion: 1,
342
+ name: "meeting",
343
+ title: "\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406\uFF08\u53CC\u6A21\u5F0F\uFF1A\u6807\u51C6\u7248 Java REST + EB \u7248 eBuilder\uFF09",
344
+ version: "1.0.0",
345
+ host: "e10-meeting",
346
+ status: "builtin",
347
+ sourceSkill: "weaver-e10-meeting",
348
+ capabilities: ["env", "meeting", "room", "type", "conflict", "lifecycle", "receipt", "sign", "eb"],
349
+ operations: buildOperations(),
350
+ withheldOperations: WITHHELD
351
+ };
352
+
353
+ // src/shortcuts/meeting/operations.ts
354
+ import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
355
+ import { dirname, join } from "node:path";
356
+ function recordCall(context, operation, startedAt, ok, errorType) {
357
+ try {
358
+ const file = join(meetingStateDir(context.ctx), "logs", "calls.jsonl");
359
+ const line = JSON.stringify({
360
+ at: (/* @__PURE__ */ new Date()).toISOString(),
361
+ operation,
362
+ ms: Date.now() - startedAt,
363
+ ok,
364
+ ...errorType ? { errorType } : {}
365
+ });
366
+ void mkdir2(dirname(file), { recursive: true }).then(() => appendFile(file, `${line}
367
+ `, "utf8")).catch(() => void 0);
368
+ } catch {
369
+ }
370
+ }
371
+ async function executeMeetingOperation(operation, rawInput, context) {
372
+ const definition = getMeetingOperation(operation);
373
+ const input = asObject(rawInput);
374
+ assertNoForbiddenKeys(input);
375
+ const host = {
376
+ request(request) {
377
+ return context.host.request({
378
+ ...request,
379
+ operation: request.operation || operation
380
+ });
381
+ },
382
+ getSession() {
383
+ return context.host.getSession();
384
+ },
385
+ // 二进制下载必须透传:漏掉它会让 meeting.attachment.download/extract 报"host 不支持下载"
386
+ // (包装 host 只挑两个方法时最容易被漏掉,2026-10-28 真机踩过)。
387
+ ...context.host.download ? { download: (request) => context.host.download(request) } : {}
388
+ };
389
+ const startedAt = Date.now();
390
+ try {
391
+ const envelope = await definition.handler(input, { ...context, host });
392
+ recordCall(context, operation, startedAt, true);
393
+ return envelope;
394
+ } catch (error) {
395
+ recordCall(context, operation, startedAt, false, String(error?.type ?? "unknown"));
396
+ throw error;
397
+ }
398
+ }
399
+
400
+ // src/shortcuts/meeting/index.ts
401
+ function asOptions(value) {
402
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
403
+ }
404
+ async function readStdin() {
405
+ const chunks = [];
406
+ for await (const chunk of process.stdin) {
407
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
408
+ }
409
+ return Buffer.concat(chunks).toString("utf8");
410
+ }
411
+ function stripBom(value) {
412
+ return value.replace(/^\uFEFF+/, "");
413
+ }
414
+ async function inputFrom(options, extra = {}) {
415
+ const opts = asOptions(options);
416
+ let input = {};
417
+ if (opts.input && opts.inputJson) {
418
+ throw meetingValidationError("input_conflict", "\u4E0D\u80FD\u540C\u65F6\u4F20 --input \u548C --input-json");
419
+ }
420
+ if (opts.inputJson) {
421
+ input = parseJsonInput(String(opts.inputJson), "--input-json");
422
+ }
423
+ if (opts.input) {
424
+ let raw;
425
+ try {
426
+ raw = stripBom(opts.input === "-" ? await readStdin() : await readFile2(String(opts.input), "utf8"));
427
+ } catch {
428
+ throw meetingValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
429
+ }
430
+ input = parseJsonInput(raw, "--input");
431
+ }
432
+ return {
433
+ ...input,
434
+ ...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== void 0 && value !== ""))
435
+ };
436
+ }
437
+ function parseJsonInput(raw, label) {
438
+ try {
439
+ const parsed = JSON.parse(stripBom(raw));
440
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
441
+ throw new Error("input must be an object");
442
+ }
443
+ return parsed;
444
+ } catch {
445
+ throw meetingValidationError("input_invalid", `${label} \u4E0D\u662F\u5408\u6CD5 JSON \u5BF9\u8C61`);
446
+ }
447
+ }
448
+ function successEnvelope(operation, result) {
449
+ return {
450
+ schemaVersion: 1,
451
+ ok: true,
452
+ operation,
453
+ data: result.data === void 0 ? null : result.data,
454
+ ...result.meta ? { meta: result.meta } : {},
455
+ ...result.warnings && result.warnings.length > 0 ? { warnings: result.warnings } : { warnings: [] }
456
+ };
457
+ }
458
+ function failureEnvelope(error) {
459
+ const structured = error;
460
+ return {
461
+ schemaVersion: 1,
462
+ ok: false,
463
+ ...structured?.partialData === void 0 ? {} : { data: structured.partialData },
464
+ error: toErrorEnvelope(error)
465
+ };
466
+ }
467
+ async function executeAndPrint(ctx, operation, input) {
468
+ try {
469
+ const result = await executeMeetingOperation(operation, input, {
470
+ ctx,
471
+ host: createMeetingHost(ctx),
472
+ continuation: createMeetingContinuationSigner(ctx)
473
+ });
474
+ ctx.output.write(successEnvelope(operation, result), { json: true });
475
+ } catch (error) {
476
+ console.error(JSON.stringify(failureEnvelope(error), null, 2));
477
+ process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
478
+ }
479
+ }
480
+ var meetingShortcut = {
481
+ name: "meeting",
482
+ description: "\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406 CLI\uFF08\u6807\u51C6\u7248\uFF1A\u67E5\u8BE2/\u51B2\u7A81/\u9884\u7EA6/\u56DE\u6267/\u7B7E\u5230\uFF09",
483
+ category: "shortcut",
484
+ register({ program, action }) {
485
+ const meeting = program.command("meeting").description("\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406\uFF08\u6A21\u5F0F\u63A2\u6D4B/\u4F1A\u8BAE\u5217\u8868/\u4F1A\u8BAE\u5BA4/\u7C7B\u578B/\u51B2\u7A81\u68C0\u6D4B/\u9884\u7EA6/\u56DE\u6267/\u7B7E\u5230\uFF09");
486
+ meeting.command("schema").description("Print meeting operation manifest for agents").action(action((ctx) => {
487
+ ctx.output.write(meetingManifest, { json: true });
488
+ }));
489
+ meeting.command("run").description("Run a meeting operation with JSON input").argument("<operation>", "operation name, e.g. meeting.room.list").option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object").action(action(async (ctx, operation, options) => {
490
+ await executeAndPrint(ctx, String(operation), await inputFrom(options));
491
+ }));
492
+ meeting.command("today").description("\u67E5\u8BE2\u4ECA\u5929\u7684\u4F1A\u8BAE\uFF08meeting.list \u8584\u5305\u88C5\uFF09").action(action(async (ctx) => {
493
+ const today = /* @__PURE__ */ new Date();
494
+ const pad = (value) => String(value).padStart(2, "0");
495
+ const date = `${today.getFullYear()}-${pad(today.getMonth() + 1)}-${pad(today.getDate())}`;
496
+ await executeAndPrint(ctx, "meeting.list", { filterDate: date });
497
+ }));
498
+ }
499
+ };
500
+ export {
501
+ inputFrom,
502
+ meetingShortcut,
503
+ successEnvelope
504
+ };
@@ -0,0 +1,41 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ MSG_TYPES,
5
+ collapseNewlines,
6
+ collectI18nIds,
7
+ collectMentionMap,
8
+ collectPersonIds,
9
+ escapePipe,
10
+ extractFiles,
11
+ extractImgs,
12
+ extractTxt,
13
+ extractVideos,
14
+ getTypeName,
15
+ parseContent,
16
+ parseMsg,
17
+ parseSysMsg,
18
+ replaceMentions,
19
+ senderName,
20
+ substituteTemplate
21
+ } from "./chunk-YLCYX7LE.js";
22
+ import "./chunk-BUSC6UAE.js";
23
+ export {
24
+ MSG_TYPES,
25
+ collapseNewlines,
26
+ collectI18nIds,
27
+ collectMentionMap,
28
+ collectPersonIds,
29
+ escapePipe,
30
+ extractFiles,
31
+ extractImgs,
32
+ extractTxt,
33
+ extractVideos,
34
+ getTypeName,
35
+ parseContent,
36
+ parseMsg,
37
+ parseSysMsg,
38
+ replaceMentions,
39
+ senderName,
40
+ substituteTemplate
41
+ };