weaver-work-cli 0.1.44 → 0.1.46

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 (241) hide show
  1. package/README.md +9 -5
  2. package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
  3. package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
  4. package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
  5. package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
  6. package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-MCXQBD6N.js} +3 -3
  7. package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
  8. package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
  9. package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
  10. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  11. package/dist/chunks/{chunk-FAZTGX7S.js → chunk-4RWS2YYL.js} +5 -5
  12. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-6AXKWFKG.js} +32 -12
  13. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  14. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-6V5ZPKHV.js} +56 -12
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-76H3IKH6.js} +178 -37
  17. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-AD46OMQK.js} +239 -41
  18. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  19. package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
  20. package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
  21. package/dist/chunks/{chunk-CWYGFU5B.js → chunk-GSZTA43P.js} +2 -2
  22. package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  23. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-IP4CWQCF.js} +11 -11
  24. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-IRMIEDXN.js} +1 -1
  25. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  26. package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-JFAWZX53.js} +134 -13
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-OXHHJWNC.js} +1 -1
  29. package/dist/chunks/chunk-P5GQRWDC.js +60 -0
  30. package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
  31. package/dist/chunks/{chunk-OF4S23UB.js → chunk-PSOMGA3U.js} +4 -4
  32. package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
  33. package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
  34. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-UFIFZ4YC.js} +48 -14
  35. package/dist/chunks/chunk-VRPH24IC.js +76 -0
  36. package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
  37. package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
  38. package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-H7EHQXYY.js} +2 -2
  39. package/dist/chunks/continuation-GW6PRWK3.js +12 -0
  40. package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
  41. package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
  42. package/dist/chunks/{create-flow-J22BO65E.js → create-flow-VRVJEOBX.js} +6 -6
  43. package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
  44. package/dist/chunks/{ehr-GSTGAIY3.js → ehr-SH2LM3NK.js} +648 -88
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-66FPSJDV.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-UH2TZBVA.js} +1 -1
  49. package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
  50. package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-CAKMMV7K.js} +3 -3
  51. package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
  52. package/dist/chunks/host-7NTIBSPK.js +25 -0
  53. package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
  54. package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
  55. package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
  56. package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
  57. package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
  58. package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
  59. package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
  60. package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
  61. package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-DD6ULZ3I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-VTBFW4HI.js} +12 -12
  64. package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
  65. package/dist/chunks/operations-J7PUIVWZ.js +15 -0
  66. package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
  67. package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
  68. package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
  69. package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-CAKZTUA7.js} +1343 -178
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-IM5G23LS.js → registry-JVQBLFQ5.js} +10 -10
  72. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  73. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-5U55FMXZ.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-IDETODCA.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/cmd/action.js +14 -10
  78. package/dist/index.js +30 -30
  79. package/dist/internal/e10/auth/commands.js +32 -0
  80. package/dist/internal/e10/auth/error-log.js +156 -26
  81. package/dist/internal/e10/auth/xiaoe.js +176 -13
  82. package/dist/internal/e10/context.js +12 -1
  83. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  84. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  85. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  86. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  87. package/dist/shortcuts/archive/operations/shared.js +52 -0
  88. package/dist/shortcuts/contract/host.js +111 -4
  89. package/dist/shortcuts/contract/index.js +19 -0
  90. package/dist/shortcuts/contract/manifest.js +125 -0
  91. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  92. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  93. package/dist/shortcuts/contract/operations/customer.js +192 -0
  94. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  95. package/dist/shortcuts/contract/operations/flow.js +44 -2
  96. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  97. package/dist/shortcuts/contract/operations/registry.js +8 -0
  98. package/dist/shortcuts/contract/operations/review.js +116 -1
  99. package/dist/shortcuts/contract/operations/summary.js +177 -0
  100. package/dist/shortcuts/contract/operations/upload.js +64 -4
  101. package/dist/shortcuts/contract/upload-cache.js +104 -0
  102. package/dist/shortcuts/ehr/host.js +2 -2
  103. package/dist/shortcuts/ehr/index.js +14 -3
  104. package/dist/shortcuts/ehr/manifest.js +5 -1
  105. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +44 -12
  106. package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
  107. package/dist/shortcuts/ehr/operations/recruit-position.js +146 -43
  108. package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
  109. package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
  110. package/dist/shortcuts/ehr/operations/recruit-write.js +154 -36
  111. package/dist/shortcuts/ehr/operations/recruit.js +196 -12
  112. package/dist/shortcuts/ehr/operations/registry.js +4 -0
  113. package/dist/shortcuts/ehr/operations.js +24 -0
  114. package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
  115. package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
  116. package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
  117. package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
  118. package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
  119. package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
  120. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
  121. package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
  122. package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
  123. package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
  124. package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
  125. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
  126. package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
  127. package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
  128. package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
  129. package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
  130. package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
  131. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  132. package/dist/shortcuts/meeting/operations/eb/create-flow.js +274 -75
  133. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  134. package/dist/shortcuts/meeting/operations/eb/factory.js +63 -11
  135. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  136. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +38 -7
  137. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  138. package/dist/shortcuts/meeting/operations/invitation.js +27 -4
  139. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  140. package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
  141. package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
  142. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +356 -29
  143. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +36 -10
  144. package/dist/shortcuts/recruit-stage/operations/jd-create.js +309 -67
  145. package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
  146. package/dist/shortcuts/recruit-stage/operations/resume-import.js +310 -17
  147. package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
  148. package/dist/shortcuts/recruit-stage/shared.js +221 -24
  149. package/dist/shortcuts/workflow/index.js +2 -0
  150. package/dist/shortcuts/workflow/operations/read.js +8 -3
  151. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  152. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  153. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  154. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  155. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  156. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  157. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  158. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  159. package/docs/contract.md +1 -0
  160. package/docs/e10-auth.md +4 -2
  161. package/docs/todo-smart-convert/data-contract.md +7 -0
  162. package/package.json +1 -1
  163. package/skill-template/domains/jinchengda.md +2 -0
  164. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  165. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  166. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  167. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  168. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  169. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  170. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  171. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  172. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  173. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  174. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  175. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  176. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  177. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  178. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  179. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  180. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  181. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  182. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  183. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  184. package/skills/weaver-e10-jucailin/SKILL.md +12 -3
  185. package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
  186. package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
  187. package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
  188. package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
  189. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
  190. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
  191. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
  192. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
  193. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
  194. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
  195. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
  196. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
  197. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
  198. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
  199. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
  200. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
  201. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
  202. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
  203. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
  204. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
  205. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
  206. package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
  207. package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
  208. package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -91
  209. package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
  210. package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
  211. package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
  212. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
  213. package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
  214. package/skills/weaver-e10-jucailin/references/recruit-write.md +55 -11
  215. package/skills/weaver-e10-meeting/SKILL.md +103 -11
  216. package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
  217. package/skills/weaver-e10-recruit-stage/SKILL.md +19 -11
  218. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -8
  219. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
  220. package/skills/weaver-e10-recruit-stage/references/position-templates.md +23 -2
  221. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  222. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -18
  223. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  224. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +11 -1
  225. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  226. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  227. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  228. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  229. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  230. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  231. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  232. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  233. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  234. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  235. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  236. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  237. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  238. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  239. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  240. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  241. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -1,5 +1,8 @@
