weaver-work-cli 0.1.36 → 0.1.39

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 (169) hide show
  1. package/README.md +4 -2
  2. package/dist/chunks/{archive-XBVH7JU7.js → archive-ENZYBBME.js} +559 -68
  3. package/dist/chunks/{archive-oa-MZM3EKFQ.js → archive-oa-YWLEC5V4.js} +4 -3
  4. package/dist/chunks/{asset-4XO7UOUW.js → asset-OOV6DWPA.js} +8 -7
  5. package/dist/chunks/asset-idle-RE632MY5.js +670 -0
  6. package/dist/chunks/{attachment-content-VXSWANAC.js → attachment-content-RWN2FCLL.js} +3 -3
  7. package/dist/chunks/{blog-PGZKOPSC.js → blog-PEPOJAL7.js} +5 -4
  8. package/dist/chunks/{caizhilian-BH4ZVGUN.js → caizhilian-WYIQDVPJ.js} +5 -4
  9. package/dist/chunks/{calendar-MXEMTIO4.js → calendar-CIARBAOX.js} +4 -3
  10. package/dist/chunks/{chunk-NCOVUAZK.js → chunk-36DIFZAH.js} +4 -3
  11. package/dist/chunks/{chunk-I6QGIBDM.js → chunk-BJGXMFGD.js} +4 -3
  12. package/dist/chunks/{chunk-TC6MZAO3.js → chunk-CQHGNCK2.js} +52 -2
  13. package/dist/chunks/{chunk-WXFPWCXG.js → chunk-EINRJHQ3.js} +3 -3
  14. package/dist/chunks/{chunk-JUXVYKII.js → chunk-EZGFHJFW.js} +201 -19
  15. package/dist/chunks/{chunk-VPUTVEMC.js → chunk-F2EQXUEE.js} +436 -290
  16. package/dist/chunks/{chunk-JYKABYCV.js → chunk-GVPJZXJ2.js} +3 -3
  17. package/dist/chunks/{chunk-6LLJFKJE.js → chunk-HJYVHXUQ.js} +1 -1
  18. package/dist/chunks/{chunk-T72N74ZT.js → chunk-I2HB737U.js} +5 -4
  19. package/dist/chunks/{chunk-VPXOPQJI.js → chunk-K3RUEEOL.js} +4 -2
  20. package/dist/chunks/{chunk-HXJQI5NM.js → chunk-KTCB5R5H.js} +3 -2
  21. package/dist/chunks/{chunk-XMGSYD6S.js → chunk-L4N7B7ZD.js} +4 -4
  22. package/dist/chunks/{chunk-QYGO5EE2.js → chunk-MUQUHKPG.js} +4 -3
  23. package/dist/chunks/{chunk-QHFANTX7.js → chunk-NLK2RZKG.js} +1348 -90
  24. package/dist/chunks/{chunk-F746NKNF.js → chunk-P2DAISYW.js} +1 -1
  25. package/dist/chunks/{chunk-BPE37FPB.js → chunk-T7JDJJ7H.js} +3 -3
  26. package/dist/chunks/{chunk-JNG42JKG.js → chunk-XXJOSZTQ.js} +6 -6
  27. package/dist/chunks/{chunk-5DQEEGCC.js → chunk-YS5DPN4T.js} +1 -1
  28. package/dist/chunks/{chunk-EG6ZU444.js → chunk-ZUX3P6BQ.js} +10 -5
  29. package/dist/chunks/{chunk-JCSN3JGM.js → chunk-ZXRNHZTE.js} +7 -6
  30. package/dist/chunks/{conflict-JAB2LJEZ.js → conflict-DRMDOL56.js} +2 -2
  31. package/dist/chunks/{contract-XI2EEIZU.js → contract-73MERZWN.js} +4 -3
  32. package/dist/chunks/{cowork-SCPGLBA4.js → cowork-HNGBPD7A.js} +4 -3
  33. package/dist/chunks/{ebuilder-form-EYLHNOTA.js → ebuilder-form-OY6DVNRK.js} +3 -3
  34. package/dist/chunks/{ehr-EAP77IMT.js → ehr-RAQNEQO7.js} +4 -3
  35. package/dist/chunks/{esb-2TGGXEE7.js → esb-6XV7C7YV.js} +4 -4
  36. package/dist/chunks/{fna-2X7ZE7BU.js → fna-XTSRB7G7.js} +4 -3
  37. package/dist/chunks/{host-Q4LZGCRU.js → host-3F5UM5GN.js} +3 -3
  38. package/dist/chunks/{host-XCLDDXKQ.js → host-A7J6GDUP.js} +3 -3
  39. package/dist/chunks/{host-I4NRK4MX.js → host-VGPVP7YF.js} +3 -3
  40. package/dist/chunks/{host-C6EL2RKL.js → host-YAQAPYNP.js} +3 -3
  41. package/dist/chunks/{host-UEI5FGDM.js → host-YMBXWFWX.js} +3 -3
  42. package/dist/chunks/{hrm-YXERJM76.js → hrm-TLHKC545.js} +3 -3
  43. package/dist/chunks/{im-A4VZN2TQ.js → im-YOUCFMUK.js} +3 -3
  44. package/dist/chunks/{invoice-2Z6YPMIS.js → invoice-WNBS2B4C.js} +3 -3
  45. package/dist/chunks/{jiuchuanhui-AR5GMKZB.js → jiuchuanhui-XABWS5RN.js} +4 -3
  46. package/dist/chunks/{lazy-dispatch-QXW7P4X3.js → lazy-dispatch-NLZ5UQQI.js} +5 -5
  47. package/dist/chunks/{mail-7GZ6CPBJ.js → mail-LRYMBFNL.js} +4 -3
  48. package/dist/chunks/{meeting-3NMGA3MB.js → meeting-ESXL6MFI.js} +13 -12
  49. package/dist/chunks/{okr-BZ6XUOAG.js → okr-EOV65SSF.js} +4 -3
  50. package/dist/chunks/{plan-DR5CMUYP.js → plan-YFPVKW6Y.js} +4 -3
  51. package/dist/chunks/{project-6J63MK33.js → project-MDVZUYQW.js} +4 -3
  52. package/dist/chunks/{registry-VRTNC6UR.js → registry-QCLZEDAP.js} +8 -8
  53. package/dist/chunks/{registry-KDD7DHNK.js → registry-VT5Y2HLA.js} +4 -4
  54. package/dist/chunks/{registry-TKX2E7C7.js → registry-YX4CSEMD.js} +3 -3
  55. package/dist/chunks/{room-recommend-XCWRMB5P.js → room-recommend-L3MWH4JW.js} +4 -4
  56. package/dist/chunks/{schedule-IVBICP32.js → schedule-UASAVDVD.js} +4 -4
  57. package/dist/chunks/{workflow-D74NFK3C.js → workflow-KDGIUCNW.js} +9 -6
  58. package/dist/core/output.js +16 -6
  59. package/dist/index.js +33 -28
  60. package/dist/internal/e10/auth/messages.js +1 -0
  61. package/dist/internal/e10/auth-recovery.js +127 -7
  62. package/dist/internal/e10/client.js +16 -2
  63. package/dist/internal/e10/context.js +16 -3
  64. package/dist/internal/e10/request-runtime.js +106 -8
  65. package/dist/shortcuts/archive/host.js +5 -2
  66. package/dist/shortcuts/archive/manifest.js +1 -1
  67. package/dist/shortcuts/archive/operations/borrow-list.js +13 -1
  68. package/dist/shortcuts/archive/operations/flow-url.js +1 -1
  69. package/dist/shortcuts/archive/operations/prelib.js +472 -0
  70. package/dist/shortcuts/archive/operations/registry.js +2 -0
  71. package/dist/shortcuts/archive/operations/upload.js +1 -1
  72. package/dist/shortcuts/archive-oa/host.js +2 -1
  73. package/dist/shortcuts/asset/host.js +6 -5
  74. package/dist/shortcuts/asset-idle/errors.js +44 -0
  75. package/dist/shortcuts/asset-idle/host.js +161 -0
  76. package/dist/shortcuts/asset-idle/index.js +114 -0
  77. package/dist/shortcuts/asset-idle/manifest.js +159 -0
  78. package/dist/shortcuts/asset-idle/operations/idle.js +47 -0
  79. package/dist/shortcuts/asset-idle/operations/registry.js +33 -0
  80. package/dist/shortcuts/asset-idle/operations/shared.js +142 -0
  81. package/dist/shortcuts/asset-idle/operations/types.js +9 -0
  82. package/dist/shortcuts/asset-idle/operations.js +15 -0
  83. package/dist/shortcuts/blog/host.js +3 -2
  84. package/dist/shortcuts/caizhilian/host.js +3 -2
  85. package/dist/shortcuts/calendar/host.js +2 -1
  86. package/dist/shortcuts/contract/host.js +2 -1
  87. package/dist/shortcuts/cowork/host.js +2 -1
  88. package/dist/shortcuts/ebuilder-form/host.js +3 -1
  89. package/dist/shortcuts/ehr/host.js +2 -1
  90. package/dist/shortcuts/esb/host.js +2 -1
  91. package/dist/shortcuts/fna/host.js +2 -1
  92. package/dist/shortcuts/hrm/host.js +2 -1
  93. package/dist/shortcuts/im/host.js +3 -2
  94. package/dist/shortcuts/index.js +5 -0
  95. package/dist/shortcuts/invoice/host.js +5 -4
  96. package/dist/shortcuts/jiuchuanhui/host.js +2 -1
  97. package/dist/shortcuts/mail/host.js +2 -1
  98. package/dist/shortcuts/meeting/host.js +3 -2
  99. package/dist/shortcuts/meeting/invitation/text.js +71 -0
  100. package/dist/shortcuts/meeting/operations/eb/create-flow.js +1073 -50
  101. package/dist/shortcuts/meeting/operations/eb/crm-search.js +478 -0
  102. package/dist/shortcuts/meeting/operations/eb/factory.js +60 -1
  103. package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
  104. package/dist/shortcuts/meeting/operations/invitation.js +122 -9
  105. package/dist/shortcuts/okr/host.js +2 -1
  106. package/dist/shortcuts/plan/host.js +2 -1
  107. package/dist/shortcuts/project/host.js +2 -1
  108. package/dist/shortcuts/workflow/host.js +3 -0
  109. package/dist/shortcuts/workflow/index.js +1 -1
  110. package/dist/shortcuts/workflow/operations/form.js +44 -11
  111. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +77 -26
  112. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +6 -0
  113. package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +59 -117
  114. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +44 -7
  115. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +37 -29
  116. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +20 -6
  117. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +22 -18
  118. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +34 -10
  119. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -2
  120. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +9 -2
  121. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +110 -20
  122. package/docs/_catalog.md +3 -0
  123. package/docs/asset-idle.md +45 -0
  124. package/docs/e10-auth.md +1 -1
  125. package/docs/todo-smart-convert/subgroup-rules.md +1 -1
  126. package/package.json +1 -1
  127. package/scripts/package-skill.mjs +2 -0
  128. package/skill-template/business-info.json +14 -1
  129. package/skill-template/domains/asset-idle.md +13 -0
  130. package/skill-template/domains/wenshuding.md +3 -0
  131. package/skills/weaver-e10-archive-oa/SKILL.md +1 -0
  132. package/skills/weaver-e10-archive-oa/references/my-borrow.md +49 -0
  133. package/skills/weaver-e10-asset-idle/SKILL.md +73 -0
  134. package/skills/weaver-e10-asset-idle/references/idle-list.md +62 -0
  135. package/skills/weaver-e10-asset-idle/references/idle-stats-and-charts.md +65 -0
  136. package/skills/weaver-e10-asset-idle/references/source-manifest.json +193 -0
  137. package/skills/weaver-e10-asset-idle/references/widget-style.md +205 -0
  138. package/skills/weaver-e10-caizhilian/SKILL.md +29 -11
  139. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +12 -0
  140. package/skills/weaver-e10-caizhilian/references/files.md +1 -1
  141. package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +1 -1
  142. package/skills/weaver-e10-caizhilian/references/source-manifest.json +45 -45
  143. package/skills/weaver-e10-cowork/SKILL.md +2 -0
  144. package/skills/weaver-e10-jucailin/SKILL.md +2 -0
  145. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -0
  146. package/skills/weaver-e10-jucailin/references/recruit-write.md +1 -1
  147. package/skills/weaver-e10-mail/SKILL.md +3 -0
  148. package/skills/weaver-e10-meeting/SKILL.md +250 -301
  149. package/skills/weaver-e10-meeting/references/meeting-eb.md +203 -0
  150. package/skills/weaver-e10-meeting/references/meeting-invitation.md +37 -5
  151. package/skills/weaver-e10-meeting.zip +0 -0
  152. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  153. package/skills/weaver-e10-shared/SKILL.md +5 -5
  154. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +3 -3
  155. package/skills/weaver-e10-wenshuding/SKILL.md +29 -6
  156. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +14 -0
  157. package/skills/weaver-e10-wenshuding/references/archive-download.md +2 -0
  158. package/skills/weaver-e10-wenshuding/references/archive-flow.md +1 -1
  159. package/skills/weaver-e10-wenshuding/references/archive-prelib-arrange.md +76 -0
  160. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +107 -0
  161. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +59 -0
  162. package/skills/weaver-e10-wenshuding/references/archive-upload.md +4 -1
  163. package/skills/weaver-e10-wenshuding/references/source-manifest.json +108 -65
  164. package/skills/weaver-e10-workflow/SKILL.md +5 -2
  165. package/skills/weaver-e10-workflow/aigroup/default.json +154 -19
  166. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +59 -27
  167. package/skills/weaver-e10-workflow/tools/todo-serve.cjs +113 -25
  168. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +292 -42
  169. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
