weaver-work-cli 0.1.29 → 0.1.32
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/dist/chunks/archive-UMGX72K6.js +2537 -0
- package/dist/chunks/archive-oa-N2IYBLF3.js +1317 -0
- package/dist/chunks/asset-GLEGKFG5.js +2109 -0
- package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
- package/dist/chunks/blog-E44OTVDA.js +2157 -0
- package/dist/chunks/caizhilian-DQUFZXZL.js +10087 -0
- package/dist/chunks/calendar-JKPIRKFD.js +1195 -0
- package/dist/chunks/chunk-2GA5ZIQL.js +1615 -0
- package/dist/chunks/chunk-4YC43QQ4.js +403 -0
- package/dist/chunks/chunk-6EFWDL7Y.js +161 -0
- package/dist/chunks/chunk-6RKD4DRZ.js +5556 -0
- package/dist/chunks/chunk-AJ62BGAW.js +29 -0
- package/dist/chunks/chunk-BUSC6UAE.js +43 -0
- package/dist/chunks/chunk-C6R3B2ML.js +358 -0
- package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
- package/dist/chunks/chunk-DW6AUUKS.js +508 -0
- package/dist/chunks/chunk-E4Z23GHM.js +6962 -0
- package/dist/chunks/chunk-EG6ZU444.js +654 -0
- package/dist/chunks/chunk-EZALDOQH.js +383 -0
- package/dist/chunks/chunk-FMPJJYYI.js +106 -0
- package/dist/chunks/chunk-G2JSIUWF.js +769 -0
- package/dist/chunks/chunk-G3QJULO2.js +387 -0
- package/dist/chunks/chunk-GCG2NMWR.js +703 -0
- package/dist/chunks/chunk-GPMFD4RD.js +75 -0
- package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
- package/dist/chunks/chunk-H7J4DC5R.js +464 -0
- package/dist/chunks/chunk-IURUFGZK.js +477 -0
- package/dist/chunks/chunk-LUSPKZKY.js +53 -0
- package/dist/chunks/chunk-NIAJ5ZCG.js +73 -0
- package/dist/chunks/chunk-NOODWMCL.js +584 -0
- package/dist/chunks/chunk-OOUTBLZ4.js +51 -0
- package/dist/chunks/chunk-P26ZWSKU.js +73 -0
- package/dist/chunks/chunk-QWY6PGL6.js +3472 -0
- package/dist/chunks/chunk-WKI2FBIQ.js +15606 -0
- package/dist/chunks/chunk-WSKBSQ2U.js +231 -0
- package/dist/chunks/chunk-YLCYX7LE.js +371 -0
- package/dist/chunks/chunk-YRVDW4WN.js +205 -0
- package/dist/chunks/chunk-ZEDWSH32.js +68 -0
- package/dist/chunks/continuation-2CKSBLA6.js +11 -0
- package/dist/chunks/continuation-HZIZRZBX.js +13 -0
- package/dist/chunks/continuation-NLECEJPX.js +11 -0
- package/dist/chunks/ebuilder-form-V5FG2EHC.js +2276 -0
- package/dist/chunks/ehr-HMFY6VIL.js +5241 -0
- package/dist/chunks/employee-SAK2QYXX.js +11 -0
- package/dist/chunks/esb-ZYSVB7SG.js +141 -0
- package/dist/chunks/fna-B7RKPAZD.js +1444 -0
- package/dist/chunks/host-45WED2KK.js +21 -0
- package/dist/chunks/host-I4Z6BFYX.js +23 -0
- package/dist/chunks/host-KNZ52LJZ.js +17 -0
- package/dist/chunks/host-OCH2BCCV.js +19 -0
- package/dist/chunks/hrm-2KAZGUHI.js +244 -0
- package/dist/chunks/im-ACJJWH4U.js +252 -0
- package/dist/chunks/invoice-ZK3WCX2U.js +5179 -0
- package/dist/chunks/jiuchuanhui-5PQD3IL2.js +1940 -0
- package/dist/chunks/lazy-dispatch-JQXBW3GM.js +28 -0
- package/dist/chunks/mail-S2HDDXO2.js +2695 -0
- package/dist/chunks/meeting-QVN3I37L.js +504 -0
- package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
- package/dist/chunks/okr-QNG4VC2Q.js +2482 -0
- package/dist/chunks/plan-A25EMW6U.js +2025 -0
- package/dist/chunks/project-G6XV66DZ.js +1361 -0
- package/dist/chunks/registry-2VLUAESA.js +14 -0
- package/dist/chunks/registry-7C5UMIPL.js +19 -0
- package/dist/chunks/registry-DC6KR3NH.js +18 -0
- package/dist/chunks/registry-NYPYMZXG.js +16 -0
- package/dist/chunks/registry-TI3CIUXF.js +19 -0
- package/dist/chunks/room-recommend-WRTHO6Y2.js +20 -0
- package/dist/chunks/schedule-KFIITGSK.js +24 -0
- package/dist/chunks/state-Y2XBP6YE.js +15 -0
- package/dist/chunks/workflow-DJ7SYWAF.js +245 -0
- package/dist/cmd/argv.js +45 -0
- package/dist/cmd/docs/index.js +3 -3
- package/dist/cmd/lazy-dispatch.js +20 -0
- package/dist/cmd/root.js +2 -4
- package/dist/cmd/setup/index.js +2 -2
- package/dist/cmd/skills/index.js +2 -2
- package/dist/core/package-paths.js +61 -0
- package/dist/index.js +163 -7
- package/dist/internal/e10/auth/xiaoe.js +3 -3
- package/dist/internal/e10/request-runtime.js +18 -62
- package/dist/internal/skills/detector.js +2 -2
- package/dist/shortcuts/contract/data/performance-catalog.js +1306 -0
- package/dist/shortcuts/contract/host.js +91 -35
- package/dist/shortcuts/contract/index.js +213 -0
- package/dist/shortcuts/contract/manifest.js +928 -0
- package/dist/shortcuts/contract/ooxml/docx.js +295 -0
- package/dist/shortcuts/contract/ooxml/xlsx.js +221 -0
- package/dist/shortcuts/contract/ooxml/zip.js +158 -0
- package/dist/shortcuts/contract/operations/assistant.js +1156 -0
- package/dist/shortcuts/contract/operations/clause-library.js +522 -0
- package/dist/shortcuts/contract/operations/compare.js +193 -0
- package/dist/shortcuts/contract/operations/credit-page.js +34 -0
- package/dist/shortcuts/contract/operations/flow.js +98 -0
- package/dist/shortcuts/contract/operations/page.js +66 -0
- package/dist/shortcuts/contract/operations/performance.js +733 -0
- package/dist/shortcuts/contract/operations/quote.js +557 -0
- package/dist/shortcuts/contract/operations/recommend.js +78 -0
- package/dist/shortcuts/contract/operations/registry.js +18 -0
- package/dist/shortcuts/contract/operations/review.js +83 -0
- package/dist/shortcuts/contract/operations/shared.js +37 -0
- package/dist/shortcuts/contract/operations/upload.js +108 -0
- package/dist/shortcuts/contract/operations/write.js +3 -2
- package/dist/shortcuts/index.js +140 -40
- package/dist/shortcuts/invoice/manifest.js +34 -11
- package/dist/shortcuts/invoice/operations/reim-auto.js +9 -0
- package/dist/shortcuts/invoice/operations/reim.js +81 -5
- package/dist/shortcuts/invoice/operations/shared.js +12 -5
- package/dist/shortcuts/meeting/host.js +45 -3
- package/dist/shortcuts/meeting/invitation/docx.js +442 -0
- package/dist/shortcuts/meeting/operations/attachment-content.js +418 -0
- package/dist/shortcuts/meeting/operations/attachment.js +442 -0
- package/dist/shortcuts/meeting/operations/eb/cache.js +57 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +343 -28
- package/dist/shortcuts/meeting/operations/eb/conflict.js +372 -11
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +710 -0
- package/dist/shortcuts/meeting/operations/eb/decision.js +47 -1
- package/dist/shortcuts/meeting/operations/eb/factory.js +129 -11
- package/dist/shortcuts/meeting/operations/eb/index.js +122 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +378 -0
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +84 -0
- package/dist/shortcuts/meeting/operations/eb/schedule.js +450 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +576 -0
- package/dist/shortcuts/meeting/operations/invitation.js +458 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +266 -0
- package/dist/shortcuts/meeting/operations/pipeline.js +489 -0
- package/dist/shortcuts/meeting/operations/qrcode.js +131 -0
- package/dist/shortcuts/meeting/operations/receipts.js +1 -1
- package/dist/shortcuts/meeting/operations/registry.js +18 -0
- package/dist/shortcuts/meeting/operations/summary.js +276 -0
- package/dist/shortcuts/meeting/operations/task-notify.js +325 -0
- package/dist/shortcuts/meeting/operations.js +42 -1
- package/dist/shortcuts/meeting/qr/encoder.js +427 -0
- package/dist/shortcuts/meeting/qr/render.js +103 -0
- package/dist/shortcuts/workflow/operations/form.js +17 -5
- package/docs/contract.md +39 -4
- package/docs/invoice.md +5 -5
- package/package.json +3 -2
- package/scripts/bundle.mjs +63 -0
- package/skill-template/business-info.json +25 -4
- package/skill-template/domains/jinchengda.md +16 -3
- package/skill-template/domains/yepiaotong.md +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +111 -31
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +150 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +111 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +0 -13
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +50 -0
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +4 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +74 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +84 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +29 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +28 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +2 -21
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +0 -24
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +0 -17
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +70 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +0 -15
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1168 -152
- package/skills/weaver-e10-meeting/SKILL.md +493 -17
- package/skills/weaver-e10-meeting/references/meeting-change.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-create.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-eb.md +503 -27
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +113 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +425 -0
- package/skills/weaver-e10-meeting/references/meeting-queries.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +15 -15
- package/skills/weaver-e10-meeting/references/meeting-verification.md +19 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +6 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +14 -11
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +97 -56
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +84 -60
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +142 -105
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +53 -194
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +164 -72
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +6 -0
- package/templates/meeting/invitation.docx +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ESB_PATHS,
|
|
5
|
+
TARGET_FATAL_SUBTYPES,
|
|
6
|
+
createEsbHost,
|
|
7
|
+
isEsbFlowUnavailable,
|
|
8
|
+
triggerResultCode
|
|
9
|
+
} from "./chunk-YRVDW4WN.js";
|
|
10
|
+
import "./chunk-GPMFD4RD.js";
|
|
11
|
+
import "./chunk-DW6AUUKS.js";
|
|
12
|
+
import "./chunk-2GA5ZIQL.js";
|
|
13
|
+
import "./chunk-LUSPKZKY.js";
|
|
14
|
+
import "./chunk-BUSC6UAE.js";
|
|
15
|
+
export {
|
|
16
|
+
ESB_PATHS,
|
|
17
|
+
TARGET_FATAL_SUBTYPES,
|
|
18
|
+
createEsbHost,
|
|
19
|
+
isEsbFlowUnavailable,
|
|
20
|
+
triggerResultCode
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
IM_PREFIX,
|
|
5
|
+
assertPath,
|
|
6
|
+
createImHost,
|
|
7
|
+
dirname,
|
|
8
|
+
mkdir,
|
|
9
|
+
writeFile
|
|
10
|
+
} from "./chunk-IURUFGZK.js";
|
|
11
|
+
import "./chunk-ZEDWSH32.js";
|
|
12
|
+
import "./chunk-DW6AUUKS.js";
|
|
13
|
+
import "./chunk-2GA5ZIQL.js";
|
|
14
|
+
import "./chunk-LUSPKZKY.js";
|
|
15
|
+
import "./chunk-BUSC6UAE.js";
|
|
16
|
+
export {
|
|
17
|
+
IM_PREFIX,
|
|
18
|
+
assertPath,
|
|
19
|
+
createImHost,
|
|
20
|
+
dirname,
|
|
21
|
+
mkdir as ensureDir,
|
|
22
|
+
writeFile
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
businessMessage,
|
|
5
|
+
createHrmHost,
|
|
6
|
+
isBusinessSuccess
|
|
7
|
+
} from "./chunk-6EFWDL7Y.js";
|
|
8
|
+
import "./chunk-OOUTBLZ4.js";
|
|
9
|
+
import "./chunk-DW6AUUKS.js";
|
|
10
|
+
import "./chunk-2GA5ZIQL.js";
|
|
11
|
+
import "./chunk-LUSPKZKY.js";
|
|
12
|
+
import "./chunk-BUSC6UAE.js";
|
|
13
|
+
export {
|
|
14
|
+
businessMessage,
|
|
15
|
+
createHrmHost,
|
|
16
|
+
isBusinessSuccess
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createWorkflowHost,
|
|
5
|
+
extractApiBusinessError,
|
|
6
|
+
isAtustRedirect,
|
|
7
|
+
isLoginExpired
|
|
8
|
+
} from "./chunk-WSKBSQ2U.js";
|
|
9
|
+
import "./chunk-FMPJJYYI.js";
|
|
10
|
+
import "./chunk-DW6AUUKS.js";
|
|
11
|
+
import "./chunk-2GA5ZIQL.js";
|
|
12
|
+
import "./chunk-LUSPKZKY.js";
|
|
13
|
+
import "./chunk-BUSC6UAE.js";
|
|
14
|
+
export {
|
|
15
|
+
createWorkflowHost,
|
|
16
|
+
extractApiBusinessError,
|
|
17
|
+
isAtustRedirect,
|
|
18
|
+
isLoginExpired
|
|
19
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createHrmHost
|
|
5
|
+
} from "./chunk-6EFWDL7Y.js";
|
|
6
|
+
import {
|
|
7
|
+
getHrmOperation,
|
|
8
|
+
hrmOperationDefinitions
|
|
9
|
+
} from "./chunk-G2JSIUWF.js";
|
|
10
|
+
import {
|
|
11
|
+
asObject,
|
|
12
|
+
assertNoForbiddenKeys
|
|
13
|
+
} from "./chunk-NOODWMCL.js";
|
|
14
|
+
import {
|
|
15
|
+
hrmValidationError
|
|
16
|
+
} from "./chunk-OOUTBLZ4.js";
|
|
17
|
+
import "./chunk-DW6AUUKS.js";
|
|
18
|
+
import "./chunk-2GA5ZIQL.js";
|
|
19
|
+
import {
|
|
20
|
+
isCliError,
|
|
21
|
+
toErrorEnvelope
|
|
22
|
+
} from "./chunk-LUSPKZKY.js";
|
|
23
|
+
import "./chunk-BUSC6UAE.js";
|
|
24
|
+
|
|
25
|
+
// src/shortcuts/hrm/index.ts
|
|
26
|
+
import { readFile } from "node:fs/promises";
|
|
27
|
+
|
|
28
|
+
// src/shortcuts/hrm/manifest.ts
|
|
29
|
+
var WITHHELD = [
|
|
30
|
+
{
|
|
31
|
+
name: "hrm.employee.dls",
|
|
32
|
+
reason: "\u4EE3\u7406\u5546\u67E5\u8BE2\uFF08containsDls=true\uFF09\u4EC5\u6CDB\u5FAE\u81EA\u7528\u7CFB\u7EDF\u57DF\u540D\u652F\u6301\uFF08\u81EA\u7528\u57DF\u540D\u767D\u540D\u5355\uFF09\uFF0C\u5BA2\u6237/\u5176\u4ED6\u73AF\u5883\u7981\u6B62\u89E6\u53D1\uFF1B\u672A\u5B9E\u73B0\uFF0C\u4E0D\u5F97\u7F16\u9020\u6216\u7ED5\u8FC7\u3002"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "hrm.org.virtuals",
|
|
36
|
+
reason: "\u591A\u7EF4\uFF08\u7EC4\u7EC7\u7EF4\u5EA6\uFF09\u6E05\u5355\u4E0D\u5355\u72EC\u66B4\u9732\uFF1A\u7EF4\u5EA6\u83B7\u53D6\u4E0E\u540D\u79F0\u5339\u914D\u5DF2\u5E76\u5165 hrm.org.resolve \u5185\u90E8\uFF08\u5176 not_found \u4F1A\u987A\u5E26\u56DE availableVirtuals \u4F9B\u7EA0\u9519\uFF09\u3002\u300C\u5217\u51FA\u8BE5\u79DF\u6237\u6709\u54EA\u4E9B\u591A\u7EF4\u300D\u6682\u4E0D\u652F\u6301\uFF0C\u4E0D\u8981\u6784\u9020\u4E0D\u5B58\u5728\u7684\u7EF4\u5EA6\u540D\u53BB\u5957 availableVirtuals\uFF0C\u4E5F\u4E0D\u8981\u7F16\u9020\u6216\u7ED5\u8FC7\u3002"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
function buildOperations() {
|
|
40
|
+
return hrmOperationDefinitions().map((definition) => ({
|
|
41
|
+
name: definition.name,
|
|
42
|
+
resource: definition.resource,
|
|
43
|
+
summary: definition.summary,
|
|
44
|
+
risk: definition.risk,
|
|
45
|
+
inputSchema: definition.inputSchema
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
var hrmManifest = {
|
|
49
|
+
schemaVersion: 1,
|
|
50
|
+
name: "hrm",
|
|
51
|
+
title: "\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5/\u7EC4\u7EC7/\u5C97\u4F4D\u67E5\u8BE2\uFF09",
|
|
52
|
+
version: "0.1.0",
|
|
53
|
+
host: "e10-hrm",
|
|
54
|
+
status: "builtin",
|
|
55
|
+
sourceSkill: "weaver-e10-hrm",
|
|
56
|
+
capabilities: ["employee", "org", "position"],
|
|
57
|
+
operations: buildOperations(),
|
|
58
|
+
withheldOperations: WITHHELD
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/shortcuts/hrm/operations.ts
|
|
62
|
+
async function executeHrmOperation(operation, rawInput, context) {
|
|
63
|
+
const definition = getHrmOperation(operation);
|
|
64
|
+
const input = asObject(rawInput);
|
|
65
|
+
assertNoForbiddenKeys(input);
|
|
66
|
+
const host = {
|
|
67
|
+
request(request) {
|
|
68
|
+
return context.host.request({
|
|
69
|
+
...request,
|
|
70
|
+
operation: request.operation || operation
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
getSession() {
|
|
74
|
+
return context.host.getSession();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return definition.handler(input, { ...context, host });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/shortcuts/hrm/index.ts
|
|
81
|
+
function asOptions(value) {
|
|
82
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
83
|
+
}
|
|
84
|
+
async function readStdin() {
|
|
85
|
+
const chunks = [];
|
|
86
|
+
for await (const chunk of process.stdin) {
|
|
87
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
88
|
+
}
|
|
89
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
90
|
+
}
|
|
91
|
+
function stripBom(value) {
|
|
92
|
+
return value.replace(/^\uFEFF+/, "");
|
|
93
|
+
}
|
|
94
|
+
async function inputFrom(options, extra = {}) {
|
|
95
|
+
const opts = asOptions(options);
|
|
96
|
+
let input = {};
|
|
97
|
+
if (opts.input && opts.inputJson) {
|
|
98
|
+
throw hrmValidationError("input_conflict", "\u4E0D\u80FD\u540C\u65F6\u4F20 --input \u548C --input-json");
|
|
99
|
+
}
|
|
100
|
+
if (opts.inputJson) {
|
|
101
|
+
input = parseJsonInput(String(opts.inputJson), "--input-json");
|
|
102
|
+
}
|
|
103
|
+
if (opts.input) {
|
|
104
|
+
let raw;
|
|
105
|
+
try {
|
|
106
|
+
raw = stripBom(opts.input === "-" ? await readStdin() : await readFile(String(opts.input), "utf8"));
|
|
107
|
+
} catch {
|
|
108
|
+
throw hrmValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
|
|
109
|
+
}
|
|
110
|
+
input = parseJsonInput(raw, "--input");
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
...input,
|
|
114
|
+
...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== void 0 && value !== ""))
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function parseJsonInput(raw, label) {
|
|
118
|
+
try {
|
|
119
|
+
const parsed = JSON.parse(stripBom(raw));
|
|
120
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
121
|
+
throw new Error("input must be an object");
|
|
122
|
+
}
|
|
123
|
+
return parsed;
|
|
124
|
+
} catch {
|
|
125
|
+
throw hrmValidationError("input_invalid", `${label} \u4E0D\u662F\u5408\u6CD5 JSON \u5BF9\u8C61`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function inputArrayFrom(options) {
|
|
129
|
+
const opts = asOptions(options);
|
|
130
|
+
if (opts.input && opts.inputJson) {
|
|
131
|
+
throw hrmValidationError("input_conflict", "\u4E0D\u80FD\u540C\u65F6\u4F20 --input \u548C --input-json");
|
|
132
|
+
}
|
|
133
|
+
let raw;
|
|
134
|
+
if (opts.inputJson) {
|
|
135
|
+
raw = String(opts.inputJson);
|
|
136
|
+
} else if (opts.input) {
|
|
137
|
+
try {
|
|
138
|
+
raw = stripBom(opts.input === "-" ? await readStdin() : await readFile(String(opts.input), "utf8"));
|
|
139
|
+
} catch {
|
|
140
|
+
throw hrmValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
throw hrmValidationError("input_required", "run-many \u9700\u8981 --input \u6216 --input-json \u63D0\u4F9B JSON \u6570\u7EC4");
|
|
144
|
+
}
|
|
145
|
+
let parsed;
|
|
146
|
+
try {
|
|
147
|
+
parsed = JSON.parse(stripBom(raw));
|
|
148
|
+
} catch {
|
|
149
|
+
throw hrmValidationError("input_invalid", "run-many \u8F93\u5165\u4E0D\u662F\u5408\u6CD5 JSON");
|
|
150
|
+
}
|
|
151
|
+
if (!Array.isArray(parsed)) {
|
|
152
|
+
throw hrmValidationError("input_invalid", 'run-many \u8F93\u5165\u5FC5\u987B\u662F\u6570\u7EC4\uFF1A[{"op":"...","input":{...}}, ...]');
|
|
153
|
+
}
|
|
154
|
+
return parsed.map((item, index) => {
|
|
155
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
156
|
+
throw hrmValidationError("input_invalid", `run-many \u7B2C ${index + 1} \u9879\u5FC5\u987B\u662F\u5BF9\u8C61`);
|
|
157
|
+
}
|
|
158
|
+
const obj = item;
|
|
159
|
+
if (typeof obj.op !== "string" || !obj.op.trim()) {
|
|
160
|
+
throw hrmValidationError("input_invalid", `run-many \u7B2C ${index + 1} \u9879\u7F3A\u5C11 op \u5B57\u6BB5`);
|
|
161
|
+
}
|
|
162
|
+
const input = obj.input && typeof obj.input === "object" && !Array.isArray(obj.input) ? obj.input : {};
|
|
163
|
+
return { op: obj.op.trim(), input };
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function successEnvelope(operation, result) {
|
|
167
|
+
return {
|
|
168
|
+
schemaVersion: 1,
|
|
169
|
+
ok: true,
|
|
170
|
+
operation,
|
|
171
|
+
data: result.data === void 0 ? null : result.data,
|
|
172
|
+
...result.meta ? { meta: result.meta } : {},
|
|
173
|
+
warnings: []
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function failureEnvelope(error) {
|
|
177
|
+
const structured = error;
|
|
178
|
+
return {
|
|
179
|
+
schemaVersion: 1,
|
|
180
|
+
ok: false,
|
|
181
|
+
error: toErrorEnvelope(error)
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
async function executeAndPrint(ctx, operation, input) {
|
|
185
|
+
try {
|
|
186
|
+
const result = await executeHrmOperation(operation, input, {
|
|
187
|
+
ctx,
|
|
188
|
+
host: createHrmHost(ctx)
|
|
189
|
+
});
|
|
190
|
+
ctx.output.write(successEnvelope(operation, result), { json: true });
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
193
|
+
process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
var hrmShortcut = {
|
|
197
|
+
name: "hrm",
|
|
198
|
+
description: "\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5/\u7EC4\u7EC7/\u5C97\u4F4D\u67E5\u8BE2\uFF09CLI",
|
|
199
|
+
category: "shortcut",
|
|
200
|
+
register({ program, action }) {
|
|
201
|
+
const hrm = program.command("hrm").description("\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5\u67E5\u8BE2/\u7EC4\u7EC7\u67B6\u6784/\u5C97\u4F4D\u67E5\u8BE2\uFF09");
|
|
202
|
+
hrm.command("schema").description("Print hrm operation manifest for agents").option("--full", "print full manifest with complete inputSchema").action(action((ctx, options) => {
|
|
203
|
+
if (asOptions(options).full === true) {
|
|
204
|
+
ctx.output.write(hrmManifest, { json: true });
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const brief = {
|
|
208
|
+
schemaVersion: hrmManifest.schemaVersion,
|
|
209
|
+
name: hrmManifest.name,
|
|
210
|
+
version: hrmManifest.version,
|
|
211
|
+
operations: hrmManifest.operations.map((o) => ({
|
|
212
|
+
name: o.name,
|
|
213
|
+
summary: o.summary,
|
|
214
|
+
params: Object.keys(o.inputSchema?.properties ?? {}),
|
|
215
|
+
required: o.inputSchema?.required ?? []
|
|
216
|
+
}))
|
|
217
|
+
};
|
|
218
|
+
ctx.output.write(brief, { json: true });
|
|
219
|
+
}));
|
|
220
|
+
hrm.command("run").description("Run an hrm operation with JSON input").argument("<operation>", "operation name, e.g. hrm.employee.query").option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object").action(action(async (ctx, operation, options) => {
|
|
221
|
+
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
222
|
+
}));
|
|
223
|
+
hrm.command("run-many").description("Run multiple hrm operations in a single process (shared session)").option("--input <path>", "JSON array file, or - for stdin").option("--input-json <json>", "inline JSON array").action(action(async (ctx, options) => {
|
|
224
|
+
const items = await inputArrayFrom(options);
|
|
225
|
+
const host = createHrmHost(ctx);
|
|
226
|
+
const results = [];
|
|
227
|
+
for (const item of items) {
|
|
228
|
+
try {
|
|
229
|
+
const result = await executeHrmOperation(item.op, item.input, { ctx, host });
|
|
230
|
+
results.push(successEnvelope(item.op, result));
|
|
231
|
+
} catch (error) {
|
|
232
|
+
results.push({ operation: item.op, ...failureEnvelope(error) });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
ctx.output.write({ schemaVersion: 1, ok: true, count: results.length, results }, { json: true });
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
export {
|
|
240
|
+
hrmShortcut,
|
|
241
|
+
inputArrayFrom,
|
|
242
|
+
inputFrom,
|
|
243
|
+
successEnvelope
|
|
244
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createImContinuationSigner
|
|
5
|
+
} from "./chunk-P26ZWSKU.js";
|
|
6
|
+
import {
|
|
7
|
+
asObject,
|
|
8
|
+
assertNoForbiddenKeys,
|
|
9
|
+
getImOperation,
|
|
10
|
+
imOperationDefinitions
|
|
11
|
+
} from "./chunk-QWY6PGL6.js";
|
|
12
|
+
import "./chunk-YLCYX7LE.js";
|
|
13
|
+
import {
|
|
14
|
+
createImHost
|
|
15
|
+
} from "./chunk-IURUFGZK.js";
|
|
16
|
+
import {
|
|
17
|
+
imValidationError
|
|
18
|
+
} from "./chunk-ZEDWSH32.js";
|
|
19
|
+
import "./chunk-DW6AUUKS.js";
|
|
20
|
+
import "./chunk-2GA5ZIQL.js";
|
|
21
|
+
import {
|
|
22
|
+
isCliError,
|
|
23
|
+
toErrorEnvelope
|
|
24
|
+
} from "./chunk-LUSPKZKY.js";
|
|
25
|
+
import "./chunk-BUSC6UAE.js";
|
|
26
|
+
|
|
27
|
+
// src/shortcuts/im/index.ts
|
|
28
|
+
import { readFile } from "node:fs/promises";
|
|
29
|
+
|
|
30
|
+
// src/shortcuts/im/manifest.ts
|
|
31
|
+
function buildOperations() {
|
|
32
|
+
return imOperationDefinitions().map((definition) => ({
|
|
33
|
+
name: definition.name,
|
|
34
|
+
resource: definition.resource,
|
|
35
|
+
summary: definition.summary,
|
|
36
|
+
...definition.capability ? { capability: definition.capability } : {},
|
|
37
|
+
risk: definition.risk,
|
|
38
|
+
...definition.requiresConfirmation ? { requiresConfirmation: true } : {},
|
|
39
|
+
...definition.deprecatedInputAliases ? { deprecatedInputAliases: definition.deprecatedInputAliases } : {},
|
|
40
|
+
inputSchema: definition.inputSchema
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
var imManifest = {
|
|
44
|
+
schemaVersion: 1,
|
|
45
|
+
name: "im",
|
|
46
|
+
title: "\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF08\u5373\u65F6\u901A\u8BAF\uFF1A\u6D88\u606F/\u7FA4\u7EC4/\u4F1A\u8BDD/\u7CFB\u7EDF\u6D88\u606F\uFF09",
|
|
47
|
+
version: "0.1.0",
|
|
48
|
+
host: "e10-im",
|
|
49
|
+
status: "builtin",
|
|
50
|
+
sourceSkill: "weaver-e10-yimiaoban",
|
|
51
|
+
capabilities: ["person", "msg", "ding", "group", "session", "sysmsg", "file", "user", "i18n"],
|
|
52
|
+
operations: buildOperations()
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/shortcuts/im/operations.ts
|
|
56
|
+
async function executeImOperation(operation, rawInput, context) {
|
|
57
|
+
const definition = getImOperation(operation);
|
|
58
|
+
const input = asObject(rawInput);
|
|
59
|
+
assertNoForbiddenKeys(input);
|
|
60
|
+
return definition.handler(input, context);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/shortcuts/im/index.ts
|
|
64
|
+
function asOptions(value) {
|
|
65
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
66
|
+
}
|
|
67
|
+
async function readStdin() {
|
|
68
|
+
const chunks = [];
|
|
69
|
+
for await (const chunk of process.stdin) {
|
|
70
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
71
|
+
}
|
|
72
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
73
|
+
}
|
|
74
|
+
function stripBom(value) {
|
|
75
|
+
return value.replace(/^\uFEFF+/, "");
|
|
76
|
+
}
|
|
77
|
+
async function inputFrom(options, extra = {}) {
|
|
78
|
+
const opts = asOptions(options);
|
|
79
|
+
let input = {};
|
|
80
|
+
if (opts.input && opts.inputJson) {
|
|
81
|
+
throw imValidationError("input_conflict", "\u4E0D\u80FD\u540C\u65F6\u4F20 --input \u548C --input-json");
|
|
82
|
+
}
|
|
83
|
+
if (opts.inputJson) {
|
|
84
|
+
input = parseJsonInput(String(opts.inputJson), "--input-json");
|
|
85
|
+
}
|
|
86
|
+
if (opts.input) {
|
|
87
|
+
let raw;
|
|
88
|
+
try {
|
|
89
|
+
raw = stripBom(opts.input === "-" ? await readStdin() : await readFile(String(opts.input), "utf8"));
|
|
90
|
+
} catch {
|
|
91
|
+
throw imValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
|
|
92
|
+
}
|
|
93
|
+
input = parseJsonInput(raw, "--input");
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...input,
|
|
97
|
+
...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== void 0 && value !== ""))
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function parseJsonInput(raw, label) {
|
|
101
|
+
try {
|
|
102
|
+
const parsed = JSON.parse(stripBom(raw));
|
|
103
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
104
|
+
throw new Error("input must be an object");
|
|
105
|
+
}
|
|
106
|
+
return parsed;
|
|
107
|
+
} catch {
|
|
108
|
+
throw imValidationError("input_invalid", `${label} \u4E0D\u662F\u5408\u6CD5 JSON \u5BF9\u8C61`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function withJsonInputOptions(command) {
|
|
112
|
+
command.option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object");
|
|
113
|
+
return command;
|
|
114
|
+
}
|
|
115
|
+
function successEnvelope(operation, result) {
|
|
116
|
+
return {
|
|
117
|
+
schemaVersion: 1,
|
|
118
|
+
ok: true,
|
|
119
|
+
operation,
|
|
120
|
+
// 业务数据为 undefined 时仍输出 data 键,避免调用方需额外判断键是否存在。
|
|
121
|
+
data: result.data === void 0 ? null : result.data,
|
|
122
|
+
...result.meta && Object.keys(result.meta).length ? { meta: result.meta } : {},
|
|
123
|
+
warnings: []
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function failureEnvelope(error) {
|
|
127
|
+
const structured = error;
|
|
128
|
+
return {
|
|
129
|
+
schemaVersion: 1,
|
|
130
|
+
ok: false,
|
|
131
|
+
...structured?.partialData === void 0 ? {} : { data: structured.partialData },
|
|
132
|
+
error: toErrorEnvelope(error)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function executeAndPrint(ctx, operation, input) {
|
|
136
|
+
try {
|
|
137
|
+
const result = await executeImOperation(operation, input, {
|
|
138
|
+
ctx,
|
|
139
|
+
host: createImHost(ctx),
|
|
140
|
+
continuation: createImContinuationSigner(ctx)
|
|
141
|
+
});
|
|
142
|
+
ctx.output.write(successEnvelope(operation, result), { json: true });
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
145
|
+
process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function boolOption(value) {
|
|
149
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
150
|
+
return value === true || value === "true" || value === "1";
|
|
151
|
+
}
|
|
152
|
+
var imShortcut = {
|
|
153
|
+
name: "im",
|
|
154
|
+
description: "\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF08\u5373\u65F6\u901A\u8BAF\uFF09CLI",
|
|
155
|
+
category: "shortcut",
|
|
156
|
+
register({ program, action }) {
|
|
157
|
+
const im = program.command("im").description("\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF1A\u6D88\u606F/\u7FA4\u7EC4/\u4F1A\u8BDD/\u7CFB\u7EDF\u6D88\u606F");
|
|
158
|
+
im.command("schema").description("Print im operation manifest for agents").action(action((ctx) => {
|
|
159
|
+
ctx.output.write(imManifest, { json: true });
|
|
160
|
+
}));
|
|
161
|
+
withJsonInputOptions(im.command("run").description("Run an im operation with JSON input").argument("<operation>", "operation name, e.g. im.msg.sync.group")).action(action(async (ctx, operation, options) => {
|
|
162
|
+
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
163
|
+
}));
|
|
164
|
+
const session = im.command("session").description("Session commands");
|
|
165
|
+
withJsonInputOptions(session.command("list").description("\u62C9\u53D6\u5F53\u524D\u7528\u6237\u4F1A\u8BDD\u5217\u8868").option("--num <n>", "\u5355\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 20\uFF0C\u6700\u591A 50\uFF1B\u4F1A\u8BDD\u5217\u8868\u4E0D\u81EA\u52A8\u7FFB\u9875\uFF09").option("--msgid <id>", "\u951A\u70B9\u6D88\u606F id").option("--flag <0|1|2>", "0 up+down / 1 up / 2 down\uFF08\u9ED8\u8BA4 2\uFF09").option("--type <type>", "\u4EC5\u5C55\u793A\u8BE5 session_type")).action(action(async (ctx, options) => {
|
|
166
|
+
const opts = asOptions(options);
|
|
167
|
+
await executeAndPrint(ctx, "im.session.list", await inputFrom(options, {
|
|
168
|
+
num: opts.num !== void 0 ? Number(opts.num) : void 0,
|
|
169
|
+
msgid: opts.msgid,
|
|
170
|
+
flag: opts.flag !== void 0 ? Number(opts.flag) : void 0,
|
|
171
|
+
type: opts.type !== void 0 ? Number(opts.type) : void 0
|
|
172
|
+
}));
|
|
173
|
+
}));
|
|
174
|
+
const msg = im.command("msg").description("Message commands");
|
|
175
|
+
withJsonInputOptions(msg.command("sync-single").description("\u62C9\u53D6\u4E0E\u67D0\u4EBA\u7684\u5355\u804A\u6D88\u606F").option("--from-uid <uid>", "\u5BF9\u65B9 uid\uFF08\u5FC5\u586B\uFF09").option("--from-cid <cid>", "\u5BF9\u65B9 cid\uFF08\u5FC5\u586B\uFF09").option("--num <n>", "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 50\uFF0C\u6700\u591A 50\uFF09").option("--from <time>", "\u8D77\u59CB\u65F6\u95F4 YYYY-MM-DD[ HH:mm:ss] \u6216 unix \u79D2\uFF08\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\uFF09").option("--to <time>", "\u7ED3\u675F\u65F6\u95F4\uFF08\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\uFF09").option("--latest", "\u62C9\u6700\u65B0\u4E0D\u9650\u65E5\u671F").option("--img-format <fmt>", "small/large/original\uFF08\u9ED8\u8BA4 small\uFF09")).action(action(async (ctx, options) => {
|
|
176
|
+
const opts = asOptions(options);
|
|
177
|
+
await executeAndPrint(ctx, "im.msg.sync.single", await inputFrom(options, {
|
|
178
|
+
fromUid: opts.fromUid,
|
|
179
|
+
fromCid: opts.fromCid,
|
|
180
|
+
num: opts.num !== void 0 ? Number(opts.num) : void 0,
|
|
181
|
+
from: opts.from,
|
|
182
|
+
to: opts.to,
|
|
183
|
+
latest: boolOption(opts.latest),
|
|
184
|
+
imgFormat: opts.imgFormat
|
|
185
|
+
}));
|
|
186
|
+
}));
|
|
187
|
+
withJsonInputOptions(msg.command("sync-group").description("\u62C9\u53D6\u67D0\u7FA4\u804A\u5929\u6D88\u606F").option("--gid <id>", "\u7FA4 id\uFF08\u5FC5\u586B\uFF09").option("--num <n>", "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 50\uFF0C\u6700\u591A 50\uFF09").option("--from <time>", "\u8D77\u59CB\u65F6\u95F4\uFF08\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\uFF09").option("--to <time>", "\u7ED3\u675F\u65F6\u95F4\uFF08\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\uFF09").option("--latest", "\u62C9\u6700\u65B0\u4E0D\u9650\u65E5\u671F").option("--start-id <id>", "\u663E\u5F0F\u8D77\u59CB\u6D88\u606F id").option("--end-id <id>", "\u663E\u5F0F\u7ED3\u675F\u6D88\u606F id").option("--img-format <fmt>", "small/large/original\uFF08\u9ED8\u8BA4 small\uFF09")).action(action(async (ctx, options) => {
|
|
188
|
+
const opts = asOptions(options);
|
|
189
|
+
await executeAndPrint(ctx, "im.msg.sync.group", await inputFrom(options, {
|
|
190
|
+
groupId: opts.gid,
|
|
191
|
+
num: opts.num !== void 0 ? Number(opts.num) : void 0,
|
|
192
|
+
from: opts.from,
|
|
193
|
+
to: opts.to,
|
|
194
|
+
latest: boolOption(opts.latest),
|
|
195
|
+
startId: opts.startId,
|
|
196
|
+
endId: opts.endId,
|
|
197
|
+
imgFormat: opts.imgFormat
|
|
198
|
+
}));
|
|
199
|
+
}));
|
|
200
|
+
withJsonInputOptions(msg.command("top").description("\u540C\u6B65\u7FA4\u7F6E\u9876\u6D88\u606F").option("--gid <id>", "\u7FA4 id\uFF08\u5FC5\u586B\uFF09")).action(action(async (ctx, options) => {
|
|
201
|
+
const opts = asOptions(options);
|
|
202
|
+
await executeAndPrint(ctx, "im.msg.top.sync", await inputFrom(options, { groupId: opts.gid }));
|
|
203
|
+
}));
|
|
204
|
+
const group = im.command("group").description("Group commands");
|
|
205
|
+
withJsonInputOptions(group.command("search").description("\u6309\u6761\u4EF6\u641C\u7D22\u7FA4\uFF08\u670D\u52A1\u7AEF\u8FC7\u6EE4\uFF09").option("--name <kw>", "\u7FA4\u540D\u5173\u952E\u5B57").option("--precise", "\u7CBE\u786E\u5339\u914D\u540D\u79F0").option("--type <type>", "\u7FA4\u7C7B\u578B\uFF081 \u666E\u901A/6 \u90E8\u95E8/7 \u5168\u5458\u7B49\uFF09").option("--members", "\u6211\u6240\u5728\u7684\u7FA4").option("--owner", "\u6211\u662F\u7FA4\u4E3B\u7684\u7FA4").option("--creator", "\u6211\u521B\u5EFA\u7684\u7FA4").option("--page-size <n>", "\u6BCF\u9875\u5927\u5C0F\uFF08\u9ED8\u8BA4 100\uFF0C\u6700\u591A 200\uFF09")).action(action(async (ctx, options) => {
|
|
206
|
+
const opts = asOptions(options);
|
|
207
|
+
await executeAndPrint(ctx, "im.group.search", await inputFrom(options, {
|
|
208
|
+
name: opts.name,
|
|
209
|
+
precise: boolOption(opts.precise),
|
|
210
|
+
type: opts.type !== void 0 ? Number(opts.type) : void 0,
|
|
211
|
+
members: boolOption(opts.members),
|
|
212
|
+
owner: boolOption(opts.owner),
|
|
213
|
+
creator: boolOption(opts.creator),
|
|
214
|
+
pageSize: opts.pageSize !== void 0 ? Number(opts.pageSize) : void 0
|
|
215
|
+
}));
|
|
216
|
+
}));
|
|
217
|
+
withJsonInputOptions(group.command("info").description("\u6309\u7FA4 id \u67E5\u57FA\u7840\u4FE1\u606F\uFF08\u652F\u6301\u6279\u91CF\uFF0C\u9017\u53F7\u5206\u9694\uFF09").option("--gid <ids>", "\u7FA4 id\uFF08\u9017\u53F7\u5206\u9694\u6216\u5355\u503C\uFF09")).action(action(async (ctx, options) => {
|
|
218
|
+
const opts = asOptions(options);
|
|
219
|
+
await executeAndPrint(ctx, "im.group.info", await inputFrom(options, { groupIds: opts.gid }));
|
|
220
|
+
}));
|
|
221
|
+
withJsonInputOptions(group.command("users").description("\u62C9\u53D6\u7FA4\u6210\u5458\u5217\u8868").option("--gid <id>", "\u7FA4 id\uFF08\u5FC5\u586B\uFF09")).action(action(async (ctx, options) => {
|
|
222
|
+
const opts = asOptions(options);
|
|
223
|
+
await executeAndPrint(ctx, "im.group.users", await inputFrom(options, { groupId: opts.gid }));
|
|
224
|
+
}));
|
|
225
|
+
withJsonInputOptions(im.command("resolve").description("\u6309\u59D3\u540D/\u5DE5\u53F7/\u624B\u673A/\u90AE\u7BB1\u6A21\u7CCA\u67E5\u8BE2\u5728\u804C\u5458\u5DE5").option("--name <kw>", "\u67E5\u8BE2\u5173\u952E\u5B57\uFF08\u5FC5\u586B\uFF09")).action(action(async (ctx, options) => {
|
|
226
|
+
const opts = asOptions(options);
|
|
227
|
+
await executeAndPrint(ctx, "im.person.resolve", await inputFrom(options, { name: opts.name }));
|
|
228
|
+
}));
|
|
229
|
+
const send = im.command("send").description("Send message commands (two-phase prepare -> apply)");
|
|
230
|
+
withJsonInputOptions(send.command("single-prepare").description("\u51C6\u5907\u53D1\u9001\u5355\u804A\u6D88\u606F\uFF08\u53EA\u8BFB\u6821\u9A8C\u5E76\u7B7E\u53D1 continuation\uFF09").option("--to-uid <uid>", "\u63A5\u6536\u4EBA uid\uFF08\u5FC5\u586B\uFF09").option("--to-cid <cid>", "\u63A5\u6536\u4EBA cid\uFF08\u5FC5\u586B\uFF09").option("--txt <text>", "\u6587\u672C\u5185\u5BB9").option("--img <path>", "\u672C\u5730\u56FE\u7247\u8DEF\u5F84").option("--file <path>", "\u672C\u5730\u6587\u4EF6\u8DEF\u5F84")).action(action(async (ctx, options) => {
|
|
231
|
+
const opts = asOptions(options);
|
|
232
|
+
await executeAndPrint(ctx, "im.msg.send.single.prepare", await inputFrom(options, {
|
|
233
|
+
toUid: opts.toUid,
|
|
234
|
+
toCid: opts.toCid,
|
|
235
|
+
txt: opts.txt,
|
|
236
|
+
img: opts.img,
|
|
237
|
+
file: opts.file
|
|
238
|
+
}));
|
|
239
|
+
}));
|
|
240
|
+
withJsonInputOptions(send.command("single-apply").description("\u6267\u884C\u53D1\u9001\u5355\u804A\u6D88\u606F\uFF08\u9700 --yes \u4E0E continuation\uFF09").option("--continuation <token>", "continuation token from send single-prepare").option("--yes", "confirm the write operation")).action(action(async (ctx, options) => {
|
|
241
|
+
const opts = asOptions(options);
|
|
242
|
+
await executeAndPrint(ctx, "im.msg.send.single.apply", await inputFrom(options, {
|
|
243
|
+
continuation: opts.continuation,
|
|
244
|
+
confirm: opts.yes === true ? true : void 0
|
|
245
|
+
}));
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
export {
|
|
250
|
+
imShortcut,
|
|
251
|
+
inputFrom
|
|
252
|
+
};
|