@openclaw/feishu 2026.10.2 → 2026.10.5-beta.2

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 (325) hide show
  1. package/dist/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
  2. package/dist/.setup/{channel-DZakdZ3r.mjs → channel-CjGGyrdx.mjs} +87 -174
  3. package/dist/.setup/{channel.runtime-rXFuQXLL.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
  4. package/dist/.setup/{chat-mTBvMMvx.mjs → chat-fC3dvxFs.mjs} +16 -28
  5. package/dist/.setup/{client-CcxmEkoy.mjs → client-wwr8PGPH.mjs} +24 -30
  6. package/dist/.setup/{conversation-id-C1ofUfU8.mjs → conversation-id-D00i9uy5.mjs} +5 -10
  7. package/dist/.setup/{doctor-contract-DyOo8NvC.mjs → doctor-contract-oIpUWtNO.mjs} +8 -15
  8. package/dist/.setup/{monitor-CXaFHMmi.mjs → monitor-Yt__BUki.mjs} +33 -54
  9. package/dist/.setup/{monitor.account-cJ8gavqv.mjs → monitor.account-CVz16781.mjs} +359 -658
  10. package/dist/.setup/{probe-BjSykXB8.mjs → probe-DXnFxq5j.mjs} +14 -17
  11. package/dist/.setup/{reply-delivery-result-laBNOmBu.mjs → reply-delivery-result-iCCrdxE1.mjs} +153 -181
  12. package/dist/.setup/{session-conversation-C53IEUWt.mjs → session-conversation-BSBNK5Mq.mjs} +1 -1
  13. package/dist/.setup/{setup-api-fZcYXGxe.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
  14. package/dist/.setup/{subagent-hooks-C8Z_x3KJ.mjs → subagent-hooks-9Pc1-k37.mjs} +7 -17
  15. package/dist/.setup/{thread-bindings-jW2x5VuN.mjs → thread-bindings-DdNLxoL3.mjs} +21 -44
  16. package/dist/api.js +218 -326
  17. package/dist/channel-plugin-api.js +1 -1
  18. package/dist/contract-api.js +1 -1
  19. package/dist/doctor-contract-api.js +1 -1
  20. package/dist/session-binding-contract-api.js +1 -1
  21. package/dist/session-key-api.js +1 -1
  22. package/dist/setup-api.js +1 -1
  23. package/dist/setup-entry.js +1 -1
  24. package/dist/subagent-hooks-api.js +1 -1
  25. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
  26. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  27. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
  28. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
  29. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  30. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  31. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  32. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  33. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  34. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  35. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  36. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  37. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
  38. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
  39. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  40. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  41. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  42. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  43. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  44. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
  45. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  46. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  47. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  48. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
  49. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  50. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  51. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  52. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
  53. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  54. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  55. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  56. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  57. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  58. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  59. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  60. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
  61. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  62. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  63. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  64. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  65. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  66. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  67. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  68. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  69. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  70. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  71. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  72. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  73. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  74. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  75. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  76. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  77. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  78. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  79. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  80. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  81. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  82. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  83. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
  84. package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
  85. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  86. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  87. package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
  88. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  89. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  90. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  91. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  92. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  93. package/node_modules/@openclaw/fs-safe/package.json +15 -15
  94. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  95. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  96. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  97. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  98. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  99. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  100. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  101. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  102. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  103. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  104. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  105. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  106. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  107. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  108. package/node_modules/follow-redirects/index.js +10 -1
  109. package/node_modules/follow-redirects/package.json +1 -1
  110. package/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
  111. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
  112. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
  113. package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
  114. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
  115. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
  116. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
  117. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
  118. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
  119. package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
  120. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
  121. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
  122. package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
  123. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
  124. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
  125. package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
  126. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
  127. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
  128. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
  129. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
  130. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
  131. package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
  132. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
  133. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
  134. package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
  135. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
  136. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
  137. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
  138. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
  139. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
  140. package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
  141. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
  142. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
  143. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
  144. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
  145. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
  146. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
  147. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
  148. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
  149. package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
  150. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
  151. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
  152. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
  153. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
  154. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
  155. package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
  156. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
  157. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
  158. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
  159. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
  160. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
  161. package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
  162. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
  163. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
  164. package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
  165. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
  166. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
  167. package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
  168. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
  169. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
  170. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
  171. package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
  172. package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
  173. package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
  174. package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
  175. package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
  176. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
  177. package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
  178. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
  179. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
  180. package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
  181. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
  182. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
  183. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
  184. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
  185. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
  186. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
  187. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
  188. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
  189. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
  190. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
  191. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
  192. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
  193. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
  194. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
  195. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
  196. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
  197. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
  198. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
  199. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
  200. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
  201. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
  202. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
  203. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
  204. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
  205. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
  206. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
  207. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
  208. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
  209. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
  210. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
  211. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
  212. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
  213. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
  214. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
  215. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
  216. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
  217. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
  218. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
  219. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
  220. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
  221. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
  222. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
  223. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
  224. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
  225. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
  226. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
  227. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
  228. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
  229. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
  230. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
  231. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
  232. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
  233. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
  234. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
  235. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
  236. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
  237. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
  238. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
  239. package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
  240. package/node_modules/mdast-util-to-markdown/package.json +13 -57
  241. package/node_modules/mdast-util-to-markdown/readme.md +139 -84
  242. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  243. package/node_modules/micromark/dev/lib/compile.js +14 -4
  244. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  245. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  246. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  247. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  248. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  249. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  250. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  251. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  252. package/node_modules/micromark/lib/compile.js +37 -29
  253. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  254. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  255. package/node_modules/micromark/lib/initialize/document.js +21 -13
  256. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  257. package/node_modules/micromark/lib/initialize/text.js +7 -3
  258. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  259. package/node_modules/micromark/lib/preprocess.js +16 -19
  260. package/node_modules/micromark/package.json +2 -15
  261. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  262. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  263. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  264. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  265. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  266. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  267. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  268. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  269. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  270. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  271. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  272. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  273. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  274. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  275. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  276. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  277. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  278. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  279. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  280. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  281. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  282. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  283. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  284. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  285. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  286. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  287. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  288. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  289. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  290. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  291. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  292. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  293. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  294. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  295. package/node_modules/micromark-core-commonmark/package.json +4 -16
  296. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  297. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  298. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  299. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  300. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  301. package/node_modules/micromark-factory-space/index.js +55 -3
  302. package/node_modules/micromark-factory-space/package.json +1 -10
  303. package/node_modules/micromark-factory-space/readme.md +25 -25
  304. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  305. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  306. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  307. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  308. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  309. package/node_modules/micromark-util-edit-map/index.js +225 -0
  310. package/node_modules/micromark-util-edit-map/license +22 -0
  311. package/node_modules/micromark-util-edit-map/package.json +48 -0
  312. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  313. package/node_modules/micromark-util-types/index.d.ts +6 -3
  314. package/node_modules/micromark-util-types/package.json +2 -36
  315. package/node_modules/ws/lib/websocket.js +17 -3
  316. package/node_modules/ws/package.json +1 -1
  317. package/package.json +5 -5
  318. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  319. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  320. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
  321. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
  322. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  323. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
  324. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
  325. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { t as feishuPlugin } from "./.setup/channel-DZakdZ3r.mjs";
1
+ import { t as feishuPlugin } from "./.setup/channel-CjGGyrdx.mjs";
2
2
  export { feishuPlugin };
@@ -1,4 +1,4 @@
1
- import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./.setup/conversation-id-C1ofUfU8.mjs";
1
+ import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./.setup/conversation-id-D00i9uy5.mjs";
2
2
  import { t as messageActionTargetAliases } from "./.setup/message-action-contract-Bhxj8Zrf.mjs";
3
3
  import { t as collectFeishuSecurityAuditFindings } from "./.setup/security-audit-b86aSgH2.mjs";
4
4
  export { buildFeishuConversationId, collectFeishuSecurityAuditFindings, messageActionTargetAliases, parseFeishuConversationId, parseFeishuDirectConversationId, parseFeishuTargetId };
@@ -1,2 +1,2 @@
1
- import { i as normalizeHistoricalWebhookConfig, n as legacyConfigRules, r as normalizeCompatibilityConfig, t as historicalWebhookListener } from "./.setup/doctor-contract-DyOo8NvC.mjs";
1
+ import { i as normalizeHistoricalWebhookConfig, n as legacyConfigRules, r as normalizeCompatibilityConfig, t as historicalWebhookListener } from "./.setup/doctor-contract-oIpUWtNO.mjs";
2
2
  export { historicalWebhookListener, legacyConfigRules, normalizeCompatibilityConfig, normalizeHistoricalWebhookConfig };
@@ -1,2 +1,2 @@
1
- import { t as createFeishuThreadBindingManager } from "./.setup/thread-bindings-jW2x5VuN.mjs";
1
+ import { t as createFeishuThreadBindingManager } from "./.setup/thread-bindings-DdNLxoL3.mjs";
2
2
  export { createFeishuThreadBindingManager };
@@ -1,2 +1,2 @@
1
- import { t as resolveFeishuSessionConversation } from "./.setup/session-conversation-C53IEUWt.mjs";
1
+ import { t as resolveFeishuSessionConversation } from "./.setup/session-conversation-BSBNK5Mq.mjs";
2
2
  export { resolveFeishuSessionConversation as resolveSessionConversation };
package/dist/setup-api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./.setup/channel-DZakdZ3r.mjs";
1
+ import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./.setup/channel-CjGGyrdx.mjs";
2
2
  export { feishuPlugin, feishuSetupAdapter, feishuSetupWizard };
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
4
4
  var setup_entry_default = defineBundledChannelSetupEntry({
5
5
  importMetaUrl: import.meta.url,
6
6
  plugin: {
7
- specifier: fileURLToPath(new URL(".setup/setup-api-fZcYXGxe.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/setup-api-B_LFQQ-Q.mjs", import.meta.url).href),
8
8
  exportName: "feishuPlugin"
9
9
  },
10
10
  secrets: {
@@ -1,6 +1,6 @@
1
1
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
2
2
  //#region extensions/feishu/subagent-hooks-api.ts
3
- const loadFeishuSubagentHooksModule = createLazyRuntimeModule(() => import("./.setup/subagent-hooks-C8Z_x3KJ.mjs").then((n) => n.r));
3
+ const loadFeishuSubagentHooksModule = createLazyRuntimeModule(() => import("./.setup/subagent-hooks-9Pc1-k37.mjs").then((n) => n.r));
4
4
  function registerFeishuSubagentHooks(api) {
5
5
  api.on("subagent_delivery_target", async (event) => {
6
6
  const { handleFeishuSubagentDeliveryTarget } = await loadFeishuSubagentHooksModule();
@@ -2,6 +2,41 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.25.0 - 2026-10-08
6
+
7
+ ### Highlights
8
+
9
+ - **Faster synchronous plugin captures:** 16% faster than pre-change main on a measured 6,000-file tree; the new `createRootFileCopyBatchSync` API on `advanced` also reuses directory admissions across copies. ([#878](https://github.com/openclaw/fs-safe/pull/878), [#849](https://github.com/openclaw/fs-safe/pull/849))
10
+ - **Guest workspace publication:** works on gVisor and other Linux filesystems that reject `RENAME_NOREPLACE`. ([#876](https://github.com/openclaw/fs-safe/pull/876))
11
+ - **Root-backed sidecar locks:** native asynchronous release and exit cleanup no longer strand locks after their Root moves. ([#879](https://github.com/openclaw/fs-safe/pull/879))
12
+ - **Guest cross-device moves:** preserve the admitted file permissions. ([#869](https://github.com/openclaw/fs-safe/pull/869))
13
+
14
+ ### Features
15
+
16
+ - **Guarded copy batches:** `createRootFileCopyBatchSync` on `advanced` reuses directory admissions across synchronous copies on canonical POSIX paths while rechecking ancestor and file identities for every copy; single-file copies also reuse admission within the operation. ([#849](https://github.com/openclaw/fs-safe/pull/849))
17
+
18
+ ### Fixes
19
+
20
+ - **Root-backed file locks:** native asynchronous release and exit cleanup follow the created lock's retained identity after its Root moves, preserving replacement files and reporting ownership mismatches. ([#879](https://github.com/openclaw/fs-safe/pull/879)) Thanks @axiom-ncis.
21
+ - **Temp directory diagnostics:** name rejected roots and ancestors, explain ownership, mode, or symlink failures, and provide safe recovery guidance, including for root-run appliances. Thanks @joequant. ([#877](https://github.com/openclaw/fs-safe/pull/877))
22
+ - **Guest directory publication:** publish staged workspaces when Linux filesystems reject `RENAME_NOREPLACE`, with checked file link/unlink fallback and directory rename that can only replace a concurrently created empty directory. ([#876](https://github.com/openclaw/fs-safe/pull/876)) Thanks @valkyriweb.
23
+ - **Guest cross-device moves:** preserve the admitted source file's permissions instead of leaving the destination with a broader default mode. ([#869](https://github.com/openclaw/fs-safe/pull/869))
24
+ - **Move receipts:** publication receipts capture the source identity after synchronous authorization callbacks return, so a source replaced during authorization is reported accurately. ([#868](https://github.com/openclaw/fs-safe/pull/868))
25
+ - **Atomic copy fallback:** report a failed restoration as a failure even when the underlying error carries a restored receipt. ([#851](https://github.com/openclaw/fs-safe/pull/851))
26
+ - **Archive read limits:** keep the validated entry-read byte limit fixed when callers mutate the options during a read. ([#852](https://github.com/openclaw/fs-safe/pull/852))
27
+ - **Watch on macOS:** reconcile notifications for changes to the watched Root itself immediately instead of waiting for the periodic scan. ([#858](https://github.com/openclaw/fs-safe/pull/858))
28
+ - **`pathScope` tilde names:** keep literal `~` directory names inside scoped file and existing-path lookups instead of expanding them. ([#856](https://github.com/openclaw/fs-safe/pull/856))
29
+
30
+ ### Performance
31
+
32
+ - **Guarded file copies:** reuse checked canonical POSIX roots during initial path admission, reducing repeated path-resolution work in synchronous plugin source captures without changing per-file identity or race checks.
33
+ - **Root walks:** reuse normalized directory prefixes, cutting a 50k-file walk by 5.6% and its sampled allocation by about 9% while keeping every filesystem and identity check. ([#870](https://github.com/openclaw/fs-safe/pull/870))
34
+ - **Atomic writes:** non-durable async POSIX writes skip a redundant mode change when the staged file already has the requested permissions. ([#871](https://github.com/openclaw/fs-safe/pull/871))
35
+ - **Guarded mutations:** fewer promise allocations around synchronous guard checks, with directory identity checks unchanged. ([#857](https://github.com/openclaw/fs-safe/pull/857))
36
+ - **Archive publication:** fewer promise allocations in archive guard checks, without removing identity or containment checks. ([#864](https://github.com/openclaw/fs-safe/pull/864))
37
+ - **Watch:** Linux and Windows watch passes skip macOS stream-path preparation. ([#860](https://github.com/openclaw/fs-safe/pull/860))
38
+ - **Permission diagnostics:** bound escaping work for large error messages without changing the displayed excerpts. ([#859](https://github.com/openclaw/fs-safe/pull/859))
39
+
5
40
  ## 0.24.2 - 2026-10-07
6
41
 
7
42
  ### Fixes
@@ -22,7 +22,7 @@ await fs.write("../escape.txt", "x"); // throws FsSafeError("outside-
22
22
 
23
23
  That's the whole pitch. `root()` is the product; the rest of the package — JSON stores, atomic writes, secret files, archive extraction, temp workspaces — is supporting cast for the same boundary.
24
24
 
25
- Full docs and reference at **[fs-safe.io](https://fs-safe.io)**.
25
+ Full docs and reference at **[fs-safe.io](https://fs-safe.io)**. For synchronous plugin captures, [guarded file copies and batches](docs/copy.md#synchronous-guarded-file-copies) return owned destination descriptors while preserving per-file checks.
26
26
 
27
27
  ## Contents
28
28
 
@@ -1,4 +1,4 @@
1
- export { copyRootFileSync, type CopyRootFileSyncOptions, type CopiedRootFileSync } from "./copy-root-file-sync.js";
1
+ export { copyRootFileSync, createRootFileCopyBatchSync, type RootFileCopyBatchSync, type CopyRootFileSyncOptions, type CopiedRootFileSync } from "./copy-root-file-sync.js";
2
2
  export { createAsyncLock } from "./async-lock.js";
3
3
  export { createDirectory, createDirectorySync, createFileSync, type CreateDirectoryOptions, type CreateFileOptions, type OwnedFileDescriptorSync, } from "./create.js";
4
4
  export { copyFileHandle, copyFileDescriptorSync, type CopyFileHandleOptions } from "./file-handle-transfer.js";
@@ -1,4 +1,4 @@
1
- export { copyRootFileSync } from "./copy-root-file-sync.js";
1
+ export { copyRootFileSync, createRootFileCopyBatchSync } from "./copy-root-file-sync.js";
2
2
  // Advanced composition surface. These exports are less stable than the focused
3
3
  // public subpaths; prefer root/json/store/temp/archive unless you are building a
4
4
  // higher-level primitive.
@@ -65,7 +65,7 @@ export async function finalizeArchivePublication(params) {
65
65
  const check = () => params.deadline?.check();
66
66
  const assertGuards = async (guards) => {
67
67
  for (const guard of [params.destinationGuard, ...guards, params.sourceGuard]) {
68
- await assertDirectoryIdentityGuard(guard);
68
+ assertDirectoryIdentityGuard(guard);
69
69
  check();
70
70
  }
71
71
  };
@@ -98,15 +98,15 @@ async function mergeTree(params, publication, durable = true, entryUmask = 0) {
98
98
  assertSourceDirectory(ancestor);
99
99
  };
100
100
  const assertGuards = async () => {
101
- await assertDirectoryIdentityGuard(destinationGuard);
101
+ assertDirectoryIdentityGuard(destinationGuard);
102
102
  check();
103
103
  for (const ancestor of ancestors) {
104
- await assertDirectoryIdentityGuard(ancestor.guard);
104
+ assertDirectoryIdentityGuard(ancestor.guard);
105
105
  check();
106
106
  await ancestor.owner.verify(check);
107
107
  check();
108
108
  }
109
- await assertDirectoryIdentityGuard(sourceGuard);
109
+ assertDirectoryIdentityGuard(sourceGuard);
110
110
  check();
111
111
  };
112
112
  const walk = async (sourceDir) => {
@@ -184,7 +184,7 @@ async function mergeTree(params, publication, durable = true, entryUmask = 0) {
184
184
  await owner.apply(mode, { check, beforeChmod: async () => {
185
185
  await assertGuards();
186
186
  assertSourceAncestors();
187
- await assertDirectoryIdentityGuard(guard);
187
+ assertDirectoryIdentityGuard(guard);
188
188
  check();
189
189
  await assertResolvedInsideDestination({
190
190
  destinationRealDir, targetPath: destinationPath, originalPath,
@@ -213,7 +213,8 @@ async function readNativeBufferEntry(native, buffer, kind, requested, displayPat
213
213
  }
214
214
  }
215
215
  export async function readArchiveEntry(archivePath, entryPath, options) {
216
- if (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 0) {
216
+ const maxBytes = options.maxBytes;
217
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
217
218
  throw new RangeError("maxBytes must be a non-negative safe integer");
218
219
  }
219
220
  const kind = options.kind ?? resolveArchiveKind(archivePath);
@@ -228,7 +229,7 @@ export async function readArchiveEntry(archivePath, entryPath, options) {
228
229
  admitZipBuffer(buffer, resolveExtractLimits(), entry => { zipEntries.push(entry); });
229
230
  const native = getNativeBinding();
230
231
  if (native)
231
- return await readNativeBufferEntry(native, buffer, kind, requestedEntry, entryPath, options.maxBytes, zipEntries);
232
- return kind === "zip" ? await readZipEntry(buffer, requestedEntry, options.maxBytes, zipEntries)
233
- : await readTarEntry(buffer, requestedEntry, options.maxBytes, kind);
232
+ return await readNativeBufferEntry(native, buffer, kind, requestedEntry, entryPath, maxBytes, zipEntries);
233
+ return kind === "zip" ? await readZipEntry(buffer, requestedEntry, maxBytes, zipEntries)
234
+ : await readTarEntry(buffer, requestedEntry, maxBytes, kind);
234
235
  }
@@ -5,7 +5,7 @@ import { ArchiveSecurityError } from "./archive-errors.js";
5
5
  export type ArchiveDirectoryGuard = AsyncDirectoryGuard<BigIntStats>;
6
6
  export declare function createArchiveSymlinkTraversalError(originalPath: string): ArchiveSecurityError;
7
7
  export declare function createDirectoryIdentityGuard(dir: string): Promise<ArchiveDirectoryGuard>;
8
- export declare function assertDirectoryIdentityGuard(guard: ArchiveDirectoryGuard): Promise<void>;
8
+ export declare function assertDirectoryIdentityGuard(guard: ArchiveDirectoryGuard): void;
9
9
  export declare function prepareArchiveDestinationGuard(destDir: string): Promise<ArchiveDirectoryGuard>;
10
10
  export declare function prepareArchiveDestinationDir(destDir: string): Promise<string>;
11
11
  export declare function assertResolvedInsideDestination(params: {
@@ -1,7 +1,7 @@
1
1
  import fsSync, {} from "node:fs";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
- import { assertAsyncDirectoryGuard, createAsyncDirectoryGuard, } from "./directory-guard.js";
4
+ import { assertDirectoryGuard, createAsyncDirectoryGuard, } from "./directory-guard.js";
5
5
  import { ownExtractionDestinationMutation, } from "./archive-deadline.js";
6
6
  import { ArchiveSecurityError, } from "./archive-errors.js";
7
7
  import { FsSafeError } from "./errors.js";
@@ -38,9 +38,9 @@ export async function createDirectoryIdentityGuard(dir) {
38
38
  throw err;
39
39
  }
40
40
  }
41
- export async function assertDirectoryIdentityGuard(guard) {
41
+ export function assertDirectoryIdentityGuard(guard) {
42
42
  try {
43
- await assertAsyncDirectoryGuard(guard);
43
+ assertDirectoryGuard(guard, "native");
44
44
  }
45
45
  catch (err) {
46
46
  if (err instanceof FsSafeError || isNotFoundPathError(err)) {
@@ -200,7 +200,7 @@ async function prepareOutputPath(params, assertGuards, privateWorkingMode = fals
200
200
  if (existingDestinationGuard && assertGuards)
201
201
  await assertGuards();
202
202
  else {
203
- await assertDirectoryIdentityGuard(destinationGuard);
203
+ assertDirectoryIdentityGuard(destinationGuard);
204
204
  checkExtractionDeadline(params.deadline);
205
205
  await assertGuards?.();
206
206
  }
@@ -213,46 +213,30 @@ async function prepareOutputPath(params, assertGuards, privateWorkingMode = fals
213
213
  originalPath: params.originalPath,
214
214
  });
215
215
  checkExtractionDeadline(params.deadline);
216
- if (params.isDirectory) {
217
- await getFsSafeTestHooks()?.beforeArchiveOutputMutation?.("mkdir", params.outPath);
216
+ const relativePath = params.isDirectory ? relPath : path.posix.dirname(relPath);
217
+ if (params.isDirectory || relativePath !== ".") {
218
+ const directoryPath = params.isDirectory ? params.outPath : path.dirname(params.outPath);
219
+ await getFsSafeTestHooks()?.beforeArchiveOutputMutation?.("mkdir", directoryPath);
218
220
  checkExtractionDeadline(params.deadline);
219
221
  await ownExtractionDestinationMutation(params.deadline, async () => {
220
222
  await assertOutputGuards();
221
223
  checkExtractionDeadline(params.deadline);
222
- await mkdirArchiveOutput({
223
- targetRoot,
224
- relativePath: relPath,
225
- originalPath: params.originalPath,
226
- });
227
- checkExtractionDeadline(params.deadline);
228
- await assertDirectoryIdentityGuard(destinationGuard);
224
+ await mkdirArchiveOutput({ targetRoot, relativePath, originalPath: params.originalPath });
229
225
  checkExtractionDeadline(params.deadline);
230
- await assertResolvedInsideDestination({
231
- destinationRealDir: params.destinationRealDir,
232
- targetPath: params.outPath,
233
- originalPath: params.originalPath,
234
- });
235
- checkExtractionDeadline(params.deadline);
236
- });
237
- return;
238
- }
239
- const parentRel = path.posix.dirname(relPath);
240
- if (parentRel !== ".") {
241
- await getFsSafeTestHooks()?.beforeArchiveOutputMutation?.("mkdir", path.dirname(params.outPath));
242
- checkExtractionDeadline(params.deadline);
243
- await ownExtractionDestinationMutation(params.deadline, async () => {
244
- await assertOutputGuards();
245
- checkExtractionDeadline(params.deadline);
246
- await mkdirArchiveOutput({
247
- targetRoot,
248
- relativePath: parentRel,
249
- originalPath: params.originalPath,
250
- });
251
- checkExtractionDeadline(params.deadline);
252
- await assertDirectoryIdentityGuard(destinationGuard);
226
+ assertDirectoryIdentityGuard(destinationGuard);
253
227
  checkExtractionDeadline(params.deadline);
228
+ if (params.isDirectory) {
229
+ await assertResolvedInsideDestination({
230
+ destinationRealDir: params.destinationRealDir,
231
+ targetPath: params.outPath,
232
+ originalPath: params.originalPath,
233
+ });
234
+ checkExtractionDeadline(params.deadline);
235
+ }
254
236
  });
255
237
  }
238
+ if (params.isDirectory)
239
+ return;
256
240
  await assertResolvedInsideDestination({
257
241
  destinationRealDir: params.destinationRealDir,
258
242
  targetPath: path.dirname(params.outPath),
@@ -292,12 +276,12 @@ export async function withStagedArchiveDestination(params) {
292
276
  const stagingGuard = await createDirectoryIdentityGuard(stagingDir);
293
277
  try {
294
278
  await fs.chmod(stagingDir, ARCHIVE_STAGING_MODE).catch(() => undefined);
295
- await assertDirectoryIdentityGuard(stagingGuard);
279
+ assertDirectoryIdentityGuard(stagingGuard);
296
280
  return await params.run(stagingDir);
297
281
  }
298
282
  finally {
299
283
  try {
300
- await assertDirectoryIdentityGuard(stagingGuard);
284
+ assertDirectoryIdentityGuard(stagingGuard);
301
285
  await fs.rm(stagingDir, { recursive: true, force: true }).catch(() => undefined);
302
286
  }
303
287
  catch {
@@ -0,0 +1,17 @@
1
+ import { type AnyAsyncDirectoryGuard } from "./directory-guard.js";
2
+ export type CopyPath = {
3
+ rootPath: string;
4
+ absolutePath: string;
5
+ };
6
+ declare function admitUncachedCopyPath(input: CopyPath, create?: boolean, admittedRoot?: AnyAsyncDirectoryGuard): {
7
+ path: string;
8
+ parent: AnyAsyncDirectoryGuard;
9
+ assertCurrent: () => void;
10
+ rootCanonicalPath: string | undefined;
11
+ };
12
+ /** Metadata custody lasts only for the owning copy or explicit batch. */
13
+ export declare function createCopyPathAdmissionCache(): {
14
+ admit: (input: CopyPath, create?: boolean) => ReturnType<typeof admitUncachedCopyPath>;
15
+ clear(): void;
16
+ };
17
+ export {};
@@ -0,0 +1,117 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { assertSyncDirectoryGuard, captureDirectoryGuard, inspectDirectoryIdentitySync } from "./directory-guard.js";
4
+ import { FsSafeError } from "./errors.js";
5
+ import { sameFileIdentity } from "./file-identity.js";
6
+ import { realpathSync } from "./realpath.js";
7
+ import { resolveRootPathSync, ROOT_PATH_ALIAS_POLICIES } from "./root-path.js";
8
+ function admitUncachedCopyPath(input, create = false, admittedRoot) {
9
+ if (!path.isAbsolute(input.rootPath) || !path.isAbsolute(input.absolutePath)) {
10
+ throw new FsSafeError("invalid-path", "copy roots and paths must be absolute");
11
+ }
12
+ const root = admittedRoot ?? captureDirectoryGuard(realpathSync(input.rootPath), "native", { bigint: true });
13
+ // Canonical POSIX callers already own a freshly checked root. Keep the
14
+ // resolver's lexical/symlink walk, but do not rediscover that root each time.
15
+ const rootCanonicalPath = admittedRoot?.realPath;
16
+ const resolve = () => {
17
+ const parent = create ? resolveRootPathSync({
18
+ ...input, rootCanonicalPath, absolutePath: path.dirname(input.absolutePath), boundaryLabel: "copy parent",
19
+ rejectSymlinks: true, rejectFinalSymlink: true,
20
+ }) : undefined;
21
+ const selected = resolveRootPathSync({
22
+ ...input, rootCanonicalPath, boundaryLabel: "copy", rejectSymlinks: !create, rejectFinalSymlink: !create,
23
+ policy: create ? ROOT_PATH_ALIAS_POLICIES.unlinkTarget : undefined,
24
+ });
25
+ if (parent && path.dirname(selected.canonicalPath) !== parent.canonicalPath) {
26
+ throw new FsSafeError("path-mismatch", "copy destination parent changed");
27
+ }
28
+ return selected;
29
+ };
30
+ const selected = resolve();
31
+ const parent = captureDirectoryGuard(path.dirname(selected.canonicalPath), "native", { bigint: true });
32
+ const assertCurrent = () => {
33
+ assertSyncDirectoryGuard(root);
34
+ assertSyncDirectoryGuard(parent);
35
+ const current = resolve();
36
+ if (current.rootCanonicalPath !== root.realPath || current.canonicalPath !== selected.canonicalPath) {
37
+ throw new FsSafeError("path-mismatch", "copy path changed during operation");
38
+ }
39
+ assertSyncDirectoryGuard(root);
40
+ assertSyncDirectoryGuard(parent);
41
+ };
42
+ assertCurrent();
43
+ return { path: selected.canonicalPath, parent, assertCurrent, rootCanonicalPath: undefined };
44
+ }
45
+ /** Metadata custody lasts only for the owning copy or explicit batch. */
46
+ export function createCopyPathAdmissionCache() {
47
+ const roots = new Map();
48
+ const parents = new Map();
49
+ const directories = new Map();
50
+ const assertParent = ({ root, parent, chain }) => {
51
+ assertSyncDirectoryGuard(root);
52
+ for (const guard of chain) {
53
+ inspectDirectoryIdentitySync(guard.dir, { dev: BigInt(guard.stat.dev), ino: BigInt(guard.stat.ino) });
54
+ }
55
+ assertSyncDirectoryGuard(parent);
56
+ assertSyncDirectoryGuard(root);
57
+ };
58
+ const admit = (input, create = false) => {
59
+ // Keep the public resolver for Windows aliases and noncanonical spellings,
60
+ // including raw dot segments whose traversal must not be normalized away.
61
+ if (process.platform === "win32" || !path.isAbsolute(input.rootPath) ||
62
+ !path.isAbsolute(input.absolutePath) || input.rootPath.includes("\0") || input.absolutePath.includes("\0") ||
63
+ path.resolve(input.rootPath) !== input.rootPath || path.resolve(input.absolutePath) !== input.absolutePath ||
64
+ !input.absolutePath.startsWith(input.rootPath.endsWith(path.sep) ? input.rootPath : `${input.rootPath}${path.sep}`)) {
65
+ return admitUncachedCopyPath(input, create);
66
+ }
67
+ let root = roots.get(input.rootPath);
68
+ if (!root) {
69
+ const canonical = realpathSync(input.rootPath);
70
+ if (canonical !== input.rootPath)
71
+ return admitUncachedCopyPath(input, create);
72
+ root = captureDirectoryGuard(canonical, "native", { bigint: true });
73
+ roots.set(input.rootPath, root);
74
+ }
75
+ assertSyncDirectoryGuard(root);
76
+ const parentPath = path.dirname(input.absolutePath);
77
+ let byParent = parents.get(input.rootPath);
78
+ let admitted = byParent?.get(parentPath);
79
+ if (!admitted) {
80
+ // The first file in each parent retains the existing lexical admission.
81
+ const selected = admitUncachedCopyPath(input, create, root);
82
+ const chain = [];
83
+ let cursor = input.rootPath;
84
+ const relative = path.relative(input.rootPath, parentPath);
85
+ for (const segment of relative ? relative.split(path.sep) : []) {
86
+ cursor = path.join(cursor, segment);
87
+ let guard = directories.get(cursor);
88
+ if (!guard) {
89
+ guard = captureDirectoryGuard(cursor, "native", { bigint: true });
90
+ directories.set(cursor, guard);
91
+ }
92
+ chain.push(guard);
93
+ }
94
+ admitted = { root, parent: chain.at(-1) ?? root, chain };
95
+ assertParent(admitted);
96
+ if (selected.path !== input.absolutePath || selected.parent.realPath !== parentPath ||
97
+ !sameFileIdentity(selected.parent.stat, admitted.parent.stat)) {
98
+ throw new FsSafeError("path-mismatch", "copy path changed during admission");
99
+ }
100
+ byParent ??= new Map();
101
+ byParent.set(parentPath, admitted);
102
+ parents.set(input.rootPath, byParent);
103
+ }
104
+ const selected = admitted;
105
+ const assertCurrent = () => {
106
+ assertParent(selected);
107
+ // No file observation is cached. Preserve the resolver's symlink errors.
108
+ if (!create && fs.lstatSync(input.absolutePath, { throwIfNoEntry: false })?.isSymbolicLink()) {
109
+ admitUncachedCopyPath(input, create);
110
+ throw new FsSafeError("symlink", "symlink not allowed");
111
+ }
112
+ };
113
+ assertCurrent();
114
+ return { path: input.absolutePath, parent: selected.parent, assertCurrent, rootCanonicalPath: selected.root.realPath };
115
+ };
116
+ return { admit, clear() { roots.clear(); parents.clear(); directories.clear(); } };
117
+ }
@@ -1,9 +1,6 @@
1
+ import { type CopyPath } from "./copy-path-admission.js";
1
2
  import { type CopyCloneMode } from "./copy-policy.js";
2
3
  import { type OwnedFileDescriptorSync } from "./create-owned-file.js";
3
- type CopyPath = {
4
- rootPath: string;
5
- absolutePath: string;
6
- };
7
4
  export type CopyRootFileSyncOptions = {
8
5
  source: CopyPath;
9
6
  destination: CopyPath;
@@ -32,4 +29,10 @@ export type CopiedRootFileSync = OwnedFileDescriptorSync & Readonly<{
32
29
  }>;
33
30
  /** Exclusively copies an admitted source and transfers the owned destination fd. */
34
31
  export declare function copyRootFileSync(options: CopyRootFileSyncOptions): CopiedRootFileSync;
35
- export {};
32
+ export type RootFileCopyBatchSync = {
33
+ copyFile(options: CopyRootFileSyncOptions): CopiedRootFileSync;
34
+ close(): void;
35
+ [Symbol.dispose](): void;
36
+ };
37
+ /** Reuses directory admissions while retaining fresh checks for every copy. */
38
+ export declare function createRootFileCopyBatchSync(): RootFileCopyBatchSync;
@@ -1,19 +1,17 @@
1
1
  import fs, {} from "node:fs";
2
2
  import path from "node:path";
3
3
  import { normalizeMaxBytes } from "./byte-budget.js";
4
+ import { createCopyPathAdmissionCache } from "./copy-path-admission.js";
4
5
  import { resolveCopyCloneMode } from "./copy-policy.js";
5
6
  import { createFileWithAdmissionSync } from "./create.js";
6
7
  import { ownFileDescriptorSync } from "./create-owned-file.js";
7
8
  import { creationAdmissionFromParent, removeRecordedCreationFileSync } from "./creation-boundary.js";
8
- import { assertSyncDirectoryGuard, captureDirectoryGuard } from "./directory-guard.js";
9
9
  import { FsSafeError } from "./errors.js";
10
10
  import { assertExclusiveCreateLeaf } from "./exclusive-create.js";
11
11
  import { copyFileDescriptorSync } from "./file-handle-transfer.js";
12
12
  import { captureNativeFdClose } from "./native-binding.js";
13
13
  import { getNativeBinding } from "./native.js";
14
- import { realpathSync } from "./realpath.js";
15
14
  import { openRootFileSync } from "./root-file.js";
16
- import { resolveRootPathSync, ROOT_PATH_ALIAS_POLICIES } from "./root-path.js";
17
15
  import { inspectOpenedPathIdentitySync } from "./root-read-admission.js";
18
16
  import { openStagedDirectory } from "./staged-directory.js";
19
17
  import { inspectFileIdentitySync } from "./strict-file-identity.js";
@@ -26,42 +24,26 @@ function copyError(error) {
26
24
  ["ENOTSUP", "EOPNOTSUPP", "ENOSYS", "EXDEV", "EINVAL"].includes(code ?? "")
27
25
  ? "unsupported-platform" : "helper-failed", "guarded synchronous file copy failed", { cause: error });
28
26
  }
29
- function admitCopyPath(input, create = false) {
30
- if (!path.isAbsolute(input.rootPath) || !path.isAbsolute(input.absolutePath)) {
31
- throw new FsSafeError("invalid-path", "copy roots and paths must be absolute");
32
- }
33
- const root = captureDirectoryGuard(realpathSync(input.rootPath), "native", { bigint: true });
34
- const resolve = () => {
35
- const parent = create ? resolveRootPathSync({
36
- ...input, absolutePath: path.dirname(input.absolutePath), boundaryLabel: "copy parent",
37
- rejectSymlinks: true, rejectFinalSymlink: true,
38
- }) : undefined;
39
- const selected = resolveRootPathSync({
40
- ...input, boundaryLabel: "copy", rejectSymlinks: !create, rejectFinalSymlink: !create,
41
- policy: create ? ROOT_PATH_ALIAS_POLICIES.unlinkTarget : undefined,
42
- });
43
- if (parent && path.dirname(selected.canonicalPath) !== parent.canonicalPath) {
44
- throw new FsSafeError("path-mismatch", "copy destination parent changed");
45
- }
46
- return selected;
47
- };
48
- const selected = resolve();
49
- const parent = captureDirectoryGuard(path.dirname(selected.canonicalPath), "native", { bigint: true });
50
- const assertCurrent = () => {
51
- assertSyncDirectoryGuard(root);
52
- assertSyncDirectoryGuard(parent);
53
- const current = resolve();
54
- if (current.rootCanonicalPath !== root.realPath || current.canonicalPath !== selected.canonicalPath) {
55
- throw new FsSafeError("path-mismatch", "copy path changed during operation");
56
- }
57
- assertSyncDirectoryGuard(root);
58
- assertSyncDirectoryGuard(parent);
59
- };
60
- assertCurrent();
61
- return { path: selected.canonicalPath, parent, assertCurrent };
62
- }
63
27
  /** Exclusively copies an admitted source and transfers the owned destination fd. */
64
28
  export function copyRootFileSync(options) {
29
+ return copyRootFileWithAdmissionSync(options, createCopyPathAdmissionCache());
30
+ }
31
+ /** Reuses directory admissions while retaining fresh checks for every copy. */
32
+ export function createRootFileCopyBatchSync() {
33
+ const cache = createCopyPathAdmissionCache();
34
+ let closed = false;
35
+ const close = () => { closed = true; cache.clear(); };
36
+ return Object.freeze({
37
+ copyFile(options) {
38
+ if (closed)
39
+ throw new FsSafeError("invalid-path", "copy batch is closed");
40
+ return copyRootFileWithAdmissionSync(options, cache);
41
+ },
42
+ close,
43
+ [Symbol.dispose]: close,
44
+ });
45
+ }
46
+ function copyRootFileWithAdmissionSync(options, cache) {
65
47
  // Snapshot caller options before the first filesystem observation.
66
48
  const sourceInput = options.source;
67
49
  const sourcePath = { rootPath: sourceInput.rootPath, absolutePath: sourceInput.absolutePath };
@@ -89,17 +71,16 @@ export function copyRootFileSync(options) {
89
71
  const native = getNativeBinding();
90
72
  const nativeCopy = process.platform !== "win32" && native?.copyFileExclusiveSync && native.removeStagedFile
91
73
  ? native.copyFileExclusiveSync.bind(native) : undefined;
92
- let nativeTarget = false;
93
74
  try {
94
- const source = admitCopyPath(sourcePath);
95
- target = admitCopyPath(targetPath, true);
75
+ const source = cache.admit(sourcePath);
76
+ target = cache.admit(targetPath, true);
96
77
  // Preserve exclusive-create collision semantics for dangling Windows leaves.
97
78
  assertExclusiveCreateLeaf(targetPath.absolutePath);
98
79
  if (fs.lstatSync(target.path, { throwIfNoEntry: false })) {
99
80
  throw new FsSafeError("already-exists", "copy destination already exists");
100
81
  }
101
82
  const opened = openRootFileSync({
102
- ...sourcePath, boundaryLabel: "copy source", maxBytes,
83
+ ...sourcePath, rootRealPath: source.rootCanonicalPath, boundaryLabel: "copy source", maxBytes,
103
84
  rejectHardlinks: sourceHardlinks !== "allow",
104
85
  });
105
86
  if (!opened.ok)
@@ -121,7 +102,6 @@ export function copyRootFileSync(options) {
121
102
  }
122
103
  };
123
104
  const selectedMode = mode ?? (preserveSourceMode ? Number(sourceIdentity.mode & 511n) : 0o600 & ~process.umask());
124
- let method = "copy";
125
105
  let copied;
126
106
  verifySource();
127
107
  target.assertCurrent();
@@ -134,7 +114,6 @@ export function copyRootFileSync(options) {
134
114
  target.assertCurrent();
135
115
  copied = nativeCopy(opened.fd, parent.fd, path.basename(target.path), clone, maxBytes !== undefined && Number.isFinite(maxBytes) ? maxBytes : undefined);
136
116
  targetOwner = ownFileDescriptorSync(copied.fd, closeNative);
137
- nativeTarget = true;
138
117
  }
139
118
  else {
140
119
  if (clone === "always")
@@ -155,13 +134,11 @@ export function copyRootFileSync(options) {
155
134
  if (copied?.errorCode) {
156
135
  throw copyError(Object.assign(new Error(copied.errorMessage), { code: copied.errorCode }));
157
136
  }
158
- if (copied) {
159
- if (!["clone", "copy-file-range", "copy"].includes(copied.method)) {
160
- throw new FsSafeError("helper-failed", "native copy returned an unknown method");
161
- }
162
- method = copied.method;
137
+ const method = copied ? copied.method : "copy";
138
+ if (method !== "clone" && method !== "copy-file-range" && method !== "copy") {
139
+ throw new FsSafeError("helper-failed", "native copy returned an unknown method");
163
140
  }
164
- else {
141
+ if (!copied) {
165
142
  copyFileDescriptorSync(opened.fd, targetOwner.fd, { maxBytes });
166
143
  }
167
144
  verifySource();
@@ -186,7 +163,7 @@ export function copyRootFileSync(options) {
186
163
  const cleanup = [];
187
164
  if (targetOwner && target) {
188
165
  try {
189
- if (nativeTarget && parentOpen) {
166
+ if (parentOpen) {
190
167
  const removed = native.removeStagedFile(parentOwner.fd, path.basename(target.path), targetOwner.fd);
191
168
  if (removed === "preserved")
192
169
  throw new FsSafeError("path-mismatch", "copy cleanup preserved a replacement");
@@ -1,3 +1,6 @@
1
1
  import type { FileLockSyncAcquireOptions, FileLockSyncHandle } from "./file-lock-sync.js";
2
2
  import type { Root } from "./root-impl.js";
3
+ import { type FileLockSyncRootPath } from "./file-lock-sync-root.js";
4
+ import { type FileLockSyncRootFileReceipt } from "./file-lock-sync-root-io.js";
5
+ export declare function cleanupCreatedRootSyncLock(lockRootPath: FileLockSyncRootPath, fd: number, receipt: FileLockSyncRootFileReceipt, timer?: NodeJS.Timeout): void;
3
6
  export declare function acquireFileLockSyncWithRoot<TPayload extends Record<string, unknown>>(targetPath: string, inputOptions: FileLockSyncAcquireOptions<TPayload>, lockRoot: Root): FileLockSyncHandle;