@@ -3,12 +3,13 @@ const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  E10ApiError,
5
5
  createE10RequestRuntime,
6
+ isE10SessionExpiredResponse,
6
7
  requireE10Session
7
- } from "./chunk-JUXVYKII.js";
8
+ } from "./chunk-EZGFHJFW.js";
8
9
  import {
9
10
  E10_SESSION_EXPIRED_MESSAGE,
10
11
  getActiveProfile
11
- } from "./chunk-JNG42JKG.js";
12
+ } from "./chunk-XXJOSZTQ.js";
12
13
  import {
13
14
  CliError,
14
15
  isCliError,
@@ -572,7 +573,9 @@ function createArchiveHost(ctx, dependencies = {}) {
572
573
  form: multipart === void 0 && form === void 0 ? void 0 : formBody(form ?? {}),
573
574
  formData: multipart,
574
575
  headers: { "X-Requested-With": "XMLHttpRequest", ...extraHeaders },
575
- timeoutMs
576
+ timeoutMs,
577
+ // 下载接口常 302 重定向到文件服务/CDN,需跟随,避免被误判为登录失效
578
+ followRedirects: true
576
579
  }) : await rt.requestJson({
577
580
  module: "archive",
578
581
  operation,
@@ -589,7 +592,7 @@ function createArchiveHost(ctx, dependencies = {}) {
589
592
  }
590
593
  async function request(request2) {
591
594
  const response = await doRequest(request2, false).catch((error) => mapRuntimeNetworkError(error));
592
- if (response.status === 401 || response.status === 302) {
595
+ if (isE10SessionExpiredResponse(response)) {
593
596
  throw archiveAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
594
597
  }
595
598
  if (response.parseError) {
@@ -620,7 +623,7 @@ function createArchiveHost(ctx, dependencies = {}) {
620
623
  }
621
624
  async function requestBinary(request2) {
622
625
  const response = await doRequest(request2, true).catch((error) => mapRuntimeNetworkError(error));
623
- if (response.status === 401 || response.status === 302) {
626
+ if (isE10SessionExpiredResponse(response)) {
624
627
  throw archiveAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
625
628
  }
626
629
  if (response.status < 200 || response.status >= 300) {
@@ -819,6 +822,530 @@ var prelibTree = {
819
822
  };
820
823
  var fondsOperations = [fondsList, prelibTree];
821
824
 
825
+ // src/shortcuts/archive/operations/prelib.ts
826
+ import { randomBytes as randomBytes2 } from "node:crypto";
827
+
828
+ // src/shortcuts/archive/operations/confirm.ts
829
+ function requireConfirm(args, action) {
830
+ if (args.confirm !== true) {
831
+ throw archiveConfirmationError(action, {
832
+ hint: `\u6267\u884C ${action} \u5FC5\u987B\u663E\u5F0F\u786E\u8BA4\uFF1A\u4F20\u5165 confirm=true\uFF08CLI \u7528 --yes\uFF09`
833
+ });
834
+ }
835
+ }
836
+ async function issueLease(env, action, payload, ttlMs = 10 * 6e4) {
837
+ const session = await env.host.getSession();
838
+ const continuation = await env.continuation.issue(
839
+ {
840
+ operation: action,
841
+ baseUrl: session.baseUrl,
842
+ userId: session.userId,
843
+ ...payload
844
+ },
845
+ ttlMs
846
+ );
847
+ return { continuation, expiresInMs: ttlMs };
848
+ }
849
+ async function verifyLease(args, action, env) {
850
+ requireConfirm(args, action);
851
+ if (typeof args.continuation !== "string" || !args.continuation.trim()) {
852
+ throw archiveValidationError("continuation_required", `${action} \u5FC5\u987B\u4F20\u5165 prepare \u8FD4\u56DE\u7684 continuation`);
853
+ }
854
+ const lease = await env.continuation.verify(args.continuation.trim(), action);
855
+ const session = await env.host.getSession();
856
+ if (lease.baseUrl !== session.baseUrl || lease.userId !== session.userId) {
857
+ throw archiveValidationError(
858
+ "continuation_context_mismatch",
859
+ "\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF08\u73AF\u5883\u6216\u767B\u5F55\u8D26\u53F7\u4E0D\u540C\uFF09\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare"
860
+ );
861
+ }
862
+ return lease;
863
+ }
864
+ function assertLeaseTarget(lease, args, keys, action) {
865
+ for (const key of keys) {
866
+ if (args[key] === void 0 || args[key] === null || args[key] === "") continue;
867
+ if (String(lease[key] ?? "") !== String(args[key])) {
868
+ throw archiveValidationError(
869
+ "continuation_target_changed",
870
+ `${action} \u7684\u53C2\u6570 ${key} \u4E0E prepare \u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare`
871
+ );
872
+ }
873
+ }
874
+ }
875
+
876
+ // src/shortcuts/archive/operations/prelib.ts
877
+ var PRELIB_MENU_SIGN = "preLib";
878
+ var PRELIB_TREE_TYPE = "4";
879
+ var PRELIB_NODE_TYPE = 2;
880
+ var PRELIB_FORM_TAG = '["",""]';
881
+ var INTELLIGENT_APPLY = "archive.prelib.intelligent.apply";
882
+ var ARRANGE_APPLY = "archive.prelib.arrange.apply";
883
+ var NON_DISPLAY_FIELDS = /* @__PURE__ */ new Set([
884
+ "id",
885
+ "rowKey",
886
+ "flowId",
887
+ "form_data_id",
888
+ "form_table_id",
889
+ "ebrecord_rowkey",
890
+ "isFollow",
891
+ "is_flow",
892
+ "isToDo",
893
+ "todoPropSpan",
894
+ "data_status_value"
895
+ ]);
896
+ function isEfileLibNode2(id) {
897
+ if (typeof id !== "string" || !id.includes("_")) return false;
898
+ const [left, right] = id.split("_");
899
+ return Boolean(left && left === right);
900
+ }
901
+ function optionalText(value) {
902
+ if (typeof value !== "string") return void 0;
903
+ const text = value.trim();
904
+ return text ? text : void 0;
905
+ }
906
+ async function resolveEfileNode(host, treeId) {
907
+ const response = await host.request({
908
+ method: "POST",
909
+ path: "/api/archive/core/archivetree/getTree",
910
+ body: {
911
+ treeType: PRELIB_TREE_TYPE,
912
+ menuSign: PRELIB_MENU_SIGN,
913
+ logFlag: PRELIB_MENU_SIGN,
914
+ needControl: true,
915
+ needSysn: true
916
+ }
917
+ });
918
+ const data = unwrapData(response);
919
+ const nodes = Array.isArray(data) ? data : [];
920
+ const efileNodes = nodes.filter((item) => isEfileLibNode2(item?.id)).map((item) => ({ treeId: String(item.id), nodeName: String(item.content ?? "") }));
921
+ if (treeId) {
922
+ const matched = efileNodes.find((item) => item.treeId === treeId);
923
+ return matched ?? { treeId, nodeName: "" };
924
+ }
925
+ if (efileNodes.length === 0) {
926
+ throw archiveValidationError(
927
+ "prelib_node_missing",
928
+ "\u672A\u627E\u5230\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9\uFF08\u9884\u5F52\u6863\u6811\u8FD4\u56DE\u4E3A\u7A7A\uFF09\u3002\u8BF7\u5148\u91CD\u65B0\u83B7\u53D6\u4E00\u6B21\uFF1A\u91CD\u8BD5\u672C operation\uFF0C\u6216\u7528\u5DF2\u77E5 treeId \u663E\u5F0F\u4F20\u5165\uFF1B\u82E5\u4ECD\u7136\u83B7\u53D6\u4E0D\u5230\uFF0C\u901A\u5E38\u662F\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u8BE5\u9884\u5F52\u6863\u5E93\u6743\u9650\uFF0C\u6B64\u65F6\u5E94\u505C\u6B62\u540E\u7EED\u64CD\u4F5C\uFF08\u4E0D\u8981\u731C\u6D4B treeId\uFF0C\u4E5F\u4E0D\u8981\u7EE7\u7EED\u4E0A\u4F20\uFF09\u3002"
929
+ );
930
+ }
931
+ return efileNodes[0];
932
+ }
933
+ async function fetchTreeDetail(host, treeId) {
934
+ const response = await host.request({
935
+ method: "POST",
936
+ path: "/api/archive/core/archivetree/getTreeDetail",
937
+ body: {
938
+ treeType: PRELIB_TREE_TYPE,
939
+ rootNode: "",
940
+ rootNodeTag: "",
941
+ needControl: true,
942
+ formTag: PRELIB_FORM_TAG,
943
+ preFileFilterId: "",
944
+ menuSign: PRELIB_MENU_SIGN,
945
+ treeId,
946
+ nodeType: PRELIB_NODE_TYPE,
947
+ logFlag: PRELIB_MENU_SIGN
948
+ }
949
+ });
950
+ const data = unwrapData(response) ?? {};
951
+ const url1 = String(data.url1 ?? "").trim();
952
+ const matched = url1.match(/(\d+)\s*$/u);
953
+ const listId = matched?.[1] ?? "";
954
+ const extra = data.extraParams ?? {};
955
+ const metaFormId = String(extra.metaFormId ?? "").trim();
956
+ const tag = String(extra.tag ?? "").trim();
957
+ if (!listId || !metaFormId) {
958
+ throw archiveValidationError(
959
+ "prelib_detail_invalid",
960
+ `getTreeDetail \u672A\u8FD4\u56DE\u6709\u6548\u7684\u5217\u8868\u89C6\u56FE\uFF08url1=${url1 || "\u7A7A"}\uFF0CmetaFormId=${metaFormId || "\u7A7A"}\uFF09`
961
+ );
962
+ }
963
+ const boxUrl = String(data.boxUrl ?? "").trim();
964
+ return { listId, metaFormId, tag, url1, ...boxUrl ? { boxUrl } : {} };
965
+ }
966
+ async function fetchPrelibDatas(host, node, detail, pageNo) {
967
+ const current = positiveInt(pageNo, "pageNo", 1);
968
+ const [appId] = node.treeId.split("_");
969
+ const paramsJson = JSON.stringify({
970
+ treeType: PRELIB_TREE_TYPE,
971
+ rootNode: "",
972
+ rootNodeTag: "",
973
+ needControl: true,
974
+ formTag: PRELIB_FORM_TAG,
975
+ preFileFilterId: "",
976
+ menuSign: PRELIB_MENU_SIGN,
977
+ id: node.treeId,
978
+ nodeType: PRELIB_NODE_TYPE,
979
+ isLeaf: true,
980
+ content: node.nodeName
981
+ });
982
+ const response = await host.request({
983
+ method: "POST",
984
+ path: "/api/ebuilder/form/list/getListDatas",
985
+ query: { passid: detail.metaFormId, cid: detail.metaFormId },
986
+ body: {
987
+ current,
988
+ requiredMatch: 1,
989
+ tableuid: randomBytes2(16).toString("hex"),
990
+ mapResult: "1",
991
+ recheckQuery: "1",
992
+ metaFormId: detail.metaFormId,
993
+ tag: detail.tag,
994
+ treeId: node.treeId,
995
+ nodeType: PRELIB_NODE_TYPE,
996
+ systemId: appId,
997
+ metaId: appId,
998
+ hasBtn: "1",
999
+ paramsJson,
1000
+ metaName: node.nodeName,
1001
+ menuSign: PRELIB_MENU_SIGN,
1002
+ searchParamData: { type: "and", searchType: "2", commonSearchFields: {}, groupFields: {} },
1003
+ listId: detail.listId,
1004
+ isFollow: 0,
1005
+ isShareToMe: 0,
1006
+ filterCondition: {},
1007
+ browser: "Chrome"
1008
+ }
1009
+ });
1010
+ const data = unwrapData(response) ?? {};
1011
+ const columns = (Array.isArray(data.columns) ? data.columns : []).map((item) => ({
1012
+ title: String(item?.title ?? ""),
1013
+ dataIndex: String(item?.dataIndex ?? ""),
1014
+ hide: item?.hide === true
1015
+ }));
1016
+ const rows = Array.isArray(data.data) ? data.data : Array.isArray(data.displayData) ? data.displayData : [];
1017
+ const displayData = Array.isArray(data.displayData) ? data.displayData : [];
1018
+ const visibleColumns = columns.filter((item) => item?.hide !== true).map((item) => ({ title: String(item?.title ?? ""), dataIndex: String(item?.dataIndex ?? "") }));
1019
+ const fieldNames = /* @__PURE__ */ new Set();
1020
+ for (const row of [...rows, ...displayData]) {
1021
+ for (const key of Object.keys(row)) {
1022
+ if (!key || NON_DISPLAY_FIELDS.has(key) || /(?:Action|Span)$/.test(key)) continue;
1023
+ fieldNames.add(key);
1024
+ }
1025
+ }
1026
+ const dataFields = [...fieldNames];
1027
+ const pageSize = data.pageSize === void 0 ? void 0 : Number(data.pageSize);
1028
+ const total = data.total === void 0 ? void 0 : Number(data.total);
1029
+ return {
1030
+ columns,
1031
+ visibleColumns,
1032
+ rows,
1033
+ displayData,
1034
+ dataFields,
1035
+ pageNo: Number(data.current ?? current),
1036
+ ...pageSize === void 0 ? {} : { pageSize },
1037
+ ...total === void 0 ? {} : { total }
1038
+ };
1039
+ }
1040
+ var prelibList = {
1041
+ name: "archive.prelib.list",
1042
+ resource: "prelib",
1043
+ method: "list",
1044
+ action: "archive.prelib.list",
1045
+ summary: "\u67E5\u8BE2\u9884\u5F52\u6863\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\uFF1AtreeId \u2192 getTreeDetail \u53D6\u5217\u8868\u89C6\u56FE\uFF08url1/metaFormId/tag\uFF09\u2192 getListDatas \u53D6\u5217\u4E0E\u6570\u636E\u884C\uFF08\u53EA\u8BFB\uFF09",
1046
+ capability: "prelib",
1047
+ risk: READ,
1048
+ inputSchema: schemaOf(
1049
+ {
1050
+ treeId: {
1051
+ type: "string",
1052
+ description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF08\u5F62\u5982 {appId}_{appId}\uFF09\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
1053
+ },
1054
+ pageNo: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" }
1055
+ },
1056
+ { description: "\u67E5\u8BE2\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868" }
1057
+ ),
1058
+ handler: async (args, { host }) => {
1059
+ const node = await resolveEfileNode(host, optionalText(args.treeId));
1060
+ const detail = await fetchTreeDetail(host, node.treeId);
1061
+ const page = await fetchPrelibDatas(host, node, detail, args.pageNo);
1062
+ const session = await host.getSession();
1063
+ const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
1064
+ const openUrls = page.rows.map((row) => {
1065
+ const id = String(row?.id ?? "").trim();
1066
+ const path = `${PRELIB_FILE_LIB_EDIT_PATH}?${new URLSearchParams({ singleMetaId: id, treeId: node.treeId }).toString()}`;
1067
+ return id && root ? `${root}${path}` : "";
1068
+ });
1069
+ return archiveSuccess(
1070
+ "archive.prelib.list",
1071
+ {
1072
+ treeId: node.treeId,
1073
+ nodeName: node.nodeName,
1074
+ listId: detail.listId,
1075
+ metaFormId: detail.metaFormId,
1076
+ tag: detail.tag,
1077
+ url1: detail.url1,
1078
+ ...detail.boxUrl ? { boxUrl: detail.boxUrl } : {},
1079
+ ...page,
1080
+ openUrls
1081
+ },
1082
+ { count: page.rows.length, nodeName: node.nodeName }
1083
+ );
1084
+ }
1085
+ };
1086
+ var intelligentPrepare = {
1087
+ name: "archive.prelib.intelligent.prepare",
1088
+ resource: "prelib",
1089
+ method: "intelligent",
1090
+ action: "archive.prelib.intelligent.prepare",
1091
+ summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u53D1\u8D77\u667A\u80FD\u8BC6\u522B\uFF08\u9884\u68C0\uFF0C\u4E0D\u5199\u6570\u636E\uFF09\uFF1A\u89E3\u6790 treeId/formId \u5E76\u751F\u6210\u786E\u8BA4\u7968\u636E",
1092
+ capability: "prelib",
1093
+ risk: READ,
1094
+ inputSchema: schemaOf(
1095
+ {
1096
+ treeId: {
1097
+ type: "string",
1098
+ description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
1099
+ },
1100
+ checkIds: {
1101
+ type: "array",
1102
+ items: { type: "string" },
1103
+ description: "\u52FE\u9009\u7684\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09"
1104
+ },
1105
+ formId: {
1106
+ type: "string",
1107
+ description: "\u8868\u5355 ID\uFF1B\u4E0D\u4F20\u65F6\u53D6 getTreeDetail \u7684 extraParams.metaFormId"
1108
+ }
1109
+ },
1110
+ { required: ["checkIds"], description: "\u667A\u80FD\u8BC6\u522B\u9884\u68C0" }
1111
+ ),
1112
+ handler: async (args, env) => {
1113
+ const checkIds = toStringIdList(args.checkIds, "checkIds");
1114
+ if (!checkIds || checkIds.length === 0) {
1115
+ throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
1116
+ }
1117
+ const node = await resolveEfileNode(env.host, optionalText(args.treeId));
1118
+ const detail = await fetchTreeDetail(env.host, node.treeId);
1119
+ const formId = optionalText(args.formId) ?? detail.metaFormId;
1120
+ const { continuation, expiresInMs } = await issueLease(env, INTELLIGENT_APPLY, {
1121
+ treeId: node.treeId,
1122
+ formId,
1123
+ checkIds
1124
+ });
1125
+ return archiveSuccess(
1126
+ "archive.prelib.intelligent.prepare",
1127
+ {
1128
+ preview: { treeId: node.treeId, nodeName: node.nodeName, formId, count: checkIds.length, checkIds },
1129
+ hint: `\u786E\u8BA4\u540E\u8C03\u7528 ${INTELLIGENT_APPLY}\uFF08CLI\uFF1Aarchive run ${INTELLIGENT_APPLY} --input-json '{"continuation":"<token>","confirm":true}'\uFF09`,
1130
+ continuation
1131
+ },
1132
+ { requiresConfirmation: true, expiresInMs }
1133
+ );
1134
+ }
1135
+ };
1136
+ var intelligentApply = {
1137
+ name: INTELLIGENT_APPLY,
1138
+ resource: "prelib",
1139
+ method: "intelligent",
1140
+ action: INTELLIGENT_APPLY,
1141
+ summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u53D1\u8D77\u667A\u80FD\u8BC6\u522B\uFF08\u5199\u64CD\u4F5C\uFF09\uFF1A\u8C03\u7528 intelligentCate \u63D0\u4EA4\u8BC6\u522B\u4EFB\u52A1\uFF0C\u8FD4\u56DE taskId",
1142
+ capability: "prelib",
1143
+ risk: WRITE,
1144
+ requiresConfirmation: true,
1145
+ inputSchema: schemaOf(
1146
+ {
1147
+ continuation: { type: "string", description: "prepare \u8FD4\u56DE\u7684\u786E\u8BA4\u7968\u636E" },
1148
+ confirm: { type: "boolean", description: "\u5FC5\u987B\u4E3A true\uFF08CLI --yes\uFF09" }
1149
+ },
1150
+ { required: ["continuation", "confirm"], description: "\u63D0\u4EA4\u667A\u80FD\u8BC6\u522B\u4EFB\u52A1" }
1151
+ ),
1152
+ handler: async (args, env) => {
1153
+ const lease = await verifyLease(args, INTELLIGENT_APPLY, env);
1154
+ const treeId = String(lease.treeId ?? "").trim();
1155
+ const formId = String(lease.formId ?? "").trim();
1156
+ const checkIds = Array.isArray(lease.checkIds) ? lease.checkIds.map(String) : [];
1157
+ if (!treeId || !formId || checkIds.length === 0) {
1158
+ throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 treeId / formId / checkIds");
1159
+ }
1160
+ const response = await env.host.request({
1161
+ method: "POST",
1162
+ path: "/api/archive/core/intelligent/intelligentCate",
1163
+ body: {
1164
+ treeId,
1165
+ checkIds: checkIds.join(","),
1166
+ formId,
1167
+ logFlag: PRELIB_MENU_SIGN
1168
+ }
1169
+ });
1170
+ const data = unwrapData(response) ?? {};
1171
+ const taskId = String(data.taskId ?? "").trim();
1172
+ return archiveSuccess(
1173
+ INTELLIGENT_APPLY,
1174
+ {
1175
+ treeId,
1176
+ formId,
1177
+ checkIds,
1178
+ ...taskId ? { taskId } : {},
1179
+ hint: "\u667A\u80FD\u8BC6\u522B\u4E3A\u5F02\u6B65\u4EFB\u52A1\uFF0C\u8FD4\u56DE taskId \u8868\u793A\u5DF2\u63D0\u4EA4\uFF1B\u8BC6\u522B\u7ED3\u679C\u9700\u5728\u7CFB\u7EDF\u4E2D\u67E5\u770B"
1180
+ },
1181
+ { wrote: true, count: checkIds.length }
1182
+ );
1183
+ }
1184
+ };
1185
+ var arrangePrepare = {
1186
+ name: "archive.prelib.arrange.prepare",
1187
+ resource: "prelib",
1188
+ method: "arrange",
1189
+ action: "archive.prelib.arrange.prepare",
1190
+ summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u63D0\u4EA4\u6574\u7406\uFF08\u9884\u68C0\uFF0C\u4E0D\u5199\u6570\u636E\uFF09\uFF1A\u89E3\u6790 treeId/formId \u5E76\u751F\u6210\u786E\u8BA4\u7968\u636E",
1191
+ capability: "prelib",
1192
+ risk: READ,
1193
+ inputSchema: schemaOf(
1194
+ {
1195
+ treeId: {
1196
+ type: "string",
1197
+ description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
1198
+ },
1199
+ checkIds: {
1200
+ type: "array",
1201
+ items: { type: "string" },
1202
+ description: "\u52FE\u9009\u7684\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09"
1203
+ },
1204
+ formId: {
1205
+ type: "string",
1206
+ description: "\u8868\u5355 ID\uFF1B\u4E0D\u4F20\u65F6\u53D6 getTreeDetail \u7684 extraParams.metaFormId"
1207
+ }
1208
+ },
1209
+ { required: ["checkIds"], description: "\u63D0\u4EA4\u6574\u7406\u9884\u68C0" }
1210
+ ),
1211
+ handler: async (args, env) => {
1212
+ const checkIds = toStringIdList(args.checkIds, "checkIds");
1213
+ if (!checkIds || checkIds.length === 0) {
1214
+ throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
1215
+ }
1216
+ const node = await resolveEfileNode(env.host, optionalText(args.treeId));
1217
+ const detail = await fetchTreeDetail(env.host, node.treeId);
1218
+ const formId = optionalText(args.formId) ?? detail.metaFormId;
1219
+ const { continuation, expiresInMs } = await issueLease(env, ARRANGE_APPLY, {
1220
+ treeId: node.treeId,
1221
+ formId,
1222
+ checkIds
1223
+ });
1224
+ return archiveSuccess(
1225
+ "archive.prelib.arrange.prepare",
1226
+ {
1227
+ preview: { treeId: node.treeId, nodeName: node.nodeName, formId, count: checkIds.length, checkIds },
1228
+ hint: `\u53EA\u6709\u8BC6\u522B\u72B6\u6001\u4E3A\u300C\u5DF2\u8BC6\u522B\u300D\u7684\u6570\u636E\u624D\u4F1A\u88AB\u6574\u7406\uFF1B\u672A\u8BC6\u522B / \u8BC6\u522B\u4E2D / \u8BC6\u522B\u5F02\u5E38\u7684\u884C\u63D0\u4EA4\u540E\u4E5F\u4F1A\u88AB\u670D\u52A1\u7AEF\u8FC7\u6EE4\u6389\uFF08\u4E0D\u62A5\u9519\u4F46\u5B9E\u9645\u4E0D\u5904\u7406\uFF09\uFF0C\u5EFA\u8BAE\u5148\u505A\u667A\u80FD\u8BC6\u522B\u5E76\u786E\u8BA4\u8BC6\u522B\u6210\u529F\u3002\u786E\u8BA4\u540E\u8C03\u7528 ${ARRANGE_APPLY}\uFF1B\u670D\u52A1\u7AEF\u4F1A\u8FD4\u56DE\u5B9E\u9645\u5904\u7406\u6761\u6570\uFF0C\u4E0D\u8981\u58F0\u79F0\u5168\u90E8\u6574\u7406\u5B8C\u6210`,
1229
+ continuation
1230
+ },
1231
+ { requiresConfirmation: true, expiresInMs }
1232
+ );
1233
+ }
1234
+ };
1235
+ var arrangeApply = {
1236
+ name: ARRANGE_APPLY,
1237
+ resource: "prelib",
1238
+ method: "arrange",
1239
+ action: ARRANGE_APPLY,
1240
+ summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u63D0\u4EA4\u6574\u7406\uFF08\u5199\u64CD\u4F5C\uFF09\uFF1A\u8C03\u7528 prefileBatch/batchSave\uFF0C\u8FD4\u56DE\u670D\u52A1\u7AEF\u5904\u7406\u8BF4\u660E",
1241
+ capability: "prelib",
1242
+ risk: WRITE,
1243
+ requiresConfirmation: true,
1244
+ inputSchema: schemaOf(
1245
+ {
1246
+ continuation: { type: "string", description: "prepare \u8FD4\u56DE\u7684\u786E\u8BA4\u7968\u636E" },
1247
+ confirm: { type: "boolean", description: "\u5FC5\u987B\u4E3A true\uFF08CLI --yes\uFF09" }
1248
+ },
1249
+ { required: ["continuation", "confirm"], description: "\u63D0\u4EA4\u6574\u7406" }
1250
+ ),
1251
+ handler: async (args, env) => {
1252
+ const lease = await verifyLease(args, ARRANGE_APPLY, env);
1253
+ const treeId = String(lease.treeId ?? "").trim();
1254
+ const formId = String(lease.formId ?? "").trim();
1255
+ const checkIds = Array.isArray(lease.checkIds) ? lease.checkIds.map(String) : [];
1256
+ if (!treeId || !formId || checkIds.length === 0) {
1257
+ throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 treeId / formId / checkIds");
1258
+ }
1259
+ const response = await env.host.request({
1260
+ method: "POST",
1261
+ path: "/api/archive/core/prefileBatch/batchSave",
1262
+ body: {
1263
+ treeId,
1264
+ autoBatchProduct: true,
1265
+ formId,
1266
+ checkIds: checkIds.join(","),
1267
+ logFlag: PRELIB_MENU_SIGN
1268
+ }
1269
+ });
1270
+ const raw = response;
1271
+ const message = String(raw?.msg ?? "").trim();
1272
+ return archiveSuccess(
1273
+ ARRANGE_APPLY,
1274
+ {
1275
+ treeId,
1276
+ formId,
1277
+ checkIds,
1278
+ ...message ? { message } : {},
1279
+ hint: "\u63D0\u4EA4\u6574\u7406\u53EA\u5904\u7406\u8BC6\u522B\u72B6\u6001\u4E3A\u300C\u5DF2\u8BC6\u522B\u300D\u7684\u6570\u636E\uFF1B\u672A\u8BC6\u522B / \u8BC6\u522B\u4E2D / \u8BC6\u522B\u5F02\u5E38\u7684\u884C\u4F1A\u88AB\u670D\u52A1\u7AEF\u8FC7\u6EE4\u3002\u5FC5\u987B\u628A\u670D\u52A1\u7AEF message \u5982\u5B9E\u8F6C\u8FBE\uFF0C\u4E0D\u8981\u58F0\u79F0\u5168\u90E8\u6574\u7406\u5B8C\u6210\uFF1B\u82E5\u5904\u7406\u6761\u6570\u4E3A 0\uFF0C\u63D0\u793A\u7528\u6237\u5148\u505A\u667A\u80FD\u8BC6\u522B\u4E14\u8BC6\u522B\u6210\u529F\u540E\u518D\u6574\u7406"
1280
+ },
1281
+ { wrote: true, count: checkIds.length }
1282
+ );
1283
+ }
1284
+ };
1285
+ var PRELIB_FILE_LIB_EDIT_PATH = "/sp/custom/archive/fileLibEdit";
1286
+ var prelibOpen = {
1287
+ name: "archive.prelib.open",
1288
+ resource: "prelib",
1289
+ method: "open",
1290
+ action: "archive.prelib.open",
1291
+ summary: "\u751F\u6210\u9884\u5F52\u6863\u7535\u5B50\u6587\u4EF6\u5E93\u91CC\u6307\u5B9A\u6570\u636E\u7684\u6863\u6848\u6253\u5F00\u94FE\u63A5\uFF08\u53EA\u8BFB\uFF09\uFF1A\u6309\u884C id\uFF08singleMetaId\uFF09\u4E0E\u8282\u70B9 treeId \u62FC\u51FA fileLibEdit \u94FE\u63A5",
1292
+ capability: "prelib",
1293
+ risk: READ,
1294
+ inputSchema: schemaOf(
1295
+ {
1296
+ checkIds: {
1297
+ type: "array",
1298
+ items: { type: "string" },
1299
+ description: "\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09\uFF0C\u5373\u94FE\u63A5\u7684 singleMetaId"
1300
+ },
1301
+ treeId: {
1302
+ type: "string",
1303
+ description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u81EA\u52A8\u53D6\u3002treeId \u672C\u8EAB\u5373 ${systemId}_${metadataId}"
1304
+ }
1305
+ },
1306
+ { required: ["checkIds"], description: "\u751F\u6210\u6863\u6848\u6253\u5F00\u94FE\u63A5" }
1307
+ ),
1308
+ handler: async (args, env) => {
1309
+ const checkIds = toStringIdList(args.checkIds, "checkIds");
1310
+ if (!checkIds || checkIds.length === 0) {
1311
+ throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
1312
+ }
1313
+ const node = await resolveEfileNode(env.host, optionalText(args.treeId));
1314
+ const [systemId, metadataId = ""] = node.treeId.split("_");
1315
+ const session = await env.host.getSession();
1316
+ const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
1317
+ const links = checkIds.map((id) => {
1318
+ const path = `${PRELIB_FILE_LIB_EDIT_PATH}?${new URLSearchParams({ singleMetaId: id, treeId: node.treeId }).toString()}`;
1319
+ return {
1320
+ singleMetaId: id,
1321
+ treeId: node.treeId,
1322
+ path,
1323
+ url: root ? `${root}${path}` : path
1324
+ };
1325
+ });
1326
+ return archiveSuccess(
1327
+ "archive.prelib.open",
1328
+ {
1329
+ nodeName: node.nodeName,
1330
+ systemId,
1331
+ metadataId,
1332
+ count: links.length,
1333
+ links,
1334
+ ...links.length === 1 ? { url: links[0].url } : {},
1335
+ hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u8BE5 URL\uFF08\u9700\u5DF2\u767B\u5F55\u8BE5\u73AF\u5883\u4E14\u6709\u8BE5\u6863\u6848\u67E5\u770B\u6743\u9650\uFF09"
1336
+ }
1337
+ );
1338
+ }
1339
+ };
1340
+ var prelibOperations = [
1341
+ prelibList,
1342
+ intelligentPrepare,
1343
+ intelligentApply,
1344
+ arrangePrepare,
1345
+ arrangeApply,
1346
+ prelibOpen
1347
+ ];
1348
+
822
1349
  // src/shortcuts/archive/operations/archive-info.ts
823
1350
  function splitArcId(arcDangan, field) {
824
1351
  const text = typeof arcDangan === "string" ? arcDangan : String(arcDangan ?? "");
@@ -956,7 +1483,7 @@ var searchRun = {
956
1483
  var searchOperations = [searchRun];
957
1484
 
958
1485
  // src/shortcuts/archive/operations/getPageUrl.ts
959
- import { randomBytes as randomBytes2 } from "node:crypto";
1486
+ import { randomBytes as randomBytes3 } from "node:crypto";
960
1487
  var ARCHIVE_APP_TAG = "archive_wsd";
961
1488
  var BORROW_CAR_TAG = "uf_arc_borrow_car";
962
1489
  var BORROWING_TAG = "uf_arc_borrowing";
@@ -1043,7 +1570,7 @@ async function fetchArchiveListDatas(host, target, pageNo, logFlag) {
1043
1570
  listId: target.viewId,
1044
1571
  searchParamData: { searchType: "2", type: "and", commonSearchFields: {}, groupFields: {} },
1045
1572
  requiredMatch: 1,
1046
- tableuid: randomBytes2(16).toString("hex"),
1573
+ tableuid: randomBytes3(16).toString("hex"),
1047
1574
  mapResult: "1",
1048
1575
  recheckQuery: "1",
1049
1576
  isFollow: 0,
@@ -1406,7 +1933,17 @@ var borrowListDetail = {
1406
1933
  }
1407
1934
  const session = await host.getSession();
1408
1935
  const detail = await fetchBorrowDetail(host, session.userId, String(dataId));
1409
- return archiveSuccess("archive.borrow-list.detail", detail, { count: detail.details.length });
1936
+ const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
1937
+ const details = detail.details.map((item) => ({
1938
+ ...item,
1939
+ arcDangan: item.arcDangan.map((arc) => {
1940
+ const [arcId, arcFormId = ""] = String(arc.id ?? "").split("_");
1941
+ if (!arcId || !arcFormId) return arc;
1942
+ const viewPath = `/sp/custom/archive/archiveView?arcId=${arcId}&arcFormId=${arcFormId}`;
1943
+ return { ...arc, viewPath, url: root ? `${root}${viewPath}` : viewPath };
1944
+ })
1945
+ }));
1946
+ return archiveSuccess("archive.borrow-list.detail", { ...detail, details }, { count: details.length });
1410
1947
  }
1411
1948
  };
1412
1949
  var borrowListOperations = [borrowListList, borrowListDetail];
@@ -1416,56 +1953,6 @@ import { existsSync as existsSync2 } from "node:fs";
1416
1953
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
1417
1954
  import { homedir as homedir2 } from "node:os";
1418
1955
  import { basename, dirname, extname, resolve as resolve2 } from "node:path";
1419
-
1420
- // src/shortcuts/archive/operations/confirm.ts
1421
- function requireConfirm(args, action) {
1422
- if (args.confirm !== true) {
1423
- throw archiveConfirmationError(action, {
1424
- hint: `\u6267\u884C ${action} \u5FC5\u987B\u663E\u5F0F\u786E\u8BA4\uFF1A\u4F20\u5165 confirm=true\uFF08CLI \u7528 --yes\uFF09`
1425
- });
1426
- }
1427
- }
1428
- async function issueLease(env, action, payload, ttlMs = 10 * 6e4) {
1429
- const session = await env.host.getSession();
1430
- const continuation = await env.continuation.issue(
1431
- {
1432
- operation: action,
1433
- baseUrl: session.baseUrl,
1434
- userId: session.userId,
1435
- ...payload
1436
- },
1437
- ttlMs
1438
- );
1439
- return { continuation, expiresInMs: ttlMs };
1440
- }
1441
- async function verifyLease(args, action, env) {
1442
- requireConfirm(args, action);
1443
- if (typeof args.continuation !== "string" || !args.continuation.trim()) {
1444
- throw archiveValidationError("continuation_required", `${action} \u5FC5\u987B\u4F20\u5165 prepare \u8FD4\u56DE\u7684 continuation`);
1445
- }
1446
- const lease = await env.continuation.verify(args.continuation.trim(), action);
1447
- const session = await env.host.getSession();
1448
- if (lease.baseUrl !== session.baseUrl || lease.userId !== session.userId) {
1449
- throw archiveValidationError(
1450
- "continuation_context_mismatch",
1451
- "\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF08\u73AF\u5883\u6216\u767B\u5F55\u8D26\u53F7\u4E0D\u540C\uFF09\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare"
1452
- );
1453
- }
1454
- return lease;
1455
- }
1456
- function assertLeaseTarget(lease, args, keys, action) {
1457
- for (const key of keys) {
1458
- if (args[key] === void 0 || args[key] === null || args[key] === "") continue;
1459
- if (String(lease[key] ?? "") !== String(args[key])) {
1460
- throw archiveValidationError(
1461
- "continuation_target_changed",
1462
- `${action} \u7684\u53C2\u6570 ${key} \u4E0E prepare \u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare`
1463
- );
1464
- }
1465
- }
1466
- }
1467
-
1468
- // src/shortcuts/archive/operations/download.ts
1469
1956
  var DOWNLOAD_APPLY = "archive.borrow-list.download.apply";
1470
1957
  var EXPORT_TYPES = ["0", "1"];
1471
1958
  var EXPORT_STRUCTURES = ["", "0", "1", "2"];
@@ -1490,7 +1977,7 @@ function sleep(ms) {
1490
1977
  setTimeout(done, ms);
1491
1978
  });
1492
1979
  }
1493
- function optionalText(value, field) {
1980
+ function optionalText2(value, field) {
1494
1981
  if (value === void 0 || value === null || value === "") return void 0;
1495
1982
  if (typeof value !== "string") {
1496
1983
  throw archiveValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
@@ -1502,9 +1989,9 @@ function parseExportParams(args) {
1502
1989
  if (!EXPORT_TYPES.includes(exportType)) {
1503
1990
  throw archiveValidationError("export_type_invalid", "exportType \u53EA\u80FD\u662F 0\uFF08\u76F4\u63A5\u5BFC\u51FA\uFF09\u6216 1\uFF08\u5206\u7EC4\u5BFC\u51FA\uFF09");
1504
1991
  }
1505
- const exportStructure = optionalText(args.exportStructure, "exportStructure") ?? "";
1506
- const groupField = optionalText(args.groupField, "groupField") ?? "";
1507
- const documentField = optionalText(args.documentField, "documentField") ?? "";
1992
+ const exportStructure = optionalText2(args.exportStructure, "exportStructure") ?? "";
1993
+ const groupField = optionalText2(args.groupField, "groupField") ?? "";
1994
+ const documentField = optionalText2(args.documentField, "documentField") ?? "";
1508
1995
  if (!EXPORT_STRUCTURES.includes(exportStructure)) {
1509
1996
  throw archiveValidationError("export_structure_invalid", "exportStructure \u53EA\u80FD\u662F\u7A7A\u30010\u30011\u30012");
1510
1997
  }
@@ -1589,7 +2076,7 @@ var downloadPrepare = {
1589
2076
  const exportParams = parseExportParams(args);
1590
2077
  const session = await env.host.getSession();
1591
2078
  const { workflowId, returnDateTime } = await assertDownloadable(env.host, session.userId, String(dataId));
1592
- const output = optionalText(args.output, "output");
2079
+ const output = optionalText2(args.output, "output");
1593
2080
  const { continuation, expiresInMs } = await issueLease(env, DOWNLOAD_APPLY, {
1594
2081
  dataId: String(dataId),
1595
2082
  requestId: workflowId,
@@ -1771,7 +2258,7 @@ function flowResult(action, baseUrl, workflowId, params, extra = {}) {
1771
2258
  workflowId,
1772
2259
  url: buildFlowUrl(baseUrl, workflowId, params),
1773
2260
  params,
1774
- hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u8BE5 URL \u5B8C\u6210\u540E\u7EED\u586B\u5199\u4E0E\u63D0\u4EA4"
2261
+ hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u4E5F\u4E0D\u8981\u6267\u884C open/start \u81EA\u52A8\u6253\u5F00\uFF1B\u8BF7\u628A url \u4EE5 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u7531\u5BA2\u6237\u7AEF\u51B3\u5B9A\u6253\u5F00\u65B9\u5F0F"
1775
2262
  },
1776
2263
  { wrote: true }
1777
2264
  );
@@ -2000,7 +2487,7 @@ import { basename as basename2, resolve as resolve3 } from "node:path";
2000
2487
  import { readFile as readFile2 } from "node:fs/promises";
2001
2488
  var UPLOAD_APPLY = "archive.upload.prelib.apply";
2002
2489
  var MAX_UPLOAD_BYTES = 200 * 1024 * 1024;
2003
- function isEfileLibNode2(item) {
2490
+ function isEfileLibNode3(item) {
2004
2491
  const id = typeof item?.id === "string" ? item.id : "";
2005
2492
  if (!id || !id.includes("_")) return false;
2006
2493
  const [left, right] = id.split("_");
@@ -2016,9 +2503,12 @@ async function resolveDefaultTreeId(host) {
2016
2503
  if (!Array.isArray(data)) {
2017
2504
  throw archiveValidationError("tree_invalid", "getTree \u8FD4\u56DE\u5F02\u5E38\uFF1Adata \u4E0D\u662F\u6570\u7EC4");
2018
2505
  }
2019
- const nodes = data.filter(isEfileLibNode2);
2506
+ const nodes = data.filter(isEfileLibNode3);
2020
2507
  if (nodes.length === 0) {
2021
- throw archiveValidationError("tree_id_required", "\u672A\u627E\u5230\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9\uFF0C\u8BF7\u663E\u5F0F\u4F20\u5165 treeId");
2508
+ throw archiveValidationError(
2509
+ "tree_id_required",
2510
+ "\u672A\u627E\u5230\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9\uFF08\u9884\u5F52\u6863\u6811\u8FD4\u56DE\u4E3A\u7A7A\uFF09\u3002\u8BF7\u5148\u91CD\u65B0\u83B7\u53D6\u4E00\u6B21\uFF1A\u91CD\u8BD5\u672C operation\uFF0C\u6216\u7528\u5DF2\u77E5 treeId \u663E\u5F0F\u4F20\u5165\uFF1B\u82E5\u4ECD\u7136\u83B7\u53D6\u4E0D\u5230\uFF0C\u901A\u5E38\u662F\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u8BE5\u9884\u5F52\u6863\u5E93\u6743\u9650\uFF0C\u6B64\u65F6\u5E94\u505C\u6B62\u4E0A\u4F20\uFF08\u4E0D\u8981\u731C\u6D4B treeId\uFF09\u3002"
2511
+ );
2022
2512
  }
2023
2513
  if (nodes.length > 1) {
2024
2514
  throw archiveValidationError(
@@ -2184,6 +2674,7 @@ function buildRegistry() {
2184
2674
  const registry = /* @__PURE__ */ new Map();
2185
2675
  const definitions = [
2186
2676
  ...fondsOperations,
2677
+ ...prelibOperations,
2187
2678
  ...archiveInfoOperations,
2188
2679
  ...searchOperations,
2189
2680
  ...borrowCarOperations,
@@ -2238,7 +2729,7 @@ var archiveManifest = {
2238
2729
  rules: [
2239
2730
  "\u5199\u64CD\u4F5C\uFF08*.apply\uFF09\u5FC5\u987B\u5148\u6267\u884C\u540C\u540D\u7684 prepare \u62FF\u5230 continuation\uFF0C\u518D\u5E26 confirm=true \u6267\u884C apply\uFF1BCLI \u7528 --yes \u8868\u793A\u786E\u8BA4\u3002",
2240
2731
  "\u501F\u9605\u5355\u4E0B\u8F7D\u4E3A\u5F02\u6B65\u4EFB\u52A1\uFF1Aapply \u4F1A\u8F6E\u8BE2\u6253\u5305\u8FDB\u5EA6\uFF0C\u5B8C\u6210\u540E\u628A zip \u4FDD\u5B58\u5230\u5F53\u524D\u7528\u6237\u7684\u300C\u4E0B\u8F7D\u300D\u76EE\u5F55\uFF08\u53EF\u7528 output \u6307\u5B9A\u8DEF\u5F84\uFF09\u3002",
2241
- "\u53D1\u8D77\u501F\u9605/\u7EED\u501F\u53EA\u8FD4\u56DE\u6D41\u7A0B\u521B\u5EFA\u9875 URL\uFF0CCLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u9700\u7531\u7528\u6237\u6216\u4E0A\u5C42\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u3002",
2732
+ "\u53D1\u8D77\u501F\u9605/\u7EED\u501F\u53EA\u8FD4\u56DE\u6D41\u7A0B\u521B\u5EFA\u9875 URL\uFF0CCLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF1B\u5E94\u4EE5 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u7531\u5BA2\u6237\u7AEF\u51B3\u5B9A\u6253\u5F00\u65B9\u5F0F\u3002",
2242
2733
  "\u501F\u9605\u8F66/\u501F\u9605\u5355\u5217\u8868\u4F18\u5148\u81EA\u5B9A\u4E49\u63A5\u53E3\uFF0C\u63A5\u53E3\u672A\u53D1\u5E03\u65F6\u81EA\u52A8\u56DE\u9000 ebuilder \u5217\u8868\u94FE\u8DEF\uFF0C\u56DE\u9000\u65F6\u884C\u7684\u5B57\u6BB5\u66F4\u5C11\uFF08\u63D0\u4F9B fields/display\uFF09\u3002"
2243
2734
  ],
2244
2735
  operations: archiveOperations,