1
1
  import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ stateDir
5
+ } from "./chunk-AJ62BGAW.js";
3
6
  import {
4
7
  reportPlatformError
5
8
  } from "./chunk-6N4JPNFL.js";
@@ -11,11 +14,13 @@ import {
11
14
  createE10RequestRuntime,
12
15
  isE10SessionExpiredResponse,
13
16
  requireE10Session
14
- } from "./chunk-ETNJSKMM.js";
17
+ } from "./chunk-6NXT4ICB.js";
15
18
  import {
16
19
  E10_SESSION_EXPIRED_MESSAGE,
17
- getActiveProfile
18
- } from "./chunk-UFIT2UU3.js";
20
+ getActiveProfile,
21
+ hasXiaoEEnv,
22
+ writeWithRetry
23
+ } from "./chunk-U6R6FZHD.js";
19
24
  import {
20
25
  CliError,
21
26
  isCliError,
@@ -664,6 +669,37 @@ function schemaOf(properties, options = {}) {
664
669
 
665
670
  // src/shortcuts/archive/operations/shared.ts
666
671
  var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
672
+ function buildOpenAction(ctx, url, title = "\u6253\u5F00\u94FE\u63A5") {
673
+ const base = {
674
+ url,
675
+ markdown: `[${title}](${url})`,
676
+ requiresHostAction: true,
677
+ opened: false,
678
+ clientAction: { type: "openUrl", url }
679
+ };
680
+ if (!isXiaoECtx(ctx)) return { ...base, hasXiaoEEnv: false };
681
+ return {
682
+ ...base,
683
+ hasXiaoEEnv: true,
684
+ browserTool: buildBrowserToolPayload(url, title)
685
+ };
686
+ }
687
+ function isXiaoECtx(ctx) {
688
+ const options = typeof ctx?.getGlobalOptions === "function" ? ctx.getGlobalOptions() : void 0;
689
+ return hasXiaoEEnv(ctx?.env ?? process.env, options);
690
+ }
691
+ function buildBrowserToolPayload(url, title) {
692
+ return {
693
+ version: "1.0",
694
+ callId: "archive_open",
695
+ toolId: "open_web",
696
+ // activate: false / autoOpen: false —— 不自动激活、不自动弹出,由用户在客户端里自行点击打开
697
+ arguments: { url, title, activate: false, autoOpen: false }
698
+ };
699
+ }
700
+ function buildBrowserToolCell(url, title = "\u6253\u5F00\u6863\u6848") {
701
+ return `<browsertool>${JSON.stringify(buildBrowserToolPayload(url, title))}</browsertool>`;
702
+ }
667
703
  function asObject(value) {
668
704
  if (!value || typeof value !== "object" || Array.isArray(value)) {
669
705
  throw archiveValidationError("input_not_object", "\u8F93\u5165\u5FC5\u987B\u662F JSON \u5BF9\u8C61");
@@ -1061,7 +1097,7 @@ var prelibList = {
1061
1097
  },
1062
1098
  { description: "\u67E5\u8BE2\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868" }
1063
1099
  ),
1064
- handler: async (args, { host }) => {
1100
+ handler: async (args, { ctx, host }) => {
1065
1101
  const node = await resolveEfileNode(host, optionalText(args.treeId));
1066
1102
  const detail = await fetchTreeDetail(host, node.treeId);
1067
1103
  const page = await fetchPrelibDatas(host, node, detail, args.pageNo);
@@ -1072,6 +1108,15 @@ var prelibList = {
1072
1108
  const path = `${PRELIB_FILE_LIB_EDIT_PATH}?${new URLSearchParams({ singleMetaId: id, treeId: node.treeId }).toString()}`;
1073
1109
  return id && root ? `${root}${path}` : "";
1074
1110
  });
1111
+ const firstColumn = String(page.visibleColumns[0]?.dataIndex ?? "");
1112
+ const rowNames = openUrls.map((url, index) => {
1113
+ if (!url) return "";
1114
+ return String(
1115
+ page.displayData[index]?.[firstColumn] ?? page.rows[index]?.[firstColumn] ?? "\u6253\u5F00\u6863\u6848"
1116
+ );
1117
+ });
1118
+ const openEnv = buildOpenAction(ctx, openUrls[0] ?? "", "\u6253\u5F00\u6863\u6848");
1119
+ const browserToolCells = openEnv.hasXiaoEEnv ? openUrls.map((url, index) => url ? buildBrowserToolCell(url, rowNames[index]) : "") : void 0;
1075
1120
  return archiveSuccess(
1076
1121
  "archive.prelib.list",
1077
1122
  {
@@ -1083,7 +1128,10 @@ var prelibList = {
1083
1128
  url1: detail.url1,
1084
1129
  ...detail.boxUrl ? { boxUrl: detail.boxUrl } : {},
1085
1130
  ...page,
1086
- openUrls
1131
+ openUrls,
1132
+ hasXiaoEEnv: openEnv.hasXiaoEEnv,
1133
+ ...browserToolCells ? { browserToolCells } : {},
1134
+ requiresHostAction: openEnv.requiresHostAction
1087
1135
  },
1088
1136
  { count: page.rows.length, nodeName: node.nodeName }
1089
1137
  );
@@ -1329,6 +1377,7 @@ var prelibOpen = {
1329
1377
  url: root ? `${root}${path}` : path
1330
1378
  };
1331
1379
  });
1380
+ const open = links.length === 1 ? buildOpenAction(env.ctx, String(links[0].url), "\u6253\u5F00\u6863\u6848") : null;
1332
1381
  return archiveSuccess(
1333
1382
  "archive.prelib.open",
1334
1383
  {
@@ -1337,8 +1386,16 @@ var prelibOpen = {
1337
1386
  metadataId,
1338
1387
  count: links.length,
1339
1388
  links,
1340
- ...links.length === 1 ? { url: links[0].url } : {},
1341
- 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"
1389
+ ...open ? {
1390
+ url: open.url,
1391
+ markdown: open.markdown,
1392
+ hasXiaoEEnv: open.hasXiaoEEnv,
1393
+ ...open.browserTool ? { browserTool: open.browserTool } : {},
1394
+ requiresHostAction: open.requiresHostAction,
1395
+ opened: open.opened,
1396
+ clientAction: open.clientAction
1397
+ } : {},
1398
+ hint: open?.hasXiaoEEnv ? "\u59CB\u7EC8\u628A markdown \u7684 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u4FDD\u8BC1\u53EF\u70B9\u51FB\uFF08\u9700\u5DF2\u767B\u5F55\u8BE5\u73AF\u5883\u4E14\u6709\u8BE5\u6863\u6848\u67E5\u770B\u6743\u9650\uFF09\uFF1BbrowserTool \u662F <browsertool> \u7684\u53C2\u6570\uFF0C\u5E8F\u5217\u5316\u6210\u5355\u884C\u6807\u7B7E\u540E\u653E\u5728\u8FD9\u6761\u6570\u636E\u4E4B\u540E\u5355\u72EC\u4E00\u884C\u6E32\u67D3\uFF0C\u5C0FE \u5BA2\u6237\u7AEF\u636E\u6B64\u5728\u53F3\u4FA7\u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00\uFF1Bopened \u6052\u4E3A false" : "\u59CB\u7EC8\u628A markdown \u7684 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u4FDD\u8BC1\u53EF\u70B9\u51FB\uFF08\u9700\u5DF2\u767B\u5F55\u8BE5\u73AF\u5883\u4E14\u6709\u8BE5\u6863\u6848\u67E5\u770B\u6743\u9650\uFF09\uFF1B\u6253\u5F00\u52A8\u4F5C\u6309 clientAction\uFF08type: openUrl\uFF09\u7531\u5BBF\u4E3B\u6267\u884C\uFF0C\u8D70\u7CFB\u7EDF\u9ED8\u8BA4\u6D4F\u89C8\u5668\uFF1BCLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668"
1342
1399
  }
1343
1400
  );
1344
1401
  }
@@ -1490,6 +1547,8 @@ var searchOperations = [searchRun];
1490
1547
 
1491
1548
  // src/shortcuts/archive/operations/getPageUrl.ts
1492
1549
  import { randomBytes as randomBytes3 } from "node:crypto";
1550
+ import { mkdirSync, readFileSync } from "node:fs";
1551
+ import { join } from "node:path";
1493
1552
  var ARCHIVE_APP_TAG = "archive_wsd";
1494
1553
  var BORROW_CAR_TAG = "uf_arc_borrow_car";
1495
1554
  var BORROWING_TAG = "uf_arc_borrowing";
@@ -1604,6 +1663,62 @@ async function fetchArchiveListDatas(host, target, pageNo, logFlag) {
1604
1663
  ...total === void 0 ? {} : { total }
1605
1664
  };
1606
1665
  }
1666
+ var borrowFormIdCache = /* @__PURE__ */ new Map();
1667
+ var FORM_ID_CACHE_FILE = "archive-form-ids.json";
1668
+ function borrowFormIdCacheKey(session) {
1669
+ const baseUrl = String(session?.baseUrl ?? "").replace(/\/+$/, "");
1670
+ return `${baseUrl}|${String(session?.tenantKey ?? "")}`;
1671
+ }
1672
+ function readFormIdCache(ctx) {
1673
+ try {
1674
+ const raw = readFileSync(join(stateDir(ctx), FORM_ID_CACHE_FILE), "utf8");
1675
+ const parsed = JSON.parse(raw);
1676
+ const forms = parsed?.forms;
1677
+ if (!forms || typeof forms !== "object") return {};
1678
+ const out = {};
1679
+ for (const [key, value] of Object.entries(forms)) {
1680
+ const text = String(value ?? "").trim();
1681
+ if (text) out[key] = text;
1682
+ }
1683
+ return out;
1684
+ } catch {
1685
+ return {};
1686
+ }
1687
+ }
1688
+ function persistFormIdCache(ctx, key, formId) {
1689
+ try {
1690
+ const dir = stateDir(ctx);
1691
+ mkdirSync(dir, { recursive: true });
1692
+ const forms = { ...readFormIdCache(ctx), [key]: formId };
1693
+ writeWithRetry(
1694
+ join(dir, FORM_ID_CACHE_FILE),
1695
+ `${JSON.stringify({ version: 1, forms }, null, 2)}
1696
+ `,
1697
+ { mode: 384 }
1698
+ );
1699
+ } catch {
1700
+ }
1701
+ }
1702
+ async function resolveBorrowFormId(host, session, ctx) {
1703
+ const key = borrowFormIdCacheKey(session);
1704
+ const cached = borrowFormIdCache.get(key);
1705
+ if (cached) return cached;
1706
+ const persisted = readFormIdCache(ctx)[key];
1707
+ if (persisted) {
1708
+ borrowFormIdCache.set(key, persisted);
1709
+ return persisted;
1710
+ }
1711
+ try {
1712
+ const target = await resolveArchiveListTarget(host, { sign: BORROWING_TAG, viewMode: "myBorrow" });
1713
+ const formId = String(target?.objId ?? "").trim();
1714
+ if (!formId) return "";
1715
+ borrowFormIdCache.set(key, formId);
1716
+ persistFormIdCache(ctx, key, formId);
1717
+ return formId;
1718
+ } catch {
1719
+ return "";
1720
+ }
1721
+ }
1607
1722
 
1608
1723
  // src/shortcuts/archive/operations/borrow-car.ts
1609
1724
  var CAR_ADD = "archive.borrow-car.add";
@@ -1797,6 +1912,23 @@ function isExpired(returnDateTime, now = Date.now()) {
1797
1912
  const due = parseDateTime(returnDateTime);
1798
1913
  return due === void 0 ? false : now > due;
1799
1914
  }
1915
+ function borrowCardPath(formId, dataId) {
1916
+ return `/sp/ebdfpage/card/0/${formId}/${dataId}`;
1917
+ }
1918
+ function borrowCardLink(session, formId, dataId) {
1919
+ if (!formId || !dataId) return void 0;
1920
+ const viewPath = borrowCardPath(formId, dataId);
1921
+ const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
1922
+ return { viewPath, url: root ? `${root}${viewPath}` : viewPath };
1923
+ }
1924
+ function borrowOpenFields(session, formId, dataId, title, xiaoE) {
1925
+ const link = borrowCardLink(session, formId, dataId);
1926
+ if (!link) return {};
1927
+ return {
1928
+ ...link,
1929
+ ...xiaoE ? { browserToolCell: buildBrowserToolCell(link.url, title || "\u6253\u5F00\u501F\u9605\u5355") } : {}
1930
+ };
1931
+ }
1800
1932
  function normalizeBorrowListRow(mainTable, index) {
1801
1933
  const row = mainTable && typeof mainTable === "object" ? mainTable : {};
1802
1934
  return {
@@ -1854,29 +1986,57 @@ var borrowListList = {
1854
1986
  pageNo: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" },
1855
1987
  pageSize: { type: "integer", minimum: 1, description: "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 10" }
1856
1988
  }),
1857
- handler: async (args, { host }) => {
1989
+ handler: async (args, { ctx, host }) => {
1858
1990
  const pageNo = positiveInt(args.pageNo, "pageNo", 1);
1859
1991
  const pageSize = positiveInt(args.pageSize, "pageSize", 10);
1860
1992
  const session = await host.getSession();
1993
+ const formId = await resolveBorrowFormId(host, session, ctx);
1994
+ const xiaoE = isXiaoECtx(ctx);
1861
1995
  const custom = await listByCustomApi2(host, session.userId, pageNo, pageSize);
1862
1996
  if (custom) {
1997
+ const rows2 = custom.rows.map((row) => ({
1998
+ ...row,
1999
+ ...borrowOpenFields(session, formId, row.dataId, row.name, xiaoE)
2000
+ }));
1863
2001
  return archiveSuccess(
1864
2002
  "archive.borrow-list.list",
1865
- { source: "myBorrowList", pageNo, pageSize, count: custom.count, rows: custom.rows },
2003
+ {
2004
+ source: "myBorrowList",
2005
+ pageNo,
2006
+ pageSize,
2007
+ count: custom.count,
2008
+ ...formId ? { formId } : {},
2009
+ hasXiaoEEnv: xiaoE,
2010
+ rows: rows2
2011
+ },
1866
2012
  { source: "myBorrowList" }
1867
2013
  );
1868
2014
  }
1869
2015
  const target = await resolveArchiveListTarget(host, { sign: BORROWING_TAG, viewMode: "myBorrow" });
1870
2016
  const page = await fetchArchiveListDatas(host, target, pageNo);
1871
- const rows = page.rows.map((row, index) => ({
1872
- index: index + 1,
1873
- dataId: String(row.id ?? ""),
1874
- fields: row,
1875
- ...page.displayRows[index] ? { display: page.displayRows[index] } : {}
1876
- }));
2017
+ const targetFormId = formId || String(target.objId ?? "");
2018
+ const rows = page.rows.map((row, index) => {
2019
+ const dataId = String(row.id ?? "");
2020
+ const display = page.displayRows[index];
2021
+ const title = String(display?.name ?? row.name ?? "");
2022
+ return {
2023
+ index: index + 1,
2024
+ dataId,
2025
+ fields: row,
2026
+ ...display ? { display } : {},
2027
+ ...borrowOpenFields(session, targetFormId, dataId, title, xiaoE)
2028
+ };
2029
+ });
1877
2030
  return archiveSuccess(
1878
2031
  "archive.borrow-list.list",
1879
- { source: "ebuilder", pageNo: page.pageNo, count: rows.length, rows },
2032
+ {
2033
+ source: "ebuilder",
2034
+ pageNo: page.pageNo,
2035
+ count: rows.length,
2036
+ ...targetFormId ? { formId: targetFormId } : {},
2037
+ hasXiaoEEnv: xiaoE,
2038
+ rows
2039
+ },
1880
2040
  { source: "ebuilder", viewSource: target.viewSource }
1881
2041
  );
1882
2042
  }
@@ -1932,7 +2092,7 @@ var borrowListDetail = {
1932
2092
  { dataId: { type: "string", pattern: "^\\d+$", description: "\u501F\u9605\u5355\u4E3B\u8868\u6570\u636E ID" } },
1933
2093
  { required: ["dataId"], description: "\u501F\u9605\u5355\u8BE6\u60C5" }
1934
2094
  ),
1935
- handler: async (args, { host }) => {
2095
+ handler: async (args, { ctx, host }) => {
1936
2096
  const dataId = args.dataId;
1937
2097
  if (dataId === void 0 || dataId === null || !/^\d+$/.test(String(dataId))) {
1938
2098
  throw archiveValidationError("data_id_invalid", "dataId \u5FC5\u586B\u4E14\u4E3A\u6570\u5B57 ID");
@@ -1940,16 +2100,47 @@ var borrowListDetail = {
1940
2100
  const session = await host.getSession();
1941
2101
  const detail = await fetchBorrowDetail(host, session.userId, String(dataId));
1942
2102
  const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
2103
+ const xiaoE = isXiaoECtx(ctx);
1943
2104
  const details = detail.details.map((item) => ({
1944
2105
  ...item,
1945
2106
  arcDangan: item.arcDangan.map((arc) => {
1946
2107
  const [arcId, arcFormId = ""] = String(arc.id ?? "").split("_");
1947
2108
  if (!arcId || !arcFormId) return arc;
1948
2109
  const viewPath = `/sp/custom/archive/archiveView?arcId=${arcId}&arcFormId=${arcFormId}`;
1949
- return { ...arc, viewPath, url: root ? `${root}${viewPath}` : viewPath };
2110
+ const url = root ? `${root}${viewPath}` : viewPath;
2111
+ const name = String(arc.name ?? "\u6253\u5F00\u6863\u6848");
2112
+ return {
2113
+ ...arc,
2114
+ viewPath,
2115
+ url,
2116
+ // 小E 环境:明细表最后一列“操作”放该档案的单行 <browsertool>,与档案同一行;非小E 不带该字段
2117
+ ...xiaoE ? { browserToolCell: buildBrowserToolCell(url, name) } : {}
2118
+ };
1950
2119
  })
1951
2120
  }));
1952
- return archiveSuccess("archive.borrow-list.detail", { ...detail, details }, { count: details.length });
2121
+ const openEnv = buildOpenAction(ctx, String(details[0]?.arcDangan?.[0]?.url ?? ""), "\u6253\u5F00\u6863\u6848");
2122
+ const borrowFormId = await resolveBorrowFormId(host, session, ctx);
2123
+ const selfLink = borrowCardLink(session, borrowFormId, String(detail.dataId || dataId));
2124
+ const selfOpen = selfLink ? buildOpenAction(ctx, selfLink.url, String(detail.name || "\u6253\u5F00\u501F\u9605\u5355")) : void 0;
2125
+ return archiveSuccess(
2126
+ "archive.borrow-list.detail",
2127
+ {
2128
+ ...detail,
2129
+ details,
2130
+ ...borrowFormId ? { formId: borrowFormId } : {},
2131
+ ...selfLink ? {
2132
+ viewPath: selfLink.viewPath,
2133
+ url: selfLink.url,
2134
+ markdown: `[\u6253\u5F00\u501F\u9605\u5355](${selfLink.url})`
2135
+ } : {},
2136
+ ...selfOpen?.browserTool ? { browserTool: selfOpen.browserTool } : {},
2137
+ hasXiaoEEnv: xiaoE,
2138
+ requiresHostAction: openEnv.requiresHostAction,
2139
+ opened: openEnv.opened,
2140
+ clientAction: openEnv.clientAction
2141
+ },
2142
+ { count: details.length }
2143
+ );
1953
2144
  }
1954
2145
  };
1955
2146
  var borrowListOperations = [borrowListList, borrowListDetail];
@@ -2201,6 +2392,45 @@ var SEARCH_APPLY = "archive.flow.search.apply";
2201
2392
  var RENEW_APPLY = "archive.flow.renew.apply";
2202
2393
  var ARC_ID_PATTERN = /^\d+_\d+$/;
2203
2394
  var NUMERIC_PATTERN = /^\d+$/;
2395
+ var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/u;
2396
+ var DATE_TIME_PATTERN = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/u;
2397
+ var DEFAULT_BORROW_DAYS = 7;
2398
+ function requireReason(value) {
2399
+ const reason = String(value ?? "").trim();
2400
+ if (!reason) {
2401
+ throw archiveValidationError("reason_required", "\u8BF7\u5148\u5411\u7528\u6237\u786E\u8BA4\u501F\u9605\u539F\u56E0\uFF08reason\uFF09\u540E\u518D\u53D1\u8D77\u501F\u9605");
2402
+ }
2403
+ if (reason.length > 200) {
2404
+ throw archiveValidationError("reason_too_long", "\u501F\u9605\u539F\u56E0\u4E0D\u80FD\u8D85\u8FC7 200 \u5B57");
2405
+ }
2406
+ return reason;
2407
+ }
2408
+ function formatDate(date) {
2409
+ const pad = (value) => String(value).padStart(2, "0");
2410
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
2411
+ }
2412
+ function resolveReturnDateTime(value, now = /* @__PURE__ */ new Date()) {
2413
+ const raw = String(value ?? "").trim();
2414
+ if (!raw) {
2415
+ return { text: formatDate(new Date(now.getTime() + DEFAULT_BORROW_DAYS * 24 * 3600 * 1e3)), defaulted: true };
2416
+ }
2417
+ const normalized = raw.replace("T", " ");
2418
+ const withTime = DATE_ONLY_PATTERN.test(normalized) ? `${normalized} 00:00:00` : normalized;
2419
+ if (!DATE_TIME_PATTERN.test(withTime)) {
2420
+ throw archiveValidationError(
2421
+ "return_date_time_invalid",
2422
+ "\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4\u683C\u5F0F\u5E94\u4E3A YYYY-MM-DD \u6216 YYYY-MM-DD HH:mm:ss"
2423
+ );
2424
+ }
2425
+ const parsed = Date.parse(withTime.replace(" ", "T"));
2426
+ if (Number.isNaN(parsed)) {
2427
+ throw archiveValidationError("return_date_time_invalid", "\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4\u65E0\u6CD5\u89E3\u6790\uFF0C\u8BF7\u68C0\u67E5\u65E5\u671F\u662F\u5426\u6709\u6548");
2428
+ }
2429
+ if (parsed < now.getTime()) {
2430
+ throw archiveValidationError("return_date_time_invalid", "\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F53\u524D\u65F6\u95F4");
2431
+ }
2432
+ return { text: formatDate(new Date(parsed)), defaulted: false };
2433
+ }
2204
2434
  function requireArcIds(value, field) {
2205
2435
  if (!Array.isArray(value) || value.length === 0) {
2206
2436
  throw archiveValidationError("arc_ids_required", `${field} \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879`);
@@ -2253,18 +2483,27 @@ async function addCache(host, value, logFlag) {
2253
2483
  }
2254
2484
  function buildFlowUrl(baseUrl, workflowId, params) {
2255
2485
  const root = baseUrl.replace(/\/+$/, "");
2256
- const search = new URLSearchParams(params).toString();
2486
+ const search = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
2257
2487
  return `${root}/sp/workflow/flowpage/fullCreate/${workflowId}?${search}`;
2258
2488
  }
2259
- function flowResult(action, baseUrl, workflowId, params, extra = {}) {
2489
+ function flowResult(ctx, action, baseUrl, workflowId, params, extra = {}) {
2490
+ const url = buildFlowUrl(baseUrl, workflowId, params);
2491
+ const open = buildOpenAction(ctx, url, "\u586B\u5199\u5E76\u63D0\u4EA4");
2260
2492
  return archiveSuccess(
2261
2493
  action,
2262
2494
  {
2263
2495
  ...extra,
2264
2496
  workflowId,
2265
- url: buildFlowUrl(baseUrl, workflowId, params),
2497
+ url,
2266
2498
  params,
2267
- 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"
2499
+ markdown: open.markdown,
2500
+ hasXiaoEEnv: open.hasXiaoEEnv,
2501
+ // 小E 环境:给出 <browsertool> 需要的参数,由调用方渲染成单行标签放在业务数据之后
2502
+ ...open.browserTool ? { browserTool: open.browserTool } : {},
2503
+ requiresHostAction: open.requiresHostAction,
2504
+ opened: open.opened,
2505
+ clientAction: open.clientAction,
2506
+ hint: open.hasXiaoEEnv ? "\u59CB\u7EC8\u628A markdown \u7684 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u4FDD\u8BC1\u53EF\u70B9\u51FB\uFF1BbrowserTool \u662F <browsertool> \u7684\u53C2\u6570\uFF0C\u5E8F\u5217\u5316\u6210\u5355\u884C\u6807\u7B7E\u540E\u653E\u5728\u8FD9\u6761\u6570\u636E\u4E4B\u540E\u5355\u72EC\u4E00\u884C\u6E32\u67D3\uFF0C\u5C0FE \u5BA2\u6237\u7AEF\u636E\u6B64\u5728\u53F3\u4FA7\u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00\uFF1Bopened \u6052\u4E3A false" : "\u59CB\u7EC8\u628A markdown \u7684 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u4FDD\u8BC1\u53EF\u70B9\u51FB\uFF1B\u6253\u5F00\u52A8\u4F5C\u6309 clientAction\uFF08type: openUrl\uFF09\u7531\u5BBF\u4E3B\u6267\u884C\uFF0C\u8D70\u7CFB\u7EDF\u9ED8\u8BA4\u6D4F\u89C8\u5668\uFF1BCLI \u4E0E Agent \u90FD\u4E0D\u8981\u6267\u884C open/start"
2268
2507
  },
2269
2508
  { wrote: true }
2270
2509
  );
@@ -2280,9 +2519,14 @@ var flowBorrowCarPrepare = {
2280
2519
  inputSchema: schemaOf(
2281
2520
  {
2282
2521
  arcIds: { type: "array", items: { type: "string" }, description: "\u6863\u6848\u6807\u8BC6\u6570\u7EC4\uFF0C\u5143\u7D20\u4E3A {\u6863\u6848ID}_{\u8868\u5355ID}" },
2283
- carIds: { type: "array", items: { type: "string" }, description: "\u501F\u9605\u8F66\u8BB0\u5F55 ID \u6570\u7EC4\uFF0C\u4E0E arcIds \u4E00\u4E00\u5BF9\u5E94" }
2522
+ carIds: { type: "array", items: { type: "string" }, description: "\u501F\u9605\u8F66\u8BB0\u5F55 ID \u6570\u7EC4\uFF0C\u4E0E arcIds \u4E00\u4E00\u5BF9\u5E94" },
2523
+ reason: { type: "string", description: "\u501F\u9605\u539F\u56E0\uFF08\u5FC5\u586B\uFF0C\u5BF9\u8BDD\u4E2D\u5411\u7528\u6237\u786E\u8BA4\uFF09" },
2524
+ returnDateTime: {
2525
+ type: "string",
2526
+ description: "\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4 YYYY-MM-DD \u6216 YYYY-MM-DD HH:mm:ss\uFF1B\u4E0D\u4F20\u65F6\u9ED8\u8BA4\u5F53\u524D\u65F6\u95F4 + 7 \u5929"
2527
+ }
2284
2528
  },
2285
- { required: ["arcIds", "carIds"], description: "\u4ECE\u501F\u9605\u8F66\u53D1\u8D77\u501F\u9605" }
2529
+ { required: ["arcIds", "carIds", "reason"], description: "\u4ECE\u501F\u9605\u8F66\u53D1\u8D77\u501F\u9605" }
2286
2530
  ),
2287
2531
  handler: async (args, env) => {
2288
2532
  const arcIds = requireArcIds(args.arcIds, "arcIds");
@@ -2290,13 +2534,30 @@ var flowBorrowCarPrepare = {
2290
2534
  if (arcIds.length !== carIds.length) {
2291
2535
  throw archiveValidationError("id_count_mismatch", "arcIds \u4E0E carIds \u6570\u91CF\u5FC5\u987B\u4E00\u81F4");
2292
2536
  }
2537
+ const reason = requireReason(args.reason);
2538
+ const returnDateTime = resolveReturnDateTime(args.returnDateTime);
2293
2539
  const workflowId = await fetchWorkflowId(env.host);
2294
- const { continuation, expiresInMs } = await issueLease(env, BORROW_CAR_APPLY, { workflowId, arcIds, carIds });
2540
+ const { continuation, expiresInMs } = await issueLease(env, BORROW_CAR_APPLY, {
2541
+ workflowId,
2542
+ arcIds,
2543
+ carIds,
2544
+ reason,
2545
+ returnDateTime: returnDateTime.text,
2546
+ returnDateTimeDefaulted: returnDateTime.defaulted
2547
+ });
2295
2548
  return archiveSuccess(
2296
2549
  "archive.flow.borrow-car.prepare",
2297
2550
  {
2298
- preview: { workflowId, count: arcIds.length, arcIds, carIds },
2299
- hint: "\u786E\u8BA4\u540E\u8C03\u7528 archive.flow.borrow-car.apply\uFF08CLI\uFF1Aarchive flow borrow-car-apply --continuation <token> --yes\uFF09",
2551
+ preview: {
2552
+ workflowId,
2553
+ count: arcIds.length,
2554
+ arcIds,
2555
+ carIds,
2556
+ reason,
2557
+ returnDateTime: returnDateTime.text,
2558
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2559
+ },
2560
+ hint: "\u7968\u636E\u5DF2\u5C31\u7EEA\uFF1A\u76F4\u63A5\u8C03\u7528 archive.flow.borrow-car.apply\uFF08CLI\uFF1Aarchive flow borrow-car-apply --continuation <token> --yes\uFF09\uFF0C\u4E0D\u8981\u518D\u5411\u7528\u6237\u4E8C\u6B21\u786E\u8BA4\u2014\u2014\u7528\u6237\u6253\u5F00\u94FE\u63A5\u70B9\u300C\u586B\u5199\u5E76\u63D0\u4EA4\u300D\u5373\u4E3A\u786E\u8BA4",
2300
2561
  continuation
2301
2562
  },
2302
2563
  { requiresConfirmation: true, expiresInMs }
@@ -2327,10 +2588,13 @@ var flowBorrowCarApply = {
2327
2588
  if (!workflowId || arcIds.length === 0 || arcIds.length !== carIds.length) {
2328
2589
  throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 workflowId / arcIds / carIds");
2329
2590
  }
2591
+ const reason = requireReason(lease.reason);
2592
+ const returnDateTime = resolveReturnDateTime(lease.returnDateTime);
2330
2593
  const arcIndex = await addCache(env.host, arcIds.join(","), "borrowCart");
2331
2594
  const carIndex = await addCache(env.host, carIds.join(","), "borrowCart");
2332
2595
  const session = await env.host.getSession();
2333
2596
  return flowResult(
2597
+ env.ctx,
2334
2598
  BORROW_CAR_APPLY,
2335
2599
  session.baseUrl,
2336
2600
  workflowId,
@@ -2340,9 +2604,18 @@ var flowBorrowCarApply = {
2340
2604
  isAddIdentify: "1",
2341
2605
  isBorrow: "1",
2342
2606
  arcDataId: `arcCache_${arcIndex}`,
2343
- arcBorrowCarIds: `arcCache_${carIndex}`
2607
+ arcBorrowCarIds: `arcCache_${carIndex}`,
2608
+ reason,
2609
+ return_date_time: returnDateTime.text
2344
2610
  },
2345
- { mode: "borrowCar", count: arcIds.length, caches: { arcDataId: arcIndex, arcBorrowCarIds: carIndex } }
2611
+ {
2612
+ mode: "borrowCar",
2613
+ count: arcIds.length,
2614
+ caches: { arcDataId: arcIndex, arcBorrowCarIds: carIndex },
2615
+ reason,
2616
+ returnDateTime: returnDateTime.text,
2617
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2618
+ }
2346
2619
  );
2347
2620
  }
2348
2621
  };
@@ -2355,18 +2628,40 @@ var flowSearchPrepare = {
2355
2628
  capability: "archive",
2356
2629
  risk: READ,
2357
2630
  inputSchema: schemaOf(
2358
- { arcIds: { type: "array", items: { type: "string" }, description: "\u6863\u6848\u6807\u8BC6\u6570\u7EC4\uFF0C\u5143\u7D20\u4E3A {\u6863\u6848ID}_{\u8868\u5355ID}" } },
2359
- { required: ["arcIds"], description: "\u4ECE\u68C0\u7D22\u7ED3\u679C\u53D1\u8D77\u501F\u9605" }
2631
+ {
2632
+ arcIds: { type: "array", items: { type: "string" }, description: "\u6863\u6848\u6807\u8BC6\u6570\u7EC4\uFF0C\u5143\u7D20\u4E3A {\u6863\u6848ID}_{\u8868\u5355ID}" },
2633
+ reason: { type: "string", description: "\u501F\u9605\u539F\u56E0\uFF08\u5FC5\u586B\uFF0C\u5BF9\u8BDD\u4E2D\u5411\u7528\u6237\u786E\u8BA4\uFF09" },
2634
+ returnDateTime: {
2635
+ type: "string",
2636
+ description: "\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4 YYYY-MM-DD \u6216 YYYY-MM-DD HH:mm:ss\uFF1B\u4E0D\u4F20\u65F6\u9ED8\u8BA4\u5F53\u524D\u65F6\u95F4 + 7 \u5929"
2637
+ }
2638
+ },
2639
+ { required: ["arcIds", "reason"], description: "\u4ECE\u68C0\u7D22\u7ED3\u679C\u53D1\u8D77\u501F\u9605" }
2360
2640
  ),
2361
2641
  handler: async (args, env) => {
2362
2642
  const arcIds = requireArcIds(args.arcIds, "arcIds");
2643
+ const reason = requireReason(args.reason);
2644
+ const returnDateTime = resolveReturnDateTime(args.returnDateTime);
2363
2645
  const workflowId = await fetchWorkflowId(env.host);
2364
- const { continuation, expiresInMs } = await issueLease(env, SEARCH_APPLY, { workflowId, arcIds });
2646
+ const { continuation, expiresInMs } = await issueLease(env, SEARCH_APPLY, {
2647
+ workflowId,
2648
+ arcIds,
2649
+ reason,
2650
+ returnDateTime: returnDateTime.text,
2651
+ returnDateTimeDefaulted: returnDateTime.defaulted
2652
+ });
2365
2653
  return archiveSuccess(
2366
2654
  "archive.flow.search.prepare",
2367
2655
  {
2368
- preview: { workflowId, count: arcIds.length, arcIds },
2369
- hint: "\u786E\u8BA4\u540E\u8C03\u7528 archive.flow.search.apply\uFF08CLI\uFF1Aarchive flow search-apply --continuation <token> --yes\uFF09",
2656
+ preview: {
2657
+ workflowId,
2658
+ count: arcIds.length,
2659
+ arcIds,
2660
+ reason,
2661
+ returnDateTime: returnDateTime.text,
2662
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2663
+ },
2664
+ hint: "\u7968\u636E\u5DF2\u5C31\u7EEA\uFF1A\u76F4\u63A5\u8C03\u7528 archive.flow.search.apply\uFF08CLI\uFF1Aarchive flow search-apply --continuation <token> --yes\uFF09\uFF0C\u4E0D\u8981\u518D\u5411\u7528\u6237\u4E8C\u6B21\u786E\u8BA4\u2014\u2014\u7528\u6237\u6253\u5F00\u94FE\u63A5\u70B9\u300C\u586B\u5199\u5E76\u63D0\u4EA4\u300D\u5373\u4E3A\u786E\u8BA4",
2370
2665
  continuation
2371
2666
  },
2372
2667
  { requiresConfirmation: true, expiresInMs }
@@ -2396,9 +2691,12 @@ var flowSearchApply = {
2396
2691
  if (!workflowId || arcIds.length === 0) {
2397
2692
  throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 workflowId / arcIds");
2398
2693
  }
2694
+ const reason = requireReason(lease.reason);
2695
+ const returnDateTime = resolveReturnDateTime(lease.returnDateTime);
2399
2696
  const arcIndex = await addCache(env.host, arcIds.join(","));
2400
2697
  const session = await env.host.getSession();
2401
2698
  return flowResult(
2699
+ env.ctx,
2402
2700
  SEARCH_APPLY,
2403
2701
  session.baseUrl,
2404
2702
  workflowId,
@@ -2407,9 +2705,18 @@ var flowSearchApply = {
2407
2705
  isCreate: "1",
2408
2706
  isAddIdentify: "1",
2409
2707
  isBorrow: "1",
2410
- arcDataId: `arcCache_${arcIndex}`
2708
+ arcDataId: `arcCache_${arcIndex}`,
2709
+ reason,
2710
+ return_date_time: returnDateTime.text
2411
2711
  },
2412
- { mode: "search", count: arcIds.length, caches: { arcDataId: arcIndex } }
2712
+ {
2713
+ mode: "search",
2714
+ count: arcIds.length,
2715
+ caches: { arcDataId: arcIndex },
2716
+ reason,
2717
+ returnDateTime: returnDateTime.text,
2718
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2719
+ }
2413
2720
  );
2414
2721
  }
2415
2722
  };
@@ -2422,21 +2729,42 @@ var flowRenewPrepare = {
2422
2729
  capability: "archive",
2423
2730
  risk: READ,
2424
2731
  inputSchema: schemaOf(
2425
- { dataId: { type: "string", pattern: "^\\d+$", description: "\u501F\u9605\u5355\u4E3B\u8868\u6570\u636E ID" } },
2426
- { required: ["dataId"], description: "\u501F\u9605\u5355\u7EED\u501F" }
2732
+ {
2733
+ dataId: { type: "string", pattern: "^\\d+$", description: "\u501F\u9605\u5355\u4E3B\u8868\u6570\u636E ID" },
2734
+ reason: { type: "string", description: "\u7EED\u501F\u4E8B\u7531\uFF08\u5FC5\u586B\uFF0C\u5BF9\u8BDD\u4E2D\u5411\u7528\u6237\u786E\u8BA4\uFF09" },
2735
+ returnDateTime: {
2736
+ type: "string",
2737
+ description: "\u7EED\u501F\u540E\u7684\u9884\u8BA1\u5F52\u8FD8\u65F6\u95F4 YYYY-MM-DD\uFF1B\u4E0D\u4F20\u65F6\u9ED8\u8BA4\u5F53\u524D\u65E5\u671F + 7 \u5929"
2738
+ }
2739
+ },
2740
+ { required: ["dataId", "reason"], description: "\u501F\u9605\u5355\u7EED\u501F" }
2427
2741
  ),
2428
2742
  handler: async (args, env) => {
2429
2743
  const dataId = String(args.dataId ?? "").trim();
2430
2744
  if (!NUMERIC_PATTERN.test(dataId)) {
2431
2745
  throw archiveValidationError("data_id_invalid", "dataId \u5FC5\u586B\u4E14\u4E3A\u6570\u5B57 ID");
2432
2746
  }
2747
+ const reason = requireReason(args.reason);
2748
+ const returnDateTime = resolveReturnDateTime(args.returnDateTime);
2433
2749
  const workflowId = await fetchWorkflowId(env.host);
2434
- const { continuation, expiresInMs } = await issueLease(env, RENEW_APPLY, { workflowId, dataId });
2750
+ const { continuation, expiresInMs } = await issueLease(env, RENEW_APPLY, {
2751
+ workflowId,
2752
+ dataId,
2753
+ reason,
2754
+ returnDateTime: returnDateTime.text,
2755
+ returnDateTimeDefaulted: returnDateTime.defaulted
2756
+ });
2435
2757
  return archiveSuccess(
2436
2758
  "archive.flow.renew.prepare",
2437
2759
  {
2438
- preview: { workflowId, dataId },
2439
- hint: "\u786E\u8BA4\u540E\u8C03\u7528 archive.flow.renew.apply\uFF08CLI\uFF1Aarchive flow renew-apply --continuation <token> --yes\uFF09",
2760
+ preview: {
2761
+ workflowId,
2762
+ dataId,
2763
+ reason,
2764
+ returnDateTime: returnDateTime.text,
2765
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2766
+ },
2767
+ hint: "\u7968\u636E\u5DF2\u5C31\u7EEA\uFF1A\u76F4\u63A5\u8C03\u7528 archive.flow.renew.apply\uFF08CLI\uFF1Aarchive flow renew-apply --continuation <token> --yes\uFF09\uFF0C\u4E0D\u8981\u518D\u5411\u7528\u6237\u4E8C\u6B21\u786E\u8BA4\u2014\u2014\u7528\u6237\u6253\u5F00\u94FE\u63A5\u70B9\u300C\u586B\u5199\u5E76\u63D0\u4EA4\u300D\u5373\u4E3A\u786E\u8BA4",
2440
2768
  continuation
2441
2769
  },
2442
2770
  { requiresConfirmation: true, expiresInMs }
@@ -2467,13 +2795,29 @@ var flowRenewApply = {
2467
2795
  throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 workflowId / dataId");
2468
2796
  }
2469
2797
  assertLeaseTarget(lease, args, ["dataId"], RENEW_APPLY);
2798
+ const reason = requireReason(lease.reason);
2799
+ const returnDateTime = resolveReturnDateTime(lease.returnDateTime);
2470
2800
  const session = await env.host.getSession();
2471
2801
  return flowResult(
2802
+ env.ctx,
2472
2803
  RENEW_APPLY,
2473
2804
  session.baseUrl,
2474
2805
  workflowId,
2475
- { workflowId, isCreate: "1", arcDataId: dataId, isReNew: "1" },
2476
- { mode: "renew", dataId }
2806
+ {
2807
+ workflowId,
2808
+ isCreate: "1",
2809
+ arcDataId: dataId,
2810
+ isReNew: "1",
2811
+ reason,
2812
+ return_date_time: returnDateTime.text
2813
+ },
2814
+ {
2815
+ mode: "renew",
2816
+ dataId,
2817
+ reason,
2818
+ returnDateTime: returnDateTime.text,
2819
+ ...returnDateTime.defaulted ? { returnDateTimeDefaulted: true } : {}
2820
+ }
2477
2821
  );
2478
2822
  }
2479
2823
  };