weaver-work-cli 0.1.44 → 0.1.45

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 (179) 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-CE3GMWTS.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-CWYGFU5B.js → chunk-3WBIQLMB.js} +2 -2
  11. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  12. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-3ZMAQQ3W.js} +161 -33
  13. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-4EXOIQDI.js} +40 -10
  14. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-77YP6I52.js} +1 -1
  17. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  18. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-DGMYACGJ.js} +1 -1
  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-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  22. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  23. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-JWWTI63L.js} +55 -5
  24. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-LGKWL4OH.js} +176 -39
  25. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-LRCPNDZA.js} +38 -6
  26. package/dist/chunks/{chunk-OF4S23UB.js → chunk-LXFVWZLM.js} +4 -4
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-OAE3AZBQ.js} +11 -11
  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-HIT4Y6OI.js → chunk-T4MWQAQB.js} +7 -5
  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-FAZTGX7S.js → chunk-VIMCY4DI.js} +5 -5
  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-IYJETSGT.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-7JLC7UID.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-MYRDCHZ4.js} +121 -49
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-3MBHAWBL.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-TZEVU4DU.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-KL3HFKRM.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-UH6HGK2I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-C67EHQ4Z.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-AHY5QAMF.js} +450 -117
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  72. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  73. package/dist/chunks/{registry-IM5G23LS.js → registry-XPWPGHYE.js} +10 -10
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-CNWE5WQK.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-YYNYBQIE.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/index.js +30 -30
  78. package/dist/internal/e10/auth/commands.js +32 -0
  79. package/dist/internal/e10/auth/error-log.js +156 -26
  80. package/dist/internal/e10/auth/xiaoe.js +176 -13
  81. package/dist/internal/e10/context.js +12 -1
  82. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  83. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  84. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  85. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  86. package/dist/shortcuts/archive/operations/shared.js +52 -0
  87. package/dist/shortcuts/contract/host.js +111 -4
  88. package/dist/shortcuts/contract/index.js +19 -0
  89. package/dist/shortcuts/contract/manifest.js +125 -0
  90. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  91. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  92. package/dist/shortcuts/contract/operations/customer.js +192 -0
  93. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  94. package/dist/shortcuts/contract/operations/flow.js +44 -2
  95. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  96. package/dist/shortcuts/contract/operations/registry.js +8 -0
  97. package/dist/shortcuts/contract/operations/review.js +116 -1
  98. package/dist/shortcuts/contract/operations/summary.js +177 -0
  99. package/dist/shortcuts/contract/operations/upload.js +64 -4
  100. package/dist/shortcuts/contract/upload-cache.js +104 -0
  101. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +4 -2
  102. package/dist/shortcuts/ehr/operations/recruit-position.js +136 -35
  103. package/dist/shortcuts/ehr/operations/recruit-write.js +17 -18
  104. package/dist/shortcuts/ehr/operations/recruit.js +17 -5
  105. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  106. package/dist/shortcuts/meeting/operations/eb/create-flow.js +182 -58
  107. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  108. package/dist/shortcuts/meeting/operations/eb/factory.js +58 -3
  109. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  110. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +47 -5
  111. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  112. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  113. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +86 -16
  114. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +6 -4
  115. package/dist/shortcuts/recruit-stage/operations/jd-create.js +208 -56
  116. package/dist/shortcuts/recruit-stage/operations/resume-import.js +42 -16
  117. package/dist/shortcuts/recruit-stage/shared.js +161 -18
  118. package/dist/shortcuts/workflow/index.js +2 -0
  119. package/dist/shortcuts/workflow/operations/read.js +8 -3
  120. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  121. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  122. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  123. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  124. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  128. package/docs/contract.md +1 -0
  129. package/docs/e10-auth.md +4 -2
  130. package/docs/todo-smart-convert/data-contract.md +7 -0
  131. package/package.json +1 -1
  132. package/skill-template/domains/jinchengda.md +2 -0
  133. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  134. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  135. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  136. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  137. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  138. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  139. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  140. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  141. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  142. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  143. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  148. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  149. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  152. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  153. package/skills/weaver-e10-jucailin/references/recruit-create.md +5 -3
  154. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -2
  155. package/skills/weaver-e10-meeting/SKILL.md +57 -9
  156. package/skills/weaver-e10-recruit-stage/SKILL.md +11 -6
  157. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +10 -2
  158. package/skills/weaver-e10-recruit-stage/references/position-templates.md +3 -1
  159. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  160. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -18
  161. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  162. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +7 -1
  163. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  164. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  165. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  166. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  167. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  168. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  169. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  170. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  171. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  172. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  173. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  174. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  175. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  176. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  177. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  178. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  179. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -4,13 +4,13 @@ import {
4
4
  getWorkflowOperation,
5
5
  hasWorkflowOperation,
6
6
  workflowOperationDefinitions
7
- } from "./chunk-XNIK66I4.js";
7
+ } from "./chunk-JB34OE7R.js";
8
8
  import "./chunk-HP7JIYMT.js";
9
9
  import "./chunk-WRXSAVKO.js";
10
10
  import "./chunk-727FH2NI.js";
11
11
  import "./chunk-AJ62BGAW.js";
12
12
  import "./chunk-7BDPM5ST.js";
