weaver-work-cli 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chunks/{archive-UMGX72K6.js → archive-FVFY6GZN.js} +2 -2
- package/dist/chunks/{archive-oa-N2IYBLF3.js → archive-oa-NW3OD4UV.js} +2 -2
- package/dist/chunks/{asset-GLEGKFG5.js → asset-7QJKMIDV.js} +2 -2
- package/dist/chunks/{attachment-content-AQNX5N3S.js → attachment-content-OSAVA6K3.js} +3 -2
- package/dist/chunks/{blog-E44OTVDA.js → blog-I7SDPNW4.js} +2 -2
- package/dist/chunks/{caizhilian-DQUFZXZL.js → caizhilian-O37ZIQNY.js} +2 -2
- package/dist/chunks/{calendar-JKPIRKFD.js → calendar-7KXE4ED3.js} +2 -2
- package/dist/chunks/{chunk-4YC43QQ4.js → chunk-2FLWXFVS.js} +4 -4
- package/dist/chunks/{chunk-QWY6PGL6.js → chunk-2LV74IWP.js} +361 -56
- package/dist/chunks/chunk-3SO6QL6U.js +73 -0
- package/dist/chunks/{chunk-DW6AUUKS.js → chunk-6ATGWRZM.js} +6 -4
- package/dist/chunks/chunk-BYATLLEF.js +68 -0
- package/dist/chunks/chunk-BYBSCN4X.js +932 -0
- package/dist/chunks/{chunk-2GA5ZIQL.js → chunk-D223PTXU.js} +1 -0
- package/dist/chunks/{chunk-H7J4DC5R.js → chunk-EEWPQE3O.js} +2 -2
- package/dist/chunks/{chunk-6RKD4DRZ.js → chunk-GFPXQIY2.js} +2 -2
- package/dist/chunks/{chunk-C6R3B2ML.js → chunk-HEL5XTYI.js} +12 -6
- package/dist/chunks/{chunk-CVZ2JOSW.js → chunk-IHUYP6LO.js} +1 -1
- package/dist/chunks/{chunk-YRVDW4WN.js → chunk-ILMBNVSG.js} +2 -2
- package/dist/chunks/{chunk-G3QJULO2.js → chunk-KAS45KNR.js} +1 -1
- package/dist/chunks/{chunk-H6XSTSLM.js → chunk-MEEFGWTM.js} +54 -196
- package/dist/chunks/{chunk-GCG2NMWR.js → chunk-MQ2I5AA3.js} +4 -2
- package/dist/chunks/chunk-NHA62QD7.js +774 -0
- package/dist/chunks/{chunk-WKI2FBIQ.js → chunk-OCU4RLHC.js} +641 -309
- package/dist/chunks/{chunk-WSKBSQ2U.js → chunk-PRHJGPMA.js} +2 -2
- package/dist/chunks/{chunk-6EFWDL7Y.js → chunk-Q6LWB5HX.js} +2 -2
- package/dist/chunks/{chunk-IURUFGZK.js → chunk-RBGOMK4Y.js} +50 -33
- package/dist/chunks/chunk-VBCFFFGT.js +226 -0
- package/dist/chunks/{ebuilder-form-V5FG2EHC.js → chunk-WRRJ4GG2.js} +22 -1148
- package/dist/chunks/{chunk-E4Z23GHM.js → chunk-WY74UBJ6.js} +264 -750
- package/dist/chunks/conflict-SFNEVJY5.js +21 -0
- package/dist/chunks/continuation-RN6PZN2M.js +11 -0
- package/dist/chunks/cowork-CKWYHXYB.js +2508 -0
- package/dist/chunks/ebuilder-form-KOLJRVZD.js +121 -0
- package/dist/chunks/{ehr-HMFY6VIL.js → ehr-WFOC3B4D.js} +1174 -20
- package/dist/chunks/{esb-ZYSVB7SG.js → esb-LJZTN663.js} +4 -4
- package/dist/chunks/{fna-B7RKPAZD.js → fna-F7QRIIZC.js} +2 -2
- package/dist/chunks/{host-45WED2KK.js → host-BCGUVEWX.js} +3 -3
- package/dist/chunks/host-BQBRHVR3.js +23 -0
- package/dist/chunks/{host-I4Z6BFYX.js → host-DGE2TZD4.js} +3 -3
- package/dist/chunks/{host-KNZ52LJZ.js → host-KXPTEWFS.js} +3 -3
- package/dist/chunks/{host-OCH2BCCV.js → host-VQ6JJXGQ.js} +3 -3
- package/dist/chunks/{hrm-2KAZGUHI.js → hrm-NI6XAKW5.js} +3 -3
- package/dist/chunks/{im-ACJJWH4U.js → im-7TRTF3KT.js} +88 -12
- package/dist/chunks/{invoice-ZK3WCX2U.js → invoice-AOXWJKYT.js} +3 -3
- package/dist/chunks/{jiuchuanhui-5PQD3IL2.js → jiuchuanhui-7NQWEZAW.js} +2 -2
- package/dist/chunks/{lazy-dispatch-JQXBW3GM.js → lazy-dispatch-RNS4EE4S.js} +4 -4
- package/dist/chunks/{mail-S2HDDXO2.js → mail-VDHJAB4O.js} +3 -3
- package/dist/chunks/{meeting-QVN3I37L.js → meeting-GA7XCNNP.js} +214 -43
- package/dist/chunks/{okr-QNG4VC2Q.js → okr-TQIRERPQ.js} +2 -2
- package/dist/chunks/operations-5QL3AECO.js +11 -0
- package/dist/chunks/{plan-A25EMW6U.js → plan-4RY4LN2P.js} +2 -2
- package/dist/chunks/{project-G6XV66DZ.js → project-D6XT2OC5.js} +2 -2
- package/dist/chunks/{registry-DC6KR3NH.js → registry-JHRIDQ3A.js} +4 -4
- package/dist/chunks/{registry-2VLUAESA.js → registry-OZSMDVPP.js} +2 -2
- package/dist/chunks/{registry-TI3CIUXF.js → registry-QKMI43Q6.js} +8 -6
- package/dist/chunks/{registry-7C5UMIPL.js → registry-VOGKFFTR.js} +2 -2
- package/dist/chunks/{room-recommend-WRTHO6Y2.js → room-recommend-D4EUOOWY.js} +4 -3
- package/dist/chunks/{schedule-KFIITGSK.js → schedule-XPFBHPCV.js} +4 -3
- package/dist/chunks/{workflow-DJ7SYWAF.js → workflow-HLBZRWIY.js} +172 -6
- package/dist/index.js +30 -25
- package/dist/internal/e10/auth-recovery.js +14 -4
- package/dist/shortcuts/contract/host.js +34 -59
- package/dist/shortcuts/cowork/continuation.js +70 -0
- package/dist/shortcuts/cowork/errors.js +59 -0
- package/dist/shortcuts/cowork/host.js +172 -0
- package/dist/shortcuts/cowork/index.js +166 -0
- package/dist/shortcuts/cowork/manifest.js +65 -0
- package/dist/shortcuts/cowork/operations/discuss-write.js +277 -0
- package/dist/shortcuts/cowork/operations/item-write.js +380 -0
- package/dist/shortcuts/cowork/operations/member-write.js +283 -0
- package/dist/shortcuts/cowork/operations/permission-write.js +286 -0
- package/dist/shortcuts/cowork/operations/read.js +423 -0
- package/dist/shortcuts/cowork/operations/registry.js +39 -0
- package/dist/shortcuts/cowork/operations/review-write.js +157 -0
- package/dist/shortcuts/cowork/operations/shared.js +215 -0
- package/dist/shortcuts/cowork/operations/types.js +24 -0
- package/dist/shortcuts/cowork/operations.js +19 -0
- package/dist/shortcuts/ehr/host.js +4 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +757 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +367 -0
- package/dist/shortcuts/ehr/operations/recruit-stats.js +133 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +8 -16
- package/dist/shortcuts/ehr/operations/recruit.js +35 -10
- package/dist/shortcuts/ehr/operations/registry.js +6 -0
- package/dist/shortcuts/im/diagnostics.js +97 -0
- package/dist/shortcuts/im/host.js +58 -31
- package/dist/shortcuts/im/index.js +7 -2
- package/dist/shortcuts/im/operations/at-mention.js +127 -0
- package/dist/shortcuts/im/operations/file-user.js +10 -2
- package/dist/shortcuts/im/operations/group-read.js +26 -5
- package/dist/shortcuts/im/operations/group-write.js +35 -28
- package/dist/shortcuts/im/operations/msg-sync.js +7 -2
- package/dist/shortcuts/im/operations/msg-write.js +76 -10
- package/dist/shortcuts/im/operations/quote-mention.js +119 -0
- package/dist/shortcuts/im/operations/session.js +1 -1
- package/dist/shortcuts/im/operations/shared.js +10 -0
- package/dist/shortcuts/im/operations/types.js +13 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/host.js +4 -1
- package/dist/shortcuts/meeting/host.js +27 -34
- package/dist/shortcuts/meeting/operations/create.js +4 -1
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +78 -7
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +168 -26
- package/dist/shortcuts/meeting/operations/eb/factory.js +69 -1
- package/dist/shortcuts/meeting/operations/eb/index.js +16 -3
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +14 -3
- package/dist/shortcuts/meeting/operations/eb-fallback.js +159 -0
- package/dist/shortcuts/meeting/operations/env.js +93 -46
- package/dist/shortcuts/meeting/operations/form-fields.js +110 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/meeting/operations/standard-guard.js +71 -0
- package/dist/shortcuts/meeting/operations.js +16 -0
- package/dist/shortcuts/workflow/index.js +110 -1
- package/dist/shortcuts/workflow/operations/form.js +24 -3
- package/dist/shortcuts/workflow/operations/read.js +104 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +448 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +106 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/businessRules.js +47 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +30 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +2 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +2 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +138 -181
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +12 -7
- package/docs/e10-auth.md +1 -1
- package/docs/im.md +8 -1
- package/docs/todo-smart-convert/README.md +1 -1
- package/docs/todo-smart-convert/data-contract.md +2 -2
- package/docs/todo-smart-convert/subgroup-rules.md +6 -0
- package/package.json +1 -1
- package/skill-template/domains/yimiaoban.md +3 -3
- package/skill-template/skill-template.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +5 -5
- package/skills/weaver-e10-caizhilian/SKILL.md +5 -5
- package/skills/weaver-e10-calendar/SKILL.md +5 -5
- package/skills/weaver-e10-esb/SKILL.md +5 -5
- package/skills/weaver-e10-hrm/SKILL.md +5 -5
- package/skills/weaver-e10-jinchengda/SKILL.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -5
- package/skills/weaver-e10-jucailin/SKILL.md +18 -12
- package/skills/weaver-e10-jucailin/references/recruit-create.md +104 -0
- package/skills/weaver-e10-mail/SKILL.md +5 -5
- package/skills/weaver-e10-meeting/SKILL.md +171 -25
- package/skills/weaver-e10-meeting/references/meeting-eb.md +4 -3
- package/skills/weaver-e10-meeting/references/meeting-queries.md +9 -6
- package/skills/weaver-e10-meeting/references/meeting-verification.md +8 -6
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-okr/SKILL.md +5 -5
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +5 -5
- package/skills/weaver-e10-shared/SKILL.md +12 -12
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -4
- package/skills/weaver-e10-wenshuding/SKILL.md +5 -5
- package/skills/weaver-e10-workflow/SKILL.md +29 -5
- package/skills/weaver-e10-workflow/aigroup/default.json +88 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +66 -14
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +12 -10
- package/skills/weaver-e10-workflow/references/workflow-view.md +2 -2
- package/skills/weaver-e10-workflow/tools/todo-serve.cjs +239 -0
- package/skills/weaver-e10-workflow/{scripts → tools}/todo-summary.cjs +218 -28
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +10 -10
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +40 -37
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +27 -38
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +37 -29
- package/skills/weaver-e10-yimiaoban/SKILL.md +156 -33
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/error-codes.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-read.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-write.md +6 -4
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +34 -2
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +5 -2
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +79 -58
- package/skills/weaver-e10-yimiaoban/references/user-remind.md +2 -2
- package/skills/weaver-e10-ziguanjia/SKILL.md +5 -5
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createE10RequestRuntime,
|
|
10
10
|
requireE10Session
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6ATGWRZM.js";
|
|
12
12
|
import {
|
|
13
13
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
14
14
|
getActiveProfile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-D223PTXU.js";
|
|
16
16
|
|
|
17
17
|
// src/shortcuts/workflow/host.ts
|
|
18
18
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
E10ApiError,
|
|
11
11
|
createE10RequestRuntime,
|
|
12
12
|
requireE10Session
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6ATGWRZM.js";
|
|
14
14
|
import {
|
|
15
15
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
16
16
|
getActiveProfile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D223PTXU.js";
|
|
18
18
|
|
|
19
19
|
// src/shortcuts/hrm/host.ts
|
|
20
20
|
function inferProfile(ctx) {
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
E10ApiError,
|
|
11
11
|
createE10RequestRuntime,
|
|
12
12
|
requireE10Session
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6ATGWRZM.js";
|
|
14
14
|
import {
|
|
15
15
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
16
16
|
getActiveProfile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D223PTXU.js";
|
|
18
18
|
|
|
19
19
|
// src/shortcuts/im/host.ts
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
@@ -113,7 +113,8 @@ function createImHost(ctx, dependencies = {}) {
|
|
|
113
113
|
async function runtime() {
|
|
114
114
|
return createE10RequestRuntime(ctx, await ensureSession(), {
|
|
115
115
|
interceptors: dependencies.interceptors,
|
|
116
|
-
fetch: dependencies.fetch
|
|
116
|
+
fetch: dependencies.fetch,
|
|
117
|
+
recoverAuthentication: dependencies.recoverAuthentication
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
async function request(request2) {
|
|
@@ -172,38 +173,48 @@ function createImHost(ctx, dependencies = {}) {
|
|
|
172
173
|
}
|
|
173
174
|
async function requestBinary(url, headers = {}) {
|
|
174
175
|
const session = await ensureSession();
|
|
175
|
-
const
|
|
176
|
-
|
|
176
|
+
const baseUrl = new URL(session.getBaseUrl());
|
|
177
|
+
let target;
|
|
177
178
|
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
target = new URL(url, baseUrl);
|
|
180
|
+
} catch {
|
|
181
|
+
throw imValidationError("download_url_invalid", "\u4E0B\u8F7D\u5730\u5740\u4E0D\u662F\u5408\u6CD5 URL");
|
|
182
|
+
}
|
|
183
|
+
if (target.origin !== baseUrl.origin) {
|
|
184
|
+
throw imValidationError("download_url_cross_origin", "\u4E0B\u8F7D\u5730\u5740\u4E0D\u5141\u8BB8\u8DE8 E10 \u73AF\u5883");
|
|
185
|
+
}
|
|
186
|
+
assertPath(target.pathname);
|
|
187
|
+
const query = {};
|
|
188
|
+
for (const [key, value] of target.searchParams) {
|
|
189
|
+
const previous = query[key];
|
|
190
|
+
if (previous === void 0) query[key] = value;
|
|
191
|
+
else if (Array.isArray(previous)) previous.push(value);
|
|
192
|
+
else query[key] = [previous, value];
|
|
193
|
+
}
|
|
194
|
+
let response;
|
|
195
|
+
try {
|
|
196
|
+
response = await (await runtime()).requestBinary({
|
|
197
|
+
module: "im",
|
|
198
|
+
operation: "im.file.download",
|
|
199
|
+
method: "GET",
|
|
200
|
+
path: target.pathname,
|
|
201
|
+
query,
|
|
202
|
+
headers,
|
|
203
|
+
timeoutMs: 6e4
|
|
189
204
|
});
|
|
190
|
-
if (resp.status === 401 || resp.status === 302) {
|
|
191
|
-
throw imAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE);
|
|
192
|
-
}
|
|
193
|
-
if (resp.status !== 200) {
|
|
194
|
-
throw new ImCliError("api", "download_failed", `\u4E0B\u8F7D\u5931\u8D25 HTTP ${resp.status}`, {
|
|
195
|
-
code: resp.status,
|
|
196
|
-
exitCode: 1
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
return Buffer.from(await resp.arrayBuffer());
|
|
200
205
|
} catch (error) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
clearTimeout(timer);
|
|
206
|
+
mapRuntimeNetworkError(error);
|
|
207
|
+
}
|
|
208
|
+
if (response.status === 401 || response.status === 302) {
|
|
209
|
+
throw imAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE);
|
|
206
210
|
}
|
|
211
|
+
if (response.status !== 200) {
|
|
212
|
+
throw new ImCliError("api", "download_failed", `\u4E0B\u8F7D\u5931\u8D25 HTTP ${response.status}`, {
|
|
213
|
+
code: response.status,
|
|
214
|
+
exitCode: 1
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return response.content;
|
|
207
218
|
}
|
|
208
219
|
async function getSelfIdentity() {
|
|
209
220
|
if (selfIdentity) return selfIdentity;
|
|
@@ -265,11 +276,17 @@ function createImHost(ctx, dependencies = {}) {
|
|
|
265
276
|
timeoutMs: 15e3
|
|
266
277
|
});
|
|
267
278
|
const preData = preRes?.data || {};
|
|
279
|
+
const preInfo = preData.imUploadInfoDto || preData;
|
|
280
|
+
const preFileObj = preInfo?.fileObj && (preInfo.fileObj.id || preInfo.fileObj.fileid) ? preInfo.fileObj : null;
|
|
281
|
+
const preUploadType = String(preData.uploadType || preInfo?.uploadType || "");
|
|
282
|
+
if (preFileObj && (!preData.preUploadId || preUploadType === "second")) {
|
|
283
|
+
return preFileObj;
|
|
284
|
+
}
|
|
268
285
|
if (!preData.preUploadId) {
|
|
269
|
-
throw new ImCliError("api", "upload_check_failed", `preUploadCheck \u5931\u8D25`, { details: preRes, exitCode: 1 });
|
|
286
|
+
throw new ImCliError("api", "upload_check_failed", `preUploadCheck \u5931\u8D25\uFF08\u672A\u8FD4\u56DE preUploadId\uFF0C\u4E5F\u6CA1\u6709\u53EF\u590D\u7528\u7684\u79D2\u4F20 fileObj\uFF09`, { details: preRes, exitCode: 1 });
|
|
270
287
|
}
|
|
271
288
|
const preUploadId = String(preData.preUploadId);
|
|
272
|
-
const uploadType =
|
|
289
|
+
const uploadType = preUploadType || "common";
|
|
273
290
|
const upForm = new FormData();
|
|
274
291
|
upForm.append("data", new Blob([data], { type: mime }), name);
|
|
275
292
|
for (const [k, v] of Object.entries({ module: "im", permission, shareUsers, shareGroups, shareExternals: "", uploadType, preUploadId, MD5: md5 })) {
|
|
@@ -0,0 +1,226 @@
|
|
|
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-MEEFGWTM.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) {
|
|
113
|
+
return { ...await probeAndPersist(host, ctx), fromCache: false };
|
|
114
|
+
}
|
|
115
|
+
const cache = await readCache(ctx);
|
|
116
|
+
const cached = cache.environments[session.baseUrl];
|
|
117
|
+
if (cached && (cached.mode === "eb" || cached.mode === "standard")) {
|
|
118
|
+
return {
|
|
119
|
+
mode: cached.mode,
|
|
120
|
+
smokePath: cached.smokePath,
|
|
121
|
+
fromCache: true,
|
|
122
|
+
detectedAt: cached.detectedAt
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return { mode: DEFAULT_MEETING_MODE, smokePath: EB_SMOKE_PATH, fromCache: false, assumed: true };
|
|
126
|
+
}
|
|
127
|
+
async function degradeMeetingEnvToStandard(host, ctx, ebError, options = {}) {
|
|
128
|
+
const probed = await probeAndPersist(host, ctx, ebError, options);
|
|
129
|
+
return {
|
|
130
|
+
mode: "standard",
|
|
131
|
+
smokePath: probed.smokePath,
|
|
132
|
+
ebError: probed.ebSmokeError ?? describeEnvError(ebError),
|
|
133
|
+
...probed.warning ? { warning: probed.warning } : {}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
var meetingEnvDetect = {
|
|
137
|
+
name: "meeting.env.detect",
|
|
138
|
+
resource: "env",
|
|
139
|
+
method: "detect",
|
|
140
|
+
action: "meeting.env.detect",
|
|
141
|
+
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",
|
|
142
|
+
capability: "env",
|
|
143
|
+
risk: "read",
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
properties: {
|
|
148
|
+
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' },
|
|
149
|
+
profileId: SCHEMA_ID
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
handler: async (args, { host, ctx }) => {
|
|
153
|
+
const result = await resolveMeetingEnvMode(host, ctx, { refresh: args.refresh === true });
|
|
154
|
+
const { warning, ...data } = result;
|
|
155
|
+
return meetingSuccess(
|
|
156
|
+
"meeting.env.detect",
|
|
157
|
+
data,
|
|
158
|
+
warning ? { warnings: [warning] } : void 0
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var meetingCalendarBase = {
|
|
163
|
+
name: "meeting.calendar.base",
|
|
164
|
+
resource: "env",
|
|
165
|
+
method: "calendar.base",
|
|
166
|
+
action: "meeting.calendar.base",
|
|
167
|
+
summary: "\u67E5\u8BE2\u65E5\u5386/\u5EFA\u4F1A\u57FA\u7840\u4FE1\u606F\uFF08getCalendarBaseData\uFF09\uFF1AonlyFlowCreate / workFlowBaseIds / repeatWorkFlowBaseIds / existWorkFlow",
|
|
168
|
+
capability: "env",
|
|
169
|
+
risk: "read",
|
|
170
|
+
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
171
|
+
handler: async (_args, { host }) => {
|
|
172
|
+
const response = await host.request({
|
|
173
|
+
method: "GET",
|
|
174
|
+
path: STD_CALENDAR_PATH,
|
|
175
|
+
operation: "meeting.calendar.base"
|
|
176
|
+
});
|
|
177
|
+
const createBaseData = response?.data?.createBaseData ?? response?.createBaseData ?? null;
|
|
178
|
+
return meetingSuccess("meeting.calendar.base", { createBaseData, raw: response });
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var meetingDetailField = {
|
|
182
|
+
name: "meeting.detail.field",
|
|
183
|
+
resource: "meeting",
|
|
184
|
+
method: "detail.field",
|
|
185
|
+
action: "meeting.detail.field",
|
|
186
|
+
summary: "\u67E5\u8BE2\u4F1A\u8BAE\u8BE6\u60C5\u8868\u5355\u7ED3\u6784\u4E0E options\uFF08getMeetingDetailField\uFF09\uFF1Aid / operateType / fromWorkflow / isReadOnly",
|
|
187
|
+
capability: "meeting",
|
|
188
|
+
risk: "read",
|
|
189
|
+
inputSchema: {
|
|
190
|
+
type: "object",
|
|
191
|
+
additionalProperties: false,
|
|
192
|
+
properties: {
|
|
193
|
+
id: SCHEMA_ID,
|
|
194
|
+
operateType: { type: "string", description: "\u64CD\u4F5C\u7C7B\u578B\uFF0C\u5982 SUBMIT/UPDATE/CHANGE" },
|
|
195
|
+
fromWorkflow: { type: "integer", enum: [0, 1] },
|
|
196
|
+
isReadOnly: { type: "integer", enum: [0, 1] }
|
|
197
|
+
},
|
|
198
|
+
required: ["id"]
|
|
199
|
+
},
|
|
200
|
+
handler: async (args, { host }) => {
|
|
201
|
+
const query = { id: String(args.id) };
|
|
202
|
+
if (args.operateType !== void 0) query.operateType = args.operateType;
|
|
203
|
+
if (args.fromWorkflow !== void 0) query.fromWorkflow = args.fromWorkflow;
|
|
204
|
+
if (args.isReadOnly !== void 0) query.isReadOnly = args.isReadOnly;
|
|
205
|
+
const response = await host.request({
|
|
206
|
+
method: "GET",
|
|
207
|
+
path: "/api/meeting/detail/getMeetingDetailField",
|
|
208
|
+
operation: "meeting.detail.field",
|
|
209
|
+
query
|
|
210
|
+
});
|
|
211
|
+
return meetingSuccess("meeting.detail.field", { data: response?.data ?? response });
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var meetingEnvOperations = [
|
|
215
|
+
meetingEnvDetect,
|
|
216
|
+
meetingCalendarBase,
|
|
217
|
+
meetingDetailField
|
|
218
|
+
];
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
meetingStateDir,
|
|
222
|
+
readCache,
|
|
223
|
+
resolveMeetingEnvMode,
|
|
224
|
+
degradeMeetingEnvToStandard,
|
|
225
|
+
meetingEnvOperations
|
|
226
|
+
};
|