weaver-work-cli 0.1.48 → 0.1.49

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 (96) hide show
  1. package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
  2. package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-3NV2ETZR.js} +6 -6
  4. package/dist/chunks/{chunk-PSPOFLSU.js → chunk-3X7VOSBA.js} +1 -1
  5. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  6. package/dist/chunks/{chunk-FEP6ELMR.js → chunk-6GWU63YF.js} +1 -1
  7. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  8. package/dist/chunks/{chunk-EFOUMXIX.js → chunk-BRRW7CWA.js} +25 -25
  9. package/dist/chunks/{chunk-5B5JXTY2.js → chunk-D2QRZUW4.js} +209 -25
  10. package/dist/chunks/{chunk-OCYRVZGN.js → chunk-EJVA5ZVB.js} +2 -2
  11. package/dist/chunks/{chunk-BCACE6VV.js → chunk-GEOMANP7.js} +3 -3
  12. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  13. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  14. package/dist/chunks/{chunk-NK74RE5F.js → chunk-K3BT54CU.js} +3 -3
  15. package/dist/chunks/{chunk-R2HHLJNN.js → chunk-KV5SOWMS.js} +4 -4
  16. package/dist/chunks/{chunk-SVFG6EMV.js → chunk-ZKEUGS2U.js} +5 -5
  17. package/dist/chunks/{conflict-APGSD5E7.js → conflict-6347A7YK.js} +2 -2
  18. package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-7WG7LVX5.js} +6 -6
  19. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  20. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  21. package/dist/chunks/{env-B6GKA2J3.js → env-LHRKSLG6.js} +2 -2
  22. package/dist/chunks/{factory-MFCKLUT6.js → factory-2H7Z4RWJ.js} +1 -1
  23. package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-EW6PNDDT.js} +3 -3
  24. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  25. package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-N2FQBHXI.js} +10 -10
  26. package/dist/chunks/org-NFE7X7FK.js +12 -0
  27. package/dist/chunks/{reception-VL6TKVAW.js → reception-MYOKJULO.js} +429 -94
  28. package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
  29. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  30. package/dist/chunks/{registry-22O6UG4I.js → registry-CKUVBS53.js} +10 -10
  31. package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-MBCYENQ2.js} +4 -4
  32. package/dist/chunks/{schedule-SPPAHER2.js → schedule-5IFMCXME.js} +4 -4
  33. package/dist/index.js +12 -7
  34. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  35. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  36. package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
  37. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  38. package/dist/shortcuts/data/errors.js +64 -0
  39. package/dist/shortcuts/data/host.js +140 -0
  40. package/dist/shortcuts/data/index.js +429 -0
  41. package/dist/shortcuts/data/manifest.js +133 -0
  42. package/dist/shortcuts/data/operations/attend.js +62 -0
  43. package/dist/shortcuts/data/operations/conf.js +384 -0
  44. package/dist/shortcuts/data/operations/ds.js +686 -0
  45. package/dist/shortcuts/data/operations/field.js +68 -0
  46. package/dist/shortcuts/data/operations/index.js +65 -0
  47. package/dist/shortcuts/data/operations/module.js +383 -0
  48. package/dist/shortcuts/data/operations/noun.js +102 -0
  49. package/dist/shortcuts/data/operations/query.js +85 -0
  50. package/dist/shortcuts/data/operations/scene.js +235 -0
  51. package/dist/shortcuts/data/operations/shared.js +279 -0
  52. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
  53. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  54. package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
  55. package/dist/shortcuts/index.js +5 -0
  56. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  57. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  58. package/dist/shortcuts/reception/constants.js +11 -0
  59. package/dist/shortcuts/reception/index.js +3 -1
  60. package/dist/shortcuts/reception/manifest.js +3 -2
  61. package/dist/shortcuts/reception/operations/ask.js +20 -2
  62. package/dist/shortcuts/reception/operations/compose.js +11 -0
  63. package/dist/shortcuts/reception/operations/doc.js +59 -0
  64. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  65. package/dist/shortcuts/reception/operations/leads.js +1 -1
  66. package/dist/shortcuts/reception/operations/panels.js +84 -21
  67. package/dist/shortcuts/reception/operations/render.js +40 -0
  68. package/dist/shortcuts/reception/operations/restaurant.js +17 -4
  69. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
  70. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  71. package/dist/shortcuts/recruit-stage/shared.js +57 -0
  72. package/docs/SKILL.md +1 -0
  73. package/docs/_catalog.md +3 -0
  74. package/docs/data.md +149 -0
  75. package/docs/reception.md +59 -5
  76. package/package.json +1 -1
  77. package/scripts/check-skill-sync.mjs +188 -0
  78. package/scripts/package-skill.mjs +17 -3
  79. package/skill-template/business-info.json +23 -0
  80. package/skill-template/domains/data.md +15 -0
  81. package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
  82. package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
  83. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
  84. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
  85. package/skills/weaver-e10-data/SKILL.md +118 -0
  86. package/skills/weaver-e10-data/references/config-center.md +90 -0
  87. package/skills/weaver-e10-data/references/datasource.md +136 -0
  88. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  89. package/skills/weaver-e10-meeting/SKILL.md +39 -7
  90. package/skills/weaver-e10-reception-flow/SKILL.md +30 -16
  91. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  92. package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
  93. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
  94. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
  95. package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
  96. package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-2TRU2ZSP.js} +3 -3
@@ -516,26 +516,54 @@ function buildCommonSearchFields(fields, extra = []) {
516
516
  }
517
517
  for (const item of items) {
518
518
  const value = normalizeConditionValue(item.conditionType, item.value, item.field);
519
- result[item.field] = [{ [`${item.field}_condition_type`]: item.conditionType, [item.field]: value }];
519
+ const entry = {
520
+ [`${item.field}_condition_type`]: item.conditionType,
521
+ [item.field]: value
522
+ };
523
+ if (item.conditionType === "between" && Array.isArray(value)) {
524
+ const [min, max] = value;
525
+ entry[`${item.field}_obj`] = { value, ...dateRangePreset(min, max) };
526
+ entry[`${item.field}_selectedKeyPrior`] = false;
527
+ }
528
+ result[item.field] = [entry];
520
529
  }
521
530
  return result;
522
531
  }
532
+ var DATE_TEXT = /^\d{4}-\d{2}-\d{2}$/u;
533
+ function dateRangePreset(min, max) {
534
+ const year = (/* @__PURE__ */ new Date()).getFullYear();
535
+ if (min === `${year}-01-01` && max === `${year}-06-30`) {
536
+ return { selectedKey: "firstHalfYear", selectedName: "\u4E0A\u534A\u5E74" };
537
+ }
538
+ if (min === `${year}-07-01` && max === `${year}-12-31`) {
539
+ return { selectedKey: "secondHalfYear", selectedName: "\u4E0B\u534A\u5E74" };
540
+ }
541
+ if (min === `${year}-01-01` && max === `${year}-12-31`) {
542
+ return { selectedKey: "currentYear", selectedName: "\u4ECA\u5E74" };
543
+ }
544
+ return { selectedKey: "", selectedName: "" };
545
+ }
523
546
  function normalizeConditionValue(conditionType, value, field) {
524
547
  if (conditionType === "between") {
548
+ let min;
549
+ let max;
525
550
  if (Array.isArray(value)) {
526
551
  if (value.length !== 2) {
527
552
  throw archiveOaValidationError("search_value_invalid", `${field} \u7684 between \u6761\u4EF6\u9700\u8981\u4E24\u4E2A\u503C`);
528
553
  }
529
- return { min: String(value[0]), max: String(value[1]) };
530
- }
531
- if (value && typeof value === "object") {
554
+ min = String(value[0]);
555
+ max = String(value[1]);
556
+ } else if (value && typeof value === "object") {
532
557
  const range = value;
533
558
  if (range.min === void 0 || range.max === void 0) {
534
559
  throw archiveOaValidationError("search_value_invalid", `${field} \u7684 between \u6761\u4EF6\u9700\u8981 min / max`);
535
560
  }
536
- return { min: String(range.min), max: String(range.max) };
561
+ min = String(range.min);
562
+ max = String(range.max);
563
+ } else {
564
+ throw archiveOaValidationError("search_value_invalid", `${field} \u7684 between \u6761\u4EF6\u5FC5\u987B\u662F {min,max} \u6216 [\u8D77,\u6B62]`);
537
565
  }
538
- throw archiveOaValidationError("search_value_invalid", `${field} \u7684 between \u6761\u4EF6\u5FC5\u987B\u662F {min,max} \u6216 [\u8D77,\u6B62]`);
566
+ return DATE_TEXT.test(min) && DATE_TEXT.test(max) ? [min, max] : { min, max };
539
567
  }
540
568
  if (conditionType === "in" || conditionType === "inC") {
541
569
  if (!Array.isArray(value)) {
@@ -1039,8 +1067,8 @@ function createBorrowStartUrlOperation(profile) {
1039
1067
 
1040
1068
  // src/shortcuts/archive-oa/operations/contract.ts
1041
1069
  var CONTRACT_LIST_PATH3 = "/api/ebuilder/form/list/getListDatas";
1042
- function filterPath(profile) {
1043
- return `/api/ebuilder/form/listFilter/showFilters/${profile.listId}`;
1070
+ function searchFieldsPath(profile) {
1071
+ return `/api/ebuilder/form/listSearch/getListSearch/${profile.listId}`;
1044
1072
  }
1045
1073
  function operationName(profile, action) {
1046
1074
  return profile.source === "qys" ? `archive-oa.qys.contract.${action}` : `archive-oa.contract.${action}`;
@@ -1080,16 +1108,31 @@ function makeFieldsOperation(profile) {
1080
1108
  handler: async (_args, env) => {
1081
1109
  const response = await env.host.request({
1082
1110
  method: "GET",
1083
- path: filterPath(profile),
1111
+ path: searchFieldsPath(profile),
1084
1112
  operation: name,
1085
- query: { passid: profile.passId, sf_request_type: "ajax" }
1113
+ query: { passid: profile.passId }
1086
1114
  });
1087
1115
  const data = unwrapData(response) ?? {};
1088
- const fields = Array.isArray(data.fields) ? data.fields : Array.isArray(data) ? data : [];
1116
+ const layout = Array.isArray(data.layout) ? data.layout : [];
1117
+ const groups = Array.isArray(data.groups) ? data.groups : [];
1118
+ const groupTitle = new Map(
1119
+ groups.map((group) => [String(group.id), String(group.title ?? "")])
1120
+ );
1121
+ const fields = layout.flat().map((item) => {
1122
+ const id = String(item?.id ?? "");
1123
+ const groupId = String(item?.groupId ?? "");
1124
+ return {
1125
+ fieldName: id,
1126
+ showName: String(item?.label ?? ""),
1127
+ groupId,
1128
+ groupName: groupTitle.get(groupId) ?? "",
1129
+ hidden: item?.hide === true
1130
+ };
1131
+ }).filter((item) => item.fieldName.length > 0);
1089
1132
  return archiveOaSuccess(
1090
1133
  name,
1091
1134
  { fields },
1092
- { source: profile.source, listId: profile.listId, count: Array.isArray(fields) ? fields.length : 0 }
1135
+ { source: profile.source, listId: profile.listId, count: fields.length }
1093
1136
  );
1094
1137
  }
1095
1138
  };
@@ -1153,6 +1196,7 @@ function makeListOperation2(profile) {
1153
1196
  };
1154
1197
  }
1155
1198
  var weaverContractFieldsOperation = makeFieldsOperation(WEAVER_CONTRACT);
1199
+ var qysContractFieldsOperation = makeFieldsOperation(QYS_CONTRACT);
1156
1200
  var weaverContractListOperation = makeListOperation2(WEAVER_CONTRACT);
1157
1201
  var qysContractListOperation = makeListOperation2(QYS_CONTRACT);
1158
1202
 
@@ -1206,6 +1250,59 @@ var archiveLocateOperation = {
1206
1250
  }
1207
1251
  };
1208
1252
 
1253
+ // src/shortcuts/archive-oa/operations/contract-modules.ts
1254
+ var MODULE_BROWSER_PATH = "/api/bcw/common/browser/complete/customBrowser_sw_htzxmk";
1255
+ var MODULE_CONTROL_ID = "3753081";
1256
+ var contractModuleOptionsOperation = {
1257
+ name: "archive-oa.contract.module-options",
1258
+ resource: "contract",
1259
+ method: "module-options",
1260
+ action: "archive-oa.contract.module-options",
1261
+ summary: "\u67E5\u8BE2\u5408\u540C\u4E13\u9879\u6A21\u5757\uFF08zxfa\uFF09\u7684\u5019\u9009\u503C\uFF0C\u7528\u4E8E\u628A\u300C\u6587\u4E66\u5B9A\u300D\u7B49\u6A21\u5757\u540D\u8F6C\u6210 inC \u9700\u8981\u7684\u5BF9\u8C61",
1262
+ capability: "contract",
1263
+ risk: READ,
1264
+ inputSchema: schemaOf(
1265
+ {
1266
+ keyword: { type: "string", description: "\u5173\u952E\u5B57\uFF0C\u5982\u300C\u6587\u4E66\u5B9A\u300D\uFF0C\u7F3A\u7701\u8FD4\u56DE\u524D N \u9879" },
1267
+ pageSize: { type: "integer", minimum: 1, maximum: 100, description: "\u8FD4\u56DE\u6761\u6570\uFF0C\u7F3A\u7701 50" }
1268
+ },
1269
+ { description: "\u67E5\u8BE2\u5408\u540C\u4E13\u9879\u6A21\u5757\u5019\u9009\u503C" }
1270
+ ),
1271
+ handler: async (args, env) => {
1272
+ const keyword = typeof args.keyword === "string" ? args.keyword.trim() : "";
1273
+ const pageSize = positiveInt(args.pageSize, "pageSize", 50);
1274
+ if (pageSize > 100) {
1275
+ throw archiveOaValidationError("number_invalid", "pageSize \u6700\u591A 100");
1276
+ }
1277
+ const response = await env.host.request({
1278
+ method: "POST",
1279
+ path: MODULE_BROWSER_PATH,
1280
+ operation: "archive-oa.contract.module-options",
1281
+ body: {
1282
+ browserMultiple: true,
1283
+ fromSearch: "1",
1284
+ controlId: MODULE_CONTROL_ID,
1285
+ formParam: JSON.stringify({ filterItems: [], module: "ebuilderform", dataDetails: [] }),
1286
+ notFromLayout: true,
1287
+ newly: 0,
1288
+ searchValue: keyword
1289
+ }
1290
+ });
1291
+ const data = unwrapData(response);
1292
+ const list = Array.isArray(data?.data) ? data.data : [];
1293
+ const options = list.map((item) => ({
1294
+ id: String(item?.id ?? ""),
1295
+ name: String(item?.name ?? "")
1296
+ })).filter((item) => item.id.length > 0 && item.name.length > 0).slice(0, pageSize);
1297
+ const matched = keyword ? options.filter((item) => item.name.includes(keyword)) : options;
1298
+ return archiveOaSuccess("archive-oa.contract.module-options", {
1299
+ keyword,
1300
+ total: matched.length,
1301
+ options: matched
1302
+ });
1303
+ }
1304
+ };
1305
+
1209
1306
  // src/shortcuts/archive-oa/operations/my-borrow-contract.ts
1210
1307
  import { randomBytes as randomBytes2 } from "node:crypto";
1211
1308
  var GET_DATA_PATH = "/api/ebuilder/form/eblist/getData";
@@ -1469,7 +1566,9 @@ function buildRegistry() {
1469
1566
  const definitions = [
1470
1567
  archiveLocateOperation,
1471
1568
  myBorrowListOperation,
1569
+ contractModuleOptionsOperation,
1472
1570
  weaverContractFieldsOperation,
1571
+ qysContractFieldsOperation,
1473
1572
  weaverContractListOperation,
1474
1573
  qysContractListOperation,
1475
1574
  ...createBorrowCarOperations(WEAVER_BORROW_CAR, WEAVER_ESB_ADD, WEAVER_ESB_REMOVE),
@@ -8,9 +8,9 @@ import {
8
8
  looksLikeFileId,
9
9
  meetingAttachmentContentOperations,
10
10
  parseFileIdList
11
- } from "./chunk-OCYRVZGN.js";
12
- import "./chunk-FEP6ELMR.js";
13
- import "./chunk-NK74RE5F.js";
11
+ } from "./chunk-EJVA5ZVB.js";
12
+ import "./chunk-6GWU63YF.js";
13
+ import "./chunk-K3BT54CU.js";
14
14
  import "./chunk-7BDPM5ST.js";
15
15
  import "./chunk-UG5G54VL.js";
16
16
  import "./chunk-BUSC6UAE.js";
@@ -2,12 +2,12 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  meetingStateDir
5
- } from "./chunk-FEP6ELMR.js";
5
+ } from "./chunk-6GWU63YF.js";
6
6
  import {
7
7
  meetingSuccess,
8
8
  meetingValidationError,
9
9
  schemaOf
10
- } from "./chunk-NK74RE5F.js";
10
+ } from "./chunk-K3BT54CU.js";
11
11
 
12
12
  // src/shortcuts/meeting/operations/eb/group-chat.ts
13
13
  import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
@@ -159,7 +159,7 @@ async function triggerGroupFlow(env, input, meetingName, memberIds) {
159
159
  if (addressText === "[object Object]") addressText = "";
160
160
  if (addressText) {
161
161
  try {
162
- const { resolveAddressRoom } = await import("./create-flow-5TXFOC7X.js");
162
+ const { resolveAddressRoom } = await import("./create-flow-7WG7LVX5.js");
163
163
  const room = await resolveAddressRoom(env, addressText);
164
164
  if (room?.name) addressText = room.name;
165
165
  } catch {
@@ -201,7 +201,7 @@ async function bindGroupToMeeting(env, meetingId, groupId) {
201
201
  const group = String(groupId).trim();
202
202
  if (id === "" || group === "") return { ok: false, error: "\u6CA1\u6709\u4F1A\u8BAE id \u6216\u7FA4 id" };
203
203
  try {
204
- const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-MFCKLUT6.js");
204
+ const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-2H7Z4RWJ.js");
205
205
  const session = await env.host.getSession();
206
206
  await env.host.request({
207
207
  method: "POST",
@@ -219,7 +219,7 @@ async function bindGroupToMeeting(env, meetingId, groupId) {
219
219
  return { ok: false, error: String(error?.message ?? error).slice(0, 300) };
220
220
  }
221
221
  try {
222
- const { getMeetingOperation } = await import("./registry-22O6UG4I.js");
222
+ const { getMeetingOperation } = await import("./registry-CKUVBS53.js");
223
223
  const detail = getMeetingOperation("meeting.eb.meeting.detail");
224
224
  const read = await detail.handler({ id }, env);
225
225
  const main = read?.data?.data ?? read?.data?.main ?? {};
@@ -267,7 +267,7 @@ async function resolveMeetingByRequestId(env, requestId, sinceMs) {
267
267
  const target = String(requestId).trim();
268
268
  if (target === "") return null;
269
269
  try {
270
- const { getMeetingOperation } = await import("./registry-22O6UG4I.js");
270
+ const { getMeetingOperation } = await import("./registry-CKUVBS53.js");
271
271
  const list = getMeetingOperation("meeting.eb.meeting.list");
272
272
  const detail = getMeetingOperation("meeting.eb.meeting.detail");
273
273
  const page = await list.handler({ pageSize: 30 }, env);
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  meetingStateDir
5
- } from "./chunk-FEP6ELMR.js";
5
+ } from "./chunk-6GWU63YF.js";
6
6
 
7
7
  // src/shortcuts/meeting/operations/eb/cache.ts
8
8
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -0,0 +1,223 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ READ,
5
+ SCHEMA_ID,
6
+ SCHEMA_PAGE,
7
+ browserBaseBody,
8
+ hrmSuccess,
9
+ orgLink,
10
+ pickDefined,
11
+ schemaOf,
12
+ toNumber,
13
+ toPositiveInt,
14
+ toStringIdList
15
+ } from "./chunk-JEQHNNSS.js";
16
+ import {
17
+ hrmValidationError
18
+ } from "./chunk-56EZERK4.js";
19
+
20
+ // src/shortcuts/hrm/operations/org.ts
21
+ var ORG_TYPES = ["subcompany", "department"];
22
+ var orgQuery = {
23
+ name: "hrm.org.query",
24
+ resource: "org",
25
+ method: "org.query",
26
+ action: "hrm.org.query",
27
+ summary: "\u6309\u540D\u79F0/\u7F16\u53F7/\u4E0A\u7EA7\u7EC4\u7EC7\u67E5\u8BE2\u5206\u90E8\u6216\u90E8\u95E8\uFF08type \u533A\u5206\uFF1B\u4E0D\u4F20 type \u65F6\u9ED8\u8BA4\u90E8\u95E8\uFF0C\u53EF\u7528 type \u5207\u5206\u90E8\u5206\u90E8\uFF09",
28
+ risk: READ,
29
+ inputSchema: schemaOf({
30
+ type: { type: "string", enum: [...ORG_TYPES], description: "subcompany \u5206\u90E8 / department \u90E8\u95E8\uFF1B\u4E0D\u4F20\u9ED8\u8BA4 department" },
31
+ name: { type: "string", description: "\u540D\u79F0\uFF08\u6A21\u7CCA\u5305\u542B\u5339\u914D\uFF09" },
32
+ code: { type: "string", description: "\u7F16\u53F7\uFF08\u6A21\u7CCA\u5305\u542B\u5339\u914D\uFF09" },
33
+ parent: { type: "array", items: SCHEMA_ID, description: "\u4E0A\u7EA7\u90E8\u95E8 id \u6570\u7EC4\uFF08\u90E8\u95E8\u6302\u5728\u90E8\u95E8\u4E0B\uFF0Cdepartment\uFF09" },
34
+ subcompany: { type: "array", items: SCHEMA_ID, description: "\u4E0A\u7EA7\u5206\u90E8 id \u6570\u7EC4\uFF08\u90E8\u95E8\u6302\u5728\u5206\u90E8\u4E0B\uFF0Cdepartment\uFF09" },
35
+ supSubDepartment: { type: "array", items: SCHEMA_ID, description: "\u4E0A\u7EA7\u5206\u90E8 id \u6570\u7EC4\uFF08\u5206\u90E8\u6302\u5728\u5206\u90E8\u4E0B\uFF0Csubcompany\uFF09" },
36
+ ...SCHEMA_PAGE
37
+ }),
38
+ handler: async (args, { host }) => {
39
+ const type = args.type === void 0 ? "department" : String(args.type);
40
+ if (!ORG_TYPES.includes(type)) {
41
+ throw hrmValidationError("enum_invalid", `type \u53D6\u503C\u5FC5\u987B\u662F ${ORG_TYPES.join(" / ")} \u4E4B\u4E00`);
42
+ }
43
+ const name = args.name === void 0 ? "" : String(args.name).trim();
44
+ const code = args.code === void 0 ? "" : String(args.code).trim();
45
+ const parentIds = toStringIdList(args.parent, "parent");
46
+ const subcompanyIds = toStringIdList(args.subcompany, "subcompany");
47
+ const supSubDepartmentIds = toStringIdList(args.supSubDepartment, "supSubDepartment");
48
+ const hasText = name !== "" || code !== "";
49
+ const hasOrg = Boolean(parentIds?.length || subcompanyIds?.length || supSubDepartmentIds?.length);
50
+ if (!hasText && !hasOrg) {
51
+ throw hrmValidationError("empty_condition", "\u7EC4\u7EC7\u67E5\u8BE2\u5FC5\u987B\u643A\u5E26\u81F3\u5C11\u4E00\u4E2A\u6536\u655B\u6761\u4EF6\uFF1Aname / code / parent / subcompany / supSubDepartment");
52
+ }
53
+ const formDatas = {};
54
+ if (name) formDatas.name = [{ nameCondition: { id: "in", content: "\u5305\u542B", disabled: false }, name }];
55
+ if (code) formDatas.code = [{ codeCondition: { id: "in", content: "\u5305\u542B", disabled: false }, code }];
56
+ if (parentIds?.length) {
57
+ formDatas.parent = [{ parentCondition: { id: "eq", content: "\u7B49\u4E8E", disabled: false }, parent: parentIds.map((id) => ({ id })) }];
58
+ }
59
+ if (subcompanyIds?.length) {
60
+ formDatas.subcompany = [{ subcompanyCondition: { id: "eq", content: "\u7B49\u4E8E", disabled: false }, subcompany: subcompanyIds.map((id) => ({ id })) }];
61
+ }
62
+ if (supSubDepartmentIds?.length) {
63
+ formDatas.supSubDepartment = [{ supSubDepartmentCondition: { id: "eq", content: "\u7B49\u4E8E", disabled: false }, supSubDepartment: supSubDepartmentIds.map((id) => ({ id })) }];
64
+ }
65
+ const body = {
66
+ ...browserBaseBody(),
67
+ virtualType: "ALL",
68
+ cmd: "list",
69
+ formDatas,
70
+ quickSearchDatas: {},
71
+ type: "and",
72
+ stopDepartment: false
73
+ };
74
+ const current = toPositiveInt(args.current, "current") ?? 1;
75
+ const pageSize = toNumber(args.pageSize, "pageSize") ?? 200;
76
+ body.current = current;
77
+ body.pageSize = pageSize;
78
+ const path = type === "subcompany" ? "/api/hrm/common/browser/data/subcompany" : "/api/hrm/common/browser/data/department";
79
+ const resp = await host.request({ method: "POST", path, body });
80
+ const d = resp?.data ?? {};
81
+ const rawRows = Array.isArray(d.data) ? d.data : [];
82
+ const session = await host.getSession();
83
+ const baseUrl = session.baseUrl.replace(/\/+$/, "");
84
+ const rows = rawRows.map((r) => ({ ...r, link: orgLink(baseUrl, r.id) }));
85
+ return hrmSuccess("hrm.org.query", { rows, total: Number(d.total ?? rows.length), type }, { current, pageSize });
86
+ }
87
+ };
88
+ var orgDetail = {
89
+ name: "hrm.org.detail",
90
+ resource: "org",
91
+ method: "org.detail",
92
+ action: "hrm.org.detail",
93
+ summary: "\u6309\u7EC4\u7EC7\u8282\u70B9 id \u53D6\u90E8\u95E8/\u5206\u90E8\u8BE6\u60C5\u8868\u5355\uFF08\u7C7B\u578B\u7531\u670D\u52A1\u7AEF\u6309\u8BB0\u5F55\u81EA\u52A8\u5224\u65AD\uFF1B\u542B\u5168\u8DEF\u5F84 fullPath \u4E0E\u4EBA\u5458\u7EDF\u8BA1\uFF09",
94
+ risk: READ,
95
+ inputSchema: schemaOf(
96
+ { id: SCHEMA_ID },
97
+ { required: ["id"] }
98
+ ),
99
+ handler: async (args, { host }) => {
100
+ const id = String(args.id).trim();
101
+ if (!id) throw hrmValidationError("id_required", "id \u5FC5\u586B");
102
+ const session = await host.getSession();
103
+ const baseUrl = session.baseUrl.replace(/\/+$/, "");
104
+ const resp = await host.request({
105
+ method: "GET",
106
+ path: "/api/bs/hrm/organization/getForm",
107
+ query: { id, readOnly: true, includeSub: true, quote: true, isMobile: false },
108
+ headers: { Referer: `${baseUrl}/sp/hrm/orgCard/${id}` }
109
+ });
110
+ const raw = resp?.data?.data ?? {};
111
+ const parentName = Array.isArray(raw.parent) && raw.parent[0]?.name ? String(raw.parent[0].name) : "";
112
+ const subcompanyName = Array.isArray(raw.subcompany) && raw.subcompany[0]?.name ? String(raw.subcompany[0].name) : "";
113
+ return hrmSuccess("hrm.org.detail", {
114
+ id,
115
+ name: raw.name,
116
+ type: raw.type,
117
+ code: raw.code,
118
+ fullPath: raw.fullPath,
119
+ status: raw.status,
120
+ ...parentName ? { parentName } : {},
121
+ ...subcompanyName ? { subcompanyName } : {},
122
+ ...pickDefined(raw, ["description", "remark"]),
123
+ link: orgLink(baseUrl, id)
124
+ });
125
+ }
126
+ };
127
+ var orgLookup = {
128
+ name: "hrm.org.lookup",
129
+ resource: "org",
130
+ method: "org.lookup",
131
+ action: "hrm.org.lookup",
132
+ summary: "\u7EC4\u7EC7\u6A21\u7CCA\u67E5\u627E\uFF1A\u5173\u952E\u8BCD**\u4E0D\u7528\u5199\u5168**\uFF0C\u4E00\u6B21\u8FD4\u56DE\u6240\u6709\u8FD1\u4F3C\u7684\u90E8\u95E8/\u5206\u90E8\uFF08\u542B\u5B8C\u6574\u8DEF\u5F84\u3001\u6309\u76F8\u4F3C\u5EA6\u6392\u5E8F\uFF09",
133
+ risk: READ,
134
+ inputSchema: schemaOf({
135
+ keyword: { type: "string", minLength: 1, description: "\u90E8\u95E8/\u5206\u90E8\u540D\u79F0\u5173\u952E\u8BCD\uFF08\u53EF\u53EA\u5199\u4E00\u90E8\u5206\uFF0C\u5982\u300C\u4F1A\u8BAE\u7BA1\u7406\u300D\u300C\u7814\u53D1\u300D\uFF09" },
136
+ type: { type: "string", enum: ["department", "subcompany", "both"], description: "\u9ED8\u8BA4 both\uFF08\u90E8\u95E8+\u5206\u90E8\u90FD\u67E5\uFF09" },
137
+ limit: { type: "number", minimum: 1, maximum: 50, description: "\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 10" }
138
+ }, { required: ["keyword"] }),
139
+ handler: async (args, { host }) => {
140
+ const keyword = String(args.keyword ?? "").trim();
141
+ if (!keyword) throw hrmValidationError("keyword_required", "keyword \u5FC5\u586B");
142
+ const scope = args.type === "department" || args.type === "subcompany" ? String(args.type) : "both";
143
+ const limit = Math.max(1, Math.min(50, Number(args.limit) || 10));
144
+ const fetchOrg = async (type, text) => {
145
+ const body = {
146
+ ...browserBaseBody(),
147
+ virtualType: "ALL",
148
+ cmd: "list",
149
+ formDatas: { name: [{ nameCondition: { id: "in", content: "\u5305\u542B", disabled: false }, name: text }] },
150
+ quickSearchDatas: {},
151
+ type: "and",
152
+ stopDepartment: false,
153
+ current: 1,
154
+ pageSize: 200
155
+ };
156
+ const path = type === "subcompany" ? "/api/hrm/common/browser/data/subcompany" : "/api/hrm/common/browser/data/department";
157
+ const resp = await host.request({ method: "POST", path, body });
158
+ const rows2 = resp?.data?.data ?? [];
159
+ return rows2.map((r) => ({
160
+ id: String(r.id ?? ""),
161
+ name: String(r.name ?? ""),
162
+ type,
163
+ fullPath: String(r.fullPath ?? r.path ?? ""),
164
+ ...r.subcompanyName ? { subcompanyName: String(r.subcompanyName) } : {},
165
+ ...r.parentName ? { parentName: String(r.parentName) } : {}
166
+ })).filter((r) => r.id);
167
+ };
168
+ const types = scope === "both" ? ["department", "subcompany"] : [scope];
169
+ const collected = [];
170
+ let requests = 0;
171
+ const stripSuffix = (text) => text.replace(/(部门|事业部|中心|科室|组|部)$/u, "").trim();
172
+ for (const type of types) {
173
+ requests += 1;
174
+ collected.push(...await fetchOrg(type, keyword));
175
+ const stripped = stripSuffix(keyword);
176
+ if (collected.length === 0 && stripped !== "" && stripped !== keyword) {
177
+ const raws = await fetchOrg(type, stripped);
178
+ collected.push(...raws.map((row) => ({ ...row, stripped: true })));
179
+ requests += 1;
180
+ }
181
+ if (collected.length === 0) {
182
+ for (let len = Math.min(keyword.length, 6) - 1; len >= 2; len -= 1) {
183
+ const short = keyword.slice(0, len);
184
+ const raws = await fetchOrg(type, short);
185
+ requests += 1;
186
+ if (raws.length > 0) {
187
+ collected.push(...raws.map((row) => ({ ...row, shortened: short })));
188
+ break;
189
+ }
190
+ }
191
+ }
192
+ }
193
+ const scoreOf = (row) => {
194
+ const name = String(row.name);
195
+ const pathText = String(row.fullPath ?? "");
196
+ let score = 0;
197
+ if (name === keyword) score = 100;
198
+ else if (name.startsWith(keyword)) score = 85;
199
+ else if (name.includes(keyword)) score = 70;
200
+ else if (pathText.includes(keyword)) score = 50;
201
+ else score = 35;
202
+ if (row.type === "department") score += 5;
203
+ if (row.stripped) score -= 5;
204
+ if (row.shortened) score -= 15;
205
+ return score;
206
+ };
207
+ const rows = collected.map((row) => ({ ...row, score: scoreOf(row) })).sort((left, right) => Number(right.score) - Number(left.score) || String(left.name).localeCompare(String(right.name), "zh-Hans-CN")).slice(0, limit);
208
+ return hrmSuccess("hrm.org.lookup", {
209
+ rows,
210
+ total: rows.length,
211
+ ...rows.length === 0 ? { hint: `\u6CA1\u6709\u540D\u79F0\u542B\u300C${keyword}\u300D\u7684\u90E8\u95E8\u6216\u5206\u90E8\u3002\u6362\u66F4\u77ED\u7684\u5173\u952E\u8BCD\uFF08\u5982\u4E24\u4E2A\u5B57\uFF09\u518D\u8BD5\uFF0C\u6216\u7528 hrm.org.query \u6309 parent/subcompany \u9010\u7EA7\u627E\u3002` } : {}
212
+ }, { requests, keyword });
213
+ }
214
+ };
215
+ var hrmOrgOperations = [
216
+ orgQuery,
217
+ orgLookup,
218
+ orgDetail
219
+ ];
220
+
221
+ export {
222
+ hrmOrgOperations
223
+ };
@@ -5,7 +5,7 @@ import {
5
5
  ebBusinessSuccess,
6
6
  meetingSuccess,
7
7
  meetingValidationError
8
- } from "./chunk-NK74RE5F.js";
8
+ } from "./chunk-K3BT54CU.js";
9
9
 
10
10
  // src/shortcuts/meeting/operations/env.ts
11
11
  import { existsSync } from "node:fs";