13
- import "./chunk-UFIT2UU3.js";
13
+ import "./chunk-U6R6FZHD.js";
14
14
  import "./chunk-UG5G54VL.js";
15
15
  import "./chunk-BUSC6UAE.js";
16
16
  export {
@@ -4,12 +4,12 @@ import {
4
4
  esbOperationDefinitions,
5
5
  getEsbOperation,
6
6
  hasEsbOperation
7
- } from "./chunk-TA7FXXJD.js";
8
- import "./chunk-F4E4EM35.js";
7
+ } from "./chunk-DLY5GUXX.js";
8
+ import "./chunk-TGAGQV4I.js";
9
9
  import "./chunk-TXUG266F.js";
10
10
  import "./chunk-7BDPM5ST.js";
11
- import "./chunk-ETNJSKMM.js";
12
- import "./chunk-UFIT2UU3.js";
11
+ import "./chunk-6NXT4ICB.js";
12
+ import "./chunk-U6R6FZHD.js";
13
13
  import "./chunk-UG5G54VL.js";
14
14
  import "./chunk-BUSC6UAE.js";
15
15
  export {
@@ -4,8 +4,8 @@ import {
4
4
  getHrmOperation,
5
5
  hasHrmOperation,
6
6
  hrmOperationDefinitions
7
- } from "./chunk-PUQS5MWL.js";
8
- import "./chunk-D4ADSZ7H.js";
7
+ } from "./chunk-3YV7PKRL.js";
8
+ import "./chunk-O6CMPO65.js";
9
9
  import "./chunk-56EZERK4.js";
10
10
  import "./chunk-UG5G54VL.js";
11
11
  import "./chunk-BUSC6UAE.js";
@@ -4,16 +4,16 @@ import {
4
4
  getMeetingOperation,
5
5
  hasMeetingOperation,
6
6
  meetingOperationDefinitions
7
- } from "./chunk-PC7VKEB5.js";
8
- import "./chunk-N4M2DDFE.js";
9
- import "./chunk-FRZKBMSW.js";
10
- import "./chunk-GM6J7Q4B.js";
11
- import "./chunk-FAZTGX7S.js";
12
- import "./chunk-Z7VYWPZV.js";
13
- import "./chunk-OF4S23UB.js";
14
- import "./chunk-CWYGFU5B.js";
15
- import "./chunk-GAMZLAG2.js";
16
- import "./chunk-QVSWRLLU.js";
7
+ } from "./chunk-3ZMAQQ3W.js";
8
+ import "./chunk-OAE3AZBQ.js";
9
+ import "./chunk-LGKWL4OH.js";
10
+ import "./chunk-4EXOIQDI.js";
11
+ import "./chunk-VIMCY4DI.js";
12
+ import "./chunk-DGMYACGJ.js";
13
+ import "./chunk-LXFVWZLM.js";
14
+ import "./chunk-3WBIQLMB.js";
15
+ import "./chunk-77YP6I52.js";
16
+ import "./chunk-JWWTI63L.js";
17
17
  import "./chunk-7BDPM5ST.js";
18
18
  import "./chunk-UG5G54VL.js";
19
19
  import "./chunk-BUSC6UAE.js";
@@ -2,19 +2,21 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  ebRoomRecommendOperation,
5
+ inferRoomFloor,
5
6
  loadFrequentRooms,
6
7
  loadRooms,
7
8
  recommendRooms,
8
9
  rememberFrequentRoom
9
- } from "./chunk-GM6J7Q4B.js";
10
- import "./chunk-Z7VYWPZV.js";
11
- import "./chunk-GAMZLAG2.js";
12
- import "./chunk-QVSWRLLU.js";
10
+ } from "./chunk-4EXOIQDI.js";
11
+ import "./chunk-DGMYACGJ.js";
12
+ import "./chunk-77YP6I52.js";
13
+ import "./chunk-JWWTI63L.js";
13
14
  import "./chunk-7BDPM5ST.js";
14
15
  import "./chunk-UG5G54VL.js";
15
16
  import "./chunk-BUSC6UAE.js";
16
17
  export {
17
18
  ebRoomRecommendOperation,
19
+ inferRoomFloor,
18
20
  loadFrequentRooms,
19
21
  loadRooms,
20
22
  recommendRooms,
@@ -8,10 +8,10 @@ import {
8
8
  resolveMeetingScheduleTypeIds,
9
9
  resolveMemberIdsByName,
10
10
  runScheduleConflictFlow
11
- } from "./chunk-FAZTGX7S.js";
12
- import "./chunk-Z7VYWPZV.js";
13
- import "./chunk-GAMZLAG2.js";
14
- import "./chunk-QVSWRLLU.js";
11
+ } from "./chunk-VIMCY4DI.js";
12
+ import "./chunk-DGMYACGJ.js";
13
+ import "./chunk-77YP6I52.js";
14
+ import "./chunk-JWWTI63L.js";
15
15
  import "./chunk-7BDPM5ST.js";
16
16
  import "./chunk-UG5G54VL.js";
17
17
  import "./chunk-BUSC6UAE.js";
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  createWorkflowHost
5
- } from "./chunk-GRDRG6HP.js";
5
+ } from "./chunk-HFXK54M4.js";
6
6
  import {
7
7
  USER_INTENT_RULE_FILE,
8
8
  aigroupUserDir,
@@ -17,7 +17,7 @@ import {
17
17
  validateRuleFile,
18
18
  workflowOperationDefinitions,
19
19
  workflowSuccess
20
- } from "./chunk-XNIK66I4.js";
20
+ } from "./chunk-JB34OE7R.js";
21
21
  import {
22
22
  createWorkflowContinuationSigner
23
23
  } from "./chunk-HP7JIYMT.js";
@@ -32,8 +32,8 @@ import {
32
32
  reportPlatformError
33
33
  } from "./chunk-6N4JPNFL.js";
34
34
  import "./chunk-7BDPM5ST.js";
35
- import "./chunk-ETNJSKMM.js";
36
- import "./chunk-UFIT2UU3.js";
35
+ import "./chunk-6NXT4ICB.js";
36
+ import "./chunk-U6R6FZHD.js";
37
37
  import {
38
38
  isCliError,
39
39
  toErrorEnvelope
@@ -395,6 +395,8 @@ var workflowShortcut = {
395
395
  userIntentExists: user.exists,
396
396
  userIntentError: user.error,
397
397
  defaults: loaded.file.defaults,
398
+ // 通用规则区(2026-11-05):只改 default.json 就能调的配置都在这里,输出出来才自检得到
399
+ generalRules: loaded.file.generalRules ?? null,
398
400
  rules: loaded.file.rules,
399
401
  userRules: user.rules,
400
402
  warnings: loaded.warnings,
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ import {
7
7
  firstPositionalToken,
8
8
  registerCommands,
9
9
  toCommandMetadata
10
- } from "./chunks/chunk-XHK4MDR5.js";
10
+ } from "./chunks/chunk-LRCPNDZA.js";
11
11
  import "./chunks/chunk-727FH2NI.js";
12
+ import "./chunks/chunk-GR76ZDDX.js";
12
13
  import "./chunks/chunk-AJ62BGAW.js";
13
- import "./chunks/chunk-BCVYBYYT.js";
14
14
  import "./chunks/chunk-6N4JPNFL.js";
15
- import "./chunks/chunk-ETNJSKMM.js";
16
- import "./chunks/chunk-UFIT2UU3.js";
15
+ import "./chunks/chunk-6NXT4ICB.js";
16
+ import "./chunks/chunk-U6R6FZHD.js";
17
17
  import "./chunks/chunk-UG5G54VL.js";
18
18
  import "./chunks/chunk-BUSC6UAE.js";
19
19
 
@@ -30,7 +30,7 @@ function lazyShortcut(definition) {
30
30
  placeholder.allowExcessArguments(true);
31
31
  placeholder.helpOption(false);
32
32
  placeholder.action(async () => {
33
- const { dispatchLazyShortcut } = await import("./chunks/lazy-dispatch-ZVWAI25B.js");
33
+ const { dispatchLazyShortcut } = await import("./chunks/lazy-dispatch-UH6HGK2I.js");
34
34
  await dispatchLazyShortcut(definition, shortcutMetadata());
35
35
  });
36
36
  }
@@ -40,127 +40,127 @@ var builtinShortcuts = [
40
40
  lazyShortcut({
41
41
  name: "invoice",
42
42
  description: "E10 \u4E1A\u7968\u901A\u53D1\u7968\u7BA1\u7406 CLI",
43
- load: async () => (await import("./chunks/invoice-MNRW76PP.js")).invoiceShortcut
43
+ load: async () => (await import("./chunks/invoice-OQP3TMKQ.js")).invoiceShortcut
44
44
  }),
45
45
  lazyShortcut({
46
46
  name: "ehr",
47
47
  description: "\u6CDB\u5FAEE10\u805A\u624D\u6797\uFF08\u4EBA\u4E8B/\u51FA\u52E4/\u85AA\u916C\uFF09CLI",
48
- load: async () => (await import("./chunks/ehr-GSTGAIY3.js")).ehrShortcut
48
+ load: async () => (await import("./chunks/ehr-MYRDCHZ4.js")).ehrShortcut
49
49
  }),
50
50
  lazyShortcut({
51
51
  name: "recruit-stage",
52
52
  description: "\u6CDB\u5FAEE10\u62DB\u8058\u52A9\u624B\uFF08JD\u751F\u6210/\u7B80\u5386\u5EFA\u6863/AI\u9762\u8BD5\u9080\u7EA6\uFF09CLI",
53
- load: async () => (await import("./chunks/recruit-stage-4MAOCKFY.js")).recruitStageShortcut
53
+ load: async () => (await import("./chunks/recruit-stage-AHY5QAMF.js")).recruitStageShortcut
54
54
  }),
55
55
  lazyShortcut({
56
56
  name: "cowork",
57
57
  description: "\u6CDB\u5FAEE10\u534F\u4F5C\u533A\uFF08\u534F\u4F5C\u4E8B\u9879/\u8BA8\u8BBA/\u5BA1\u6279/\u5171\u4EAB\u6743\u9650\uFF09CLI",
58
- load: async () => (await import("./chunks/cowork-GMLRGVIW.js")).coworkShortcut
58
+ load: async () => (await import("./chunks/cowork-3ACICHDQ.js")).coworkShortcut
59
59
  }),
60
60
  lazyShortcut({
61
61
  name: "archive",
62
62
  description: "E10 \u6587\u4E66\u5B9A\u6863\u6848\u7BA1\u7406 CLI",
63
- load: async () => (await import("./chunks/archive-P6TBQGKL.js")).archiveShortcut
63
+ load: async () => (await import("./chunks/archive-ZQ4A4TV6.js")).archiveShortcut
64
64
  }),
65
65
  lazyShortcut({
66
66
  name: "archive-oa",
67
67
  description: "E10 \u6863\u6848\u5B9A\u4F4D\u4E0E OA \u5546\u52A1\u5408\u540C\u501F\u9605 CLI",
68
- load: async () => (await import("./chunks/archive-oa-7TQ2NXOH.js")).archiveOaShortcut
68
+ load: async () => (await import("./chunks/archive-oa-BBDP7AKJ.js")).archiveOaShortcut
69
69
  }),
70
70
  lazyShortcut({
71
71
  name: "calendar",
72
72
  description: "\u6CDB\u5FAEE10\u65E5\u7A0B\u7BA1\u7406 CLI\uFF08\u521B\u5EFA/\u67E5\u8BE2/\u66F4\u65B0/\u5220\u9664/\u5B57\u5178\uFF09",
73
- load: async () => (await import("./chunks/calendar-FI2WNSBO.js")).calendarShortcut
73
+ load: async () => (await import("./chunks/calendar-DLGMRJQA.js")).calendarShortcut
74
74
  }),
75
75
  lazyShortcut({
76
76
  name: "fna",
77
77
  description: "\u6CDB\u5FAEE10\u9F50\u4E1A\u6210\u8D39\u63A7\u4E2D\u5FC3\uFF08\u9884\u7B97/\u8D39\u7528\u4E2D\u5FC3/\u501F\u6B3E\u7BA1\u7406/\u53D1\u7968\u6838\u9500\uFF09CLI",
78
- load: async () => (await import("./chunks/fna-YEKBSFSX.js")).fnaShortcut
78
+ load: async () => (await import("./chunks/fna-ZVB2IILI.js")).fnaShortcut
79
79
  }),
80
80
  lazyShortcut({
81
81
  name: "hrm",
82
82
  description: "\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5/\u7EC4\u7EC7/\u5C97\u4F4D\u67E5\u8BE2\uFF09CLI",
83
- load: async () => (await import("./chunks/hrm-NRDO4W5G.js")).hrmShortcut
83
+ load: async () => (await import("./chunks/hrm-UNKCCCGP.js")).hrmShortcut
84
84
  }),
85
85
  lazyShortcut({
86
86
  name: "mail",
87
87
  description: "\u6CDB\u5FAEE10\u90AE\u4EF6\u7BA1\u7406 CLI",
88
- load: async () => (await import("./chunks/mail-ZVAUXOJA.js")).mailShortcut
88
+ load: async () => (await import("./chunks/mail-M3HJF5ER.js")).mailShortcut
89
89
  }),
90
90
  lazyShortcut({
91
91
  name: "meeting",
92
92
  description: "\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406 CLI\uFF08\u6807\u51C6\u7248\uFF1A\u67E5\u8BE2/\u51B2\u7A81/\u9884\u7EA6/\u56DE\u6267/\u7B7E\u5230\uFF09",
93
- load: async () => (await import("./chunks/meeting-FEVPZ67S.js")).meetingShortcut
93
+ load: async () => (await import("./chunks/meeting-C67EHQ4Z.js")).meetingShortcut
94
94
  }),
95
95
  lazyShortcut({
96
96
  name: "okr",
97
97
  description: "\u6CDB\u5FAEE10 OKR \u76EE\u6807\u7BA1\u7406 CLI\uFF08\u76EE\u6807\u67E5\u8BE2/\u65B0\u5EFA/\u7F16\u8F91\u3001\u5173\u952E\u6210\u679C\u3001\u76EE\u6807\u5BF9\u9F50\u3001\u8BC4\u8BBA\uFF09",
98
- load: async () => (await import("./chunks/okr-SDH3E5RA.js")).okrShortcut
98
+ load: async () => (await import("./chunks/okr-EVX7FB5G.js")).okrShortcut
99
99
  }),
100
100
  lazyShortcut({
101
101
  name: "plan",
102
102
  description: "\u6CDB\u5FAEE10\u8BA1\u5212\u62A5\u544A CLI\uFF08\u67E5\u8BE2/\u65B0\u5EFA/\u4FEE\u6539/\u53D1\u5E03/\u64A4\u56DE/\u63D0\u4EA4\u63D0\u9192/\u8BC4\u8BBA\uFF09",
103
- load: async () => (await import("./chunks/plan-E35JFDI7.js")).planShortcut
103
+ load: async () => (await import("./chunks/plan-2QJQEPBO.js")).planShortcut
104
104
  }),
105
105
  lazyShortcut({
106
106
  name: "esb",
107
107
  description: "\u6CDB\u5FAEE10 ESB \u4E2D\u5FC3\u81EA\u5B9A\u4E49\u89E6\u53D1\u52A8\u4F5C\u6D41 CLI",
108
- load: async () => (await import("./chunks/esb-ATAIASX2.js")).esbShortcut
108
+ load: async () => (await import("./chunks/esb-4BQHNP5C.js")).esbShortcut
109
109
  }),
110
110
  lazyShortcut({
111
111
  name: "ebuilder-form",
112
112
  description: "\u6CDB\u5FAEE10 eBuilder \u8868\u5355\u83DC\u5355\u3001\u5217\u8868\u548C\u8868\u5355\u6570\u636E CLI",
113
- load: async () => (await import("./chunks/ebuilder-form-ANV2FHYV.js")).ebuilderFormShortcut
113
+ load: async () => (await import("./chunks/ebuilder-form-GWDTKEI2.js")).ebuilderFormShortcut
114
114
  }),
115
115
  lazyShortcut({
116
116
  name: "jiuchuanhui",
117
117
  description: "\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406 CLI\uFF08\u5BA2\u6237/\u8054\u7CFB\u4EBA/\u5546\u673A/\u7EBF\u7D22/\u8054\u7CFB\u8BA1\u5212/\u516C\u6D77\uFF09",
118
- load: async () => (await import("./chunks/jiuchuanhui-DTRBAX4N.js")).jiuchuanhuiShortcut
118
+ load: async () => (await import("./chunks/jiuchuanhui-ASFZBMPU.js")).jiuchuanhuiShortcut
119
119
  }),
120
120
  lazyShortcut({
121
121
  name: "asset",
122
122
  description: "E10 \u8D44\u4EA7\u7BA1\u7406\uFF08\u8D44\u7BA1\u5BB6\uFF09CLI",
123
- load: async () => (await import("./chunks/asset-3ELRG37G.js")).assetShortcut
123
+ load: async () => (await import("./chunks/asset-ZOJVBWZH.js")).assetShortcut
124
124
  }),
125
125
  lazyShortcut({
126
126
  name: "asset-idle",
127
127
  description: "E10 \u95F2\u7F6E\u8D44\u4EA7\u5224\u5B9A\u7ED3\u679C\u67E5\u8BE2 CLI\uFF08\u5206\u9875\u83B7\u53D6/\u805A\u5408\u7EDF\u8BA1\uFF09",
128
- load: async () => (await import("./chunks/asset-idle-WIGMUFMD.js")).assetIdleShortcut
128
+ load: async () => (await import("./chunks/asset-idle-XGB5IPGT.js")).assetIdleShortcut
129
129
  }),
130
130
  lazyShortcut({
131
131
  name: "im",
132
132
  description: "\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF08\u5373\u65F6\u901A\u8BAF\uFF09CLI",
133
- load: async () => (await import("./chunks/im-IQ2HN23S.js")).imShortcut
133
+ load: async () => (await import("./chunks/im-NJB7ZYMH.js")).imShortcut
134
134
  }),
135
135
  lazyShortcut({
136
136
  name: "project",
137
137
  description: "\u6CDB\u5FAEE10\u4E8B\u4E95\u7136\u9879\u76EE\u7BA1\u7406 CLI\uFF08\u9879\u76EE/\u4EFB\u52A1\u67E5\u8BE2\u4E0E\u786E\u8BA4\u5199\u5165\uFF09",
138
- load: async () => (await import("./chunks/project-73QXBAB2.js")).projectShortcut
138
+ load: async () => (await import("./chunks/project-XELELW2T.js")).projectShortcut
139
139
  }),
140
140
  lazyShortcut({
141
141
  name: "workflow",
142
142
  description: "\u6CDB\u5FAEE10\u6D41\u7A0B\u667A\u80FD\u52A9\u624B CLI\uFF08\u67E5\u8BE2/\u67E5\u770B/\u64CD\u4F5C/\u6279\u91CF/\u53D1\u8D77/\u4FEE\u6539\uFF09",
143
- load: async () => (await import("./chunks/workflow-CWJFJLQU.js")).workflowShortcut
143
+ load: async () => (await import("./chunks/workflow-BSYT5TGL.js")).workflowShortcut
144
144
  }),
145
145
  lazyShortcut({
146
146
  name: "blog",
147
147
  description: "\u6CDB\u5FAEE10\u5DE5\u4F5C\u65E5\u62A5 CLI\uFF08\u67E5\u8BE2/\u53D1\u5E03/\u7F16\u8F91/\u8BC4\u8BBA/\u70B9\u8D5E/\u63D0\u9192/\u5BFC\u51FA\uFF09",
148
- load: async () => (await import("./chunks/blog-C5NMZAAC.js")).blogShortcut
148
+ load: async () => (await import("./chunks/blog-QSHLZSFW.js")).blogShortcut
149
149
  }),
150
150
  lazyShortcut({
151
151
  name: "caizhilian",
152
152
  description: "\u6CDB\u5FAEE10\u91C7\u77E5\u8FDE\uFF08\u6587\u6863\u4E2D\u5FC3\uFF09CLI",
153
- load: async () => (await import("./chunks/caizhilian-5XSM2DFP.js")).caizhilianShortcut
153
+ load: async () => (await import("./chunks/caizhilian-KCQYFH72.js")).caizhilianShortcut
154
154
  }),
155
155
  lazyShortcut({
156
156
  name: "contract",
157
157
  description: "\u6CDB\u5FAEE10\u4ECA\u627F\u8FBE\u5408\u540C\u7BA1\u7406 CLI",
158
- load: async () => (await import("./chunks/contract-DNIIW5VJ.js")).contractShortcut
158
+ load: async () => (await import("./chunks/contract-3QLAGYQL.js")).contractShortcut
159
159
  }),
160
160
  lazyShortcut({
161
161
  name: "reception",
162
162
  description: "\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B CLI\uFF08\u9762\u677F/\u884C\u7A0B\u5355\u4E0E\u5185\u90E8\u65B9\u6848/\u586B\u5355\u9875\u9884\u586B\uFF09",
163
- load: async () => (await import("./chunks/reception-UWZVACBN.js")).receptionShortcut
163
+ load: async () => (await import("./chunks/reception-5WITA44R.js")).receptionShortcut
164
164
  })
165
165
  ];
166
166
  function shortcutMetadata() {
@@ -819,6 +819,36 @@ function formatXiaoEAuthErrorLogEntry(entry) {
819
819
  failure.httpStatus === undefined ? '' : `httpStatus=${failure.httpStatus}`,
820
820
  failure.message,
821
821
  ].filter(Boolean).join(' '));
822
+ if (failure.request) {
823
+ lines.push([
824
+ 'request:',
825
+ `transport=${failure.request.transport}`,
826
+ `method=${failure.request.method}`,
827
+ `endpoint=${failure.request.endpoint}`,
828
+ failure.request.finalEndpoint ? `finalEndpoint=${failure.request.finalEndpoint}` : '',
829
+ `redirect=${failure.request.redirect}`,
830
+ `timeoutMs=${failure.request.timeoutMs}`,
831
+ `elapsedMs=${failure.request.elapsedMs}`,
832
+ failure.request.redirectCount ? `redirectCount=${failure.request.redirectCount}` : '',
833
+ ].filter(Boolean).join(' '));
834
+ lines.push(`requestHeaders: ${JSON.stringify(failure.request.headers)}`);
835
+ lines.push(`requestBody: ${JSON.stringify(failure.request.body)}`);
836
+ lines.push(`requestParams: ${JSON.stringify({
837
+ transport: failure.request.transport,
838
+ url: failure.request.endpoint,
839
+ ...(failure.request.finalEndpoint ? { finalUrl: failure.request.finalEndpoint } : {}),
840
+ method: failure.request.method,
841
+ headers: failure.request.headers,
842
+ body: failure.request.body,
843
+ bodyBytes: failure.request.bodyBytes,
844
+ redirect: failure.request.redirect,
845
+ timeoutMs: failure.request.timeoutMs,
846
+ authorizationPresent: failure.request.authorizationPresent,
847
+ authorizationLength: failure.request.authorizationLength,
848
+ elapsedMs: failure.request.elapsedMs,
849
+ ...(failure.request.redirectCount ? { redirectCount: failure.request.redirectCount } : {}),
850
+ })}`);
851
+ }
822
852
  }
823
853
  return lines.join('\n');
824
854
  }
@@ -836,6 +866,7 @@ async function showXiaoEAuthErrorLogs(ctx, options) {
836
866
  ? [
837
867
  `XiaoE auth error logs (${result.returned}/${result.total}, newest first)`,
838
868
  `logFile: ${result.path}`,
869
+ ...(result.expiredRemoved ? [`expiredRemoved: ${result.expiredRemoved}`] : []),
839
870
  ...(result.invalidLines ? [`invalidLines: ${result.invalidLines}`] : []),
840
871
  '',
841
872
  result.entries.map(formatXiaoEAuthErrorLogEntry).join('\n\n'),
@@ -843,6 +874,7 @@ async function showXiaoEAuthErrorLogs(ctx, options) {
843
874
  : [
844
875
  'No XiaoE auth error logs.',
845
876
  `logFile: ${result.path}`,
877
+ ...(result.expiredRemoved ? [`expiredRemoved: ${result.expiredRemoved}`] : []),
846
878
  ...(result.invalidLines ? [`invalidLines: ${result.invalidLines}`] : []),
847
879
  ].join('\n');
848
880
  ctx.output.write(result, { text });
@@ -1,11 +1,17 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { appendFile, chmod, mkdir, readFile, unlink } from 'node:fs/promises';
2
+ import { appendFile, chmod, mkdir, readFile, rmdir, stat, unlink, writeFile } from 'node:fs/promises';
3
3
  import { dirname, resolve } from 'node:path';
4
4
  import { toErrorEnvelope } from '../../../core/errors.js';
5
5
  import { getE10AuthRoot } from './paths.js';
6
6
  const XIAOE_AUTH_ERROR_LOG_NAME = 'xiaoe-auth-errors.ndjson';
7
7
  const DEFAULT_LOG_LIMIT = 50;
8
+ const XIAOE_AUTH_ERROR_LOG_LOCK_SUFFIX = '.lock';
9
+ const XIAOE_AUTH_ERROR_LOG_LOCK_RETRY_MS = 25;
10
+ const XIAOE_AUTH_ERROR_LOG_LOCK_TIMEOUT_MS = 5_000;
11
+ const XIAOE_AUTH_ERROR_LOG_STALE_LOCK_MS = 30_000;
8
12
  export const MAX_XIAOE_AUTH_ERROR_LOG_LIMIT = 500;
13
+ export const XIAOE_AUTH_ERROR_LOG_RETENTION_DAYS = 15;
14
+ const XIAOE_AUTH_ERROR_LOG_RETENTION_MS = XIAOE_AUTH_ERROR_LOG_RETENTION_DAYS * 24 * 60 * 60 * 1_000;
9
15
  /**
10
16
  * The log lives beside the CLI-owned E10 profiles, never beside a caller-owned
11
17
  * `--auth` file. Keeping the target fixed also makes the clear command safe.
@@ -13,6 +19,98 @@ export const MAX_XIAOE_AUTH_ERROR_LOG_LIMIT = 500;
13
19
  export function getXiaoEAuthErrorLogPath() {
14
20
  return resolve(getE10AuthRoot(), 'logs', XIAOE_AUTH_ERROR_LOG_NAME);
15
21
  }
22
+ function waitForXiaoEAuthLogLock() {
23
+ return new Promise((resolveWait) => setTimeout(resolveWait, XIAOE_AUTH_ERROR_LOG_LOCK_RETRY_MS));
24
+ }
25
+ async function acquireXiaoEAuthLogLock(path) {
26
+ const lockPath = `${path}${XIAOE_AUTH_ERROR_LOG_LOCK_SUFFIX}`;
27
+ const startedAt = Date.now();
28
+ for (;;) {
29
+ try {
30
+ await mkdir(lockPath, { mode: 0o700 });
31
+ return async () => {
32
+ await rmdir(lockPath).catch((error) => {
33
+ if (error?.code !== 'ENOENT')
34
+ throw error;
35
+ });
36
+ };
37
+ }
38
+ catch (error) {
39
+ if (error?.code !== 'EEXIST')
40
+ throw error;
41
+ }
42
+ try {
43
+ const lockStat = await stat(lockPath);
44
+ if (Date.now() - lockStat.mtimeMs > XIAOE_AUTH_ERROR_LOG_STALE_LOCK_MS) {
45
+ await rmdir(lockPath);
46
+ continue;
47
+ }
48
+ }
49
+ catch (error) {
50
+ if (error?.code === 'ENOENT')
51
+ continue;
52
+ throw error;
53
+ }
54
+ if (Date.now() - startedAt >= XIAOE_AUTH_ERROR_LOG_LOCK_TIMEOUT_MS) {
55
+ throw new Error(`Timed out waiting for XiaoE auth error log lock: ${lockPath}`);
56
+ }
57
+ await waitForXiaoEAuthLogLock();
58
+ }
59
+ }
60
+ async function withXiaoEAuthLogLock(path, action) {
61
+ await mkdir(dirname(path), { recursive: true, mode: 0o700 });
62
+ await chmod(dirname(path), 0o700).catch(() => undefined);
63
+ const release = await acquireXiaoEAuthLogLock(path);
64
+ try {
65
+ return await action();
66
+ }
67
+ finally {
68
+ await release();
69
+ }
70
+ }
71
+ async function readXiaoEAuthErrorLogContent(path) {
72
+ try {
73
+ return await readFile(path, 'utf8');
74
+ }
75
+ catch (error) {
76
+ if (error?.code === 'ENOENT')
77
+ return '';
78
+ throw error;
79
+ }
80
+ }
81
+ function pruneExpiredXiaoEAuthErrorLogContent(content, now = Date.now()) {
82
+ const cutoff = now - XIAOE_AUTH_ERROR_LOG_RETENTION_MS;
83
+ const keptLines = [];
84
+ let expiredRemoved = 0;
85
+ for (const line of content.split(/\r?\n/u)) {
86
+ if (!line.trim())
87
+ continue;
88
+ try {
89
+ const value = JSON.parse(line);
90
+ if (isLogEntry(value)) {
91
+ const timestamp = Date.parse(value.timestamp);
92
+ if (Number.isFinite(timestamp) && timestamp < cutoff) {
93
+ expiredRemoved += 1;
94
+ continue;
95
+ }
96
+ }
97
+ }
98
+ catch {
99
+ // Preserve malformed lines so `invalidLines` remains observable to operators.
100
+ }
101
+ keptLines.push(line);
102
+ }
103
+ return {
104
+ content: keptLines.length ? `${keptLines.join('\n')}\n` : '',
105
+ expiredRemoved,
106
+ };
107
+ }
108
+ async function persistPrunedXiaoEAuthErrorLog(path, content, expiredRemoved) {
109
+ if (!expiredRemoved)
110
+ return;
111
+ await writeFile(path, content, { encoding: 'utf8', mode: 0o600 });
112
+ await chmod(path, 0o600).catch(() => undefined);
113
+ }
16
114
  export function xiaoEAuthLogSecrets(env) {
17
115
  return Object.entries(env)
18
116
  .filter(([key, value]) => Boolean(value
@@ -57,6 +155,35 @@ function sanitizeFailure(failure, secrets) {
57
155
  message: redactSensitiveText(failure.message, secrets),
58
156
  ...(failure.causeCode ? { causeCode: redactSensitiveText(failure.causeCode, secrets) } : {}),
59
157
  ...(failure.httpStatus === undefined ? {} : { httpStatus: failure.httpStatus }),
158
+ ...(failure.request ? { request: sanitizeExchangeRequest(failure.request, secrets) } : {}),
159
+ };
160
+ }
161
+ function sanitizeExchangeRequest(request, secrets) {
162
+ const endpoint = sanitizeBaseUrl(request.endpoint, secrets)
163
+ || redactSensitiveText(request.endpoint, secrets);
164
+ const finalEndpoint = request.finalEndpoint
165
+ ? sanitizeBaseUrl(request.finalEndpoint, secrets)
166
+ || redactSensitiveText(request.finalEndpoint, secrets)
167
+ : undefined;
168
+ const domain = sanitizeBaseUrl(request.body.domain, secrets)
169
+ || redactSensitiveText(request.body.domain, secrets);
170
+ return {
171
+ transport: request.transport,
172
+ method: 'POST',
173
+ endpoint,
174
+ ...(finalEndpoint && finalEndpoint !== endpoint ? { finalEndpoint } : {}),
175
+ redirect: request.redirect,
176
+ headers: {
177
+ 'content-type': 'application/json',
178
+ authorization: '<redacted>',
179
+ },
180
+ authorizationPresent: request.authorizationPresent,
181
+ authorizationLength: request.authorizationLength,
182
+ body: { domain },
183
+ bodyBytes: request.bodyBytes,
184
+ timeoutMs: request.timeoutMs,
185
+ elapsedMs: request.elapsedMs,
186
+ ...(request.redirectCount ? { redirectCount: request.redirectCount } : {}),
60
187
  };
61
188
  }
62
189
  function sanitizeError(error, secrets) {
@@ -99,18 +226,20 @@ function createEntry(input) {
99
226
  };
100
227
  }
101
228
  /**
102
- * Append-only persistence keeps concurrent CLI processes from overwriting one
103
- * another. A logging failure is returned to the caller and must never replace
104
- * the original authentication error.
229
+ * Serialize cleanup and append so concurrent CLI processes cannot reintroduce
230
+ * expired records or overwrite a newly appended record.
105
231
  */
106
232
  export async function appendXiaoEAuthErrorLog(input) {
107
233
  const path = getXiaoEAuthErrorLogPath();
108
- await mkdir(dirname(path), { recursive: true, mode: 0o700 });
109
- await chmod(dirname(path), 0o700).catch(() => undefined);
110
234
  const entry = createEntry(input);
111
- await appendFile(path, `${JSON.stringify(entry)}\n`, { encoding: 'utf8', mode: 0o600 });
112
- // Existing files may have been created under a permissive umask.
113
- await chmod(path, 0o600).catch(() => undefined);
235
+ await withXiaoEAuthLogLock(path, async () => {
236
+ const current = await readXiaoEAuthErrorLogContent(path);
237
+ const pruned = pruneExpiredXiaoEAuthErrorLogContent(current);
238
+ await persistPrunedXiaoEAuthErrorLog(path, pruned.content, pruned.expiredRemoved);
239
+ await appendFile(path, `${JSON.stringify(entry)}\n`, { encoding: 'utf8', mode: 0o600 });
240
+ // Existing files may have been created under a permissive umask.
241
+ await chmod(path, 0o600).catch(() => undefined);
242
+ });
114
243
  return entry;
115
244
  }
116
245
  function isLogEntry(value) {
@@ -135,14 +264,12 @@ export function normalizeXiaoEAuthErrorLogLimit(value) {
135
264
  export async function readXiaoEAuthErrorLog(limit = DEFAULT_LOG_LIMIT) {
136
265
  const normalizedLimit = normalizeXiaoEAuthErrorLogLimit(limit);
137
266
  const path = getXiaoEAuthErrorLogPath();
138
- let content = '';
139
- try {
140
- content = await readFile(path, 'utf8');
141
- }
142
- catch (error) {
143
- if (error?.code !== 'ENOENT')
144
- throw error;
145
- }
267
+ const { content, expiredRemoved } = await withXiaoEAuthLogLock(path, async () => {
268
+ const current = await readXiaoEAuthErrorLogContent(path);
269
+ const pruned = pruneExpiredXiaoEAuthErrorLogContent(current);
270
+ await persistPrunedXiaoEAuthErrorLog(path, pruned.content, pruned.expiredRemoved);
271
+ return pruned;
272
+ });
146
273
  let invalidLines = 0;
147
274
  const entries = [];
148
275
  for (const line of content.split(/\r?\n/u)) {
@@ -165,18 +292,21 @@ export async function readXiaoEAuthErrorLog(limit = DEFAULT_LOG_LIMIT) {
165
292
  total: entries.length,
166
293
  returned: recent.length,
167
294
  invalidLines,
295
+ expiredRemoved,
168
296
  entries: recent,
169
297
  };
170
298
  }
171
299
  export async function clearXiaoEAuthErrorLog() {
172
300
  const path = getXiaoEAuthErrorLogPath();
173
- try {
174
- await unlink(path);
175
- return { path, cleared: true };
176
- }
177
- catch (error) {
178
- if (error?.code === 'ENOENT')
179
- return { path, cleared: false };
180
- throw error;
181
- }
301
+ return withXiaoEAuthLogLock(path, async () => {
302
+ try {
303
+ await unlink(path);
304
+ return { path, cleared: true };
305
+ }
306
+ catch (error) {
307
+ if (error?.code === 'ENOENT')
308
+ return { path, cleared: false };
309
+ throw error;
310
+ }
311
+ });
182
312
  }