@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
@@ -46,7 +46,7 @@ function snapshotFromExactObservation(dir, uid, realPath, stat, privateDirectory
46
46
  if (stat.symbolicLink || !stat.directory) {
47
47
  throw new FsSafeError("not-file", "temp workspace root component must be a real directory");
48
48
  }
49
- assertTrustedTempWorkspaceDirectory(stat, uid, privateDirectory);
49
+ assertTrustedTempWorkspaceDirectory(stat, uid, privateDirectory, dir);
50
50
  const identity = Object.freeze({ dev: stat.dev, ino: stat.ino });
51
51
  // Retain copied immutable scalars, never a mutable Stats object supplied by
52
52
  // an observation hook. Every later permission check uses a fresh snapshot.
@@ -106,7 +106,7 @@ function inspectSnapshotIdentity(entry) {
106
106
  }
107
107
  function assertSnapshot(entry, uid) {
108
108
  const stat = inspectSnapshotIdentity(entry);
109
- assertTrustedTempWorkspaceDirectory(stat, uid, entry.privateDirectory);
109
+ assertTrustedTempWorkspaceDirectory(stat, uid, entry.privateDirectory, entry.dir);
110
110
  assertCanonicalRoot(entry);
111
111
  }
112
112
  function snapshotMissingRootComponent(parent, dir, ownerUid, privateDirectory) {
@@ -115,7 +115,7 @@ function snapshotMissingRootComponent(parent, dir, ownerUid, privateDirectory) {
115
115
  return snapshot(dir, ownerUid, undefined, privateDirectory);
116
116
  }
117
117
  const current = inspectSnapshotIdentity(parent);
118
- assertTrustedTempWorkspaceDirectory(current, ownerUid, parent.privateDirectory);
118
+ assertTrustedTempWorkspaceDirectory(current, ownerUid, parent.privateDirectory, parent.dir);
119
119
  let realPath;
120
120
  try {
121
121
  realPath = canonicalTempWorkspacePath(dir);
@@ -136,7 +136,7 @@ function snapshotMissingRootComponent(parent, dir, ownerUid, privateDirectory) {
136
136
  function assertChain(chain, uid) {
137
137
  for (const entry of chain) {
138
138
  const current = inspectSnapshotIdentity(entry);
139
- assertTrustedTempWorkspaceDirectory(current, uid, entry.privateDirectory);
139
+ assertTrustedTempWorkspaceDirectory(current, uid, entry.privateDirectory, entry.dir);
140
140
  }
141
141
  const last = chain[chain.length - 1];
142
142
  assertCanonicalRoot(last);
@@ -159,7 +159,7 @@ function associateTempWorkspaceRoot(entry, ownerUid, descriptorFd) {
159
159
  if (stat.isSymbolicLink() || !stat.isDirectory()) {
160
160
  throw new FsSafeError("not-file", "temp workspace cleanup parent must be a real directory");
161
161
  }
162
- assertTrustedTempWorkspaceDirectory(stat, ownerUid, entry.privateDirectory);
162
+ assertTrustedTempWorkspaceDirectory(stat, ownerUid, entry.privateDirectory, entry.dir);
163
163
  }
164
164
  function discoverMissingTempWorkspaceAncestor(ancestor, missing, missingError) {
165
165
  // The caller already classified the first ENOENT. Keep this handoff out of
@@ -290,7 +290,7 @@ function canonicalRootAdmission(discovery, ownerUid) {
290
290
  return snapshot(dir, ownerUid, dir, index === ancestry.length - 1 && discovery.privateDirectory).entry;
291
291
  }
292
292
  const current = inspectSnapshotIdentity(discovery);
293
- assertTrustedTempWorkspaceDirectory(current, ownerUid, discovery.privateDirectory);
293
+ assertTrustedTempWorkspaceDirectory(current, ownerUid, discovery.privateDirectory, discovery.dir);
294
294
  return discovery;
295
295
  });
296
296
  const current = candidate[candidate.length - 1];
@@ -14,10 +14,10 @@ export declare function projectTempWorkspaceNumericIdentity(identity: TempWorksp
14
14
  export declare function inspectTempWorkspaceDescriptorIdentitySync(fd: number, expected: TempWorkspaceIdentity, numeric: TempWorkspaceNumericIdentity | undefined): TempWorkspaceIdentityStat;
15
15
  export declare function inspectTempWorkspaceDirectoryIdentitySync(dir: string, expected: TempWorkspaceIdentity, numeric: TempWorkspaceNumericIdentity | undefined): TempWorkspaceIdentityStat;
16
16
  export declare function validateTempWorkspaceDirMode(mode: number): void;
17
- export declare function assertTrustedTempWorkspaceDirectory(stat: Pick<BigIntStats, "uid" | "gid" | "mode"> | Pick<Stats, "uid" | "gid" | "mode">, uid: number | undefined, privateDirectory?: boolean): void;
18
- export declare function assertTempWorkspaceChildState(stat: BigIntStats | Stats, ownerUid: number | undefined): void;
19
- export declare function validateInitialTempWorkspaceChild(stat: BigIntStats, ownerUid: number | undefined, mode: number): boolean;
17
+ export declare function assertTrustedTempWorkspaceDirectory(stat: Pick<BigIntStats, "uid" | "gid" | "mode"> | Pick<Stats, "uid" | "gid" | "mode">, uid: number | undefined, privateDirectory: boolean, dir: string): void;
18
+ export declare function assertTempWorkspaceChildState(stat: BigIntStats | Stats, ownerUid: number | undefined, dir: string): void;
19
+ export declare function validateInitialTempWorkspaceChild(stat: BigIntStats, ownerUid: number | undefined, mode: number, dir: string): boolean;
20
20
  export declare function childHasRequestedMode(stat: BigIntStats | Stats, mode: number): boolean;
21
21
  export declare function admitTempWorkspaceChild(dir: string, expected: BigIntStats, parent: TempWorkspaceRootAdmission, mode: number): Promise<void> | undefined;
22
22
  export declare function admitTempWorkspaceChildSync(dir: string, expected: BigIntStats, parent: TempWorkspaceRootAdmission, mode: number): void;
23
- export declare function validateAdmittedTempWorkspaceChild(current: TempWorkspaceIdentityStat, ownerUid: number | undefined, mode: number): void;
23
+ export declare function validateAdmittedTempWorkspaceChild(current: TempWorkspaceIdentityStat, ownerUid: number | undefined, mode: number, dir: string): void;
@@ -4,6 +4,7 @@ import { pinNodeDirectoryForMode, pinNodeDirectoryForModeSync } from "./director
4
4
  import { FsSafeError } from "./errors.js";
5
5
  import { fileIdentityMismatchError, inspectFileIdentitySync } from "./strict-file-identity.js";
6
6
  import { classifyTempWorkspaceOwner, warnUnmappedTempWorkspaceAncestor } from "./temp-workspace-ownership.js";
7
+ import { privateTempDirectoryFix, tempDirectoryMode } from "./temp-directory-diagnostics.js";
7
8
  export const TEMP_WORKSPACE_NUMERIC_IDENTITY_REPLAY = process.platform === "linux" || process.platform === "darwin";
8
9
  export function projectTempWorkspaceNumericIdentity(identity) {
9
10
  const dev = Number(identity.dev);
@@ -43,12 +44,12 @@ export function validateTempWorkspaceDirMode(mode) {
43
44
  throw new FsSafeError("insecure-permissions", "temp workspace must not be group/world writable");
44
45
  }
45
46
  }
46
- export function assertTrustedTempWorkspaceDirectory(stat, uid, privateDirectory = false) {
47
+ export function assertTrustedTempWorkspaceDirectory(stat, uid, privateDirectory, dir) {
47
48
  if (uid === undefined)
48
49
  return;
49
50
  const ownership = classifyTempWorkspaceOwner(stat, uid);
50
51
  if (ownership === "foreign" || (privateDirectory && ownership !== "user")) {
51
- throw new FsSafeError("not-owned", "temp workspace directory has an untrusted owner; use a private temp root owned by the effective user under a trusted directory hierarchy");
52
+ throw new FsSafeError("not-owned", `temp workspace directory ${JSON.stringify(dir)} has an untrusted owner uid ${stat.uid}; expected uid ${uid}${privateDirectory || uid === 0 ? "" : " or root uid 0"}; ${privateTempDirectoryFix(uid)}`);
52
53
  }
53
54
  // Unmapped host owners are unverifiable; trust the host directory hierarchy.
54
55
  // Admit sticky ancestors so PrivateUsers keeps host /tmp and PrivateTmp usable.
@@ -60,18 +61,18 @@ export function assertTrustedTempWorkspaceDirectory(stat, uid, privateDirectory
60
61
  ? (stat.mode & 512n) !== 0n
61
62
  : Number.isSafeInteger(stat.mode) && stat.mode >= 0 && (stat.mode & 0o1000) !== 0;
62
63
  if (typeof stat.mode !== "bigint" && (!Number.isSafeInteger(stat.mode) || stat.mode < 0)) {
63
- throw new FsSafeError("insecure-permissions", "temp workspace directory permissions are invalid");
64
+ throw new FsSafeError("insecure-permissions", `temp workspace directory ${JSON.stringify(dir)} permissions are invalid; ${privateTempDirectoryFix(uid)}`);
64
65
  }
65
66
  if (writable && (privateDirectory || !sticky)) {
66
67
  throw new FsSafeError("insecure-permissions", privateDirectory
67
- ? "temp workspace root and child must not be group/world writable; use a private temp directory"
68
- : "temp workspace ancestor is group/world writable without sticky protection");
68
+ ? `temp workspace directory ${JSON.stringify(dir)} has group/world-writable mode ${tempDirectoryMode(stat.mode)}; root and child must not be group/world writable, even with the sticky bit; ${privateTempDirectoryFix(uid)}`
69
+ : `temp workspace ancestor ${JSON.stringify(dir)} has group/world-writable mode ${tempDirectoryMode(stat.mode)} without sticky protection (sticky bit missing); have its administrator restore safe permissions (1777 for a shared system temp directory), or move the private root under trusted ancestors`);
69
70
  }
70
71
  if (ownership === "unmapped")
71
72
  warnUnmappedTempWorkspaceAncestor();
72
73
  }
73
74
  const WINDOWS = process.platform === "win32";
74
- export function assertTempWorkspaceChildState(stat, ownerUid) {
75
+ export function assertTempWorkspaceChildState(stat, ownerUid, dir) {
75
76
  const exactIdentity = typeof stat.dev === "bigint" && typeof stat.ino === "bigint" &&
76
77
  (!WINDOWS || (stat.dev !== 0n && stat.ino !== 0n));
77
78
  const safeNumericIdentity = TEMP_WORKSPACE_NUMERIC_IDENTITY_REPLAY &&
@@ -81,12 +82,12 @@ export function assertTempWorkspaceChildState(stat, ownerUid) {
81
82
  throw new FsSafeError("path-mismatch", "temp workspace child identity could not be verified");
82
83
  }
83
84
  if (stat.isSymbolicLink() || !stat.isDirectory()) {
84
- throw new FsSafeError("not-file", "temp workspace child must be a real directory");
85
+ throw new FsSafeError("not-file", `temp workspace child ${JSON.stringify(dir)} ${stat.isSymbolicLink() ? "is a symbolic link" : "is not a directory"}; ${privateTempDirectoryFix(ownerUid)}`);
85
86
  }
86
- assertTrustedTempWorkspaceDirectory(stat, ownerUid, true);
87
+ assertTrustedTempWorkspaceDirectory(stat, ownerUid, true, dir);
87
88
  }
88
- export function validateInitialTempWorkspaceChild(stat, ownerUid, mode) {
89
- assertTempWorkspaceChildState(stat, ownerUid);
89
+ export function validateInitialTempWorkspaceChild(stat, ownerUid, mode, dir) {
90
+ assertTempWorkspaceChildState(stat, ownerUid, dir);
90
91
  return !childHasRequestedMode(stat, mode);
91
92
  }
92
93
  export function childHasRequestedMode(stat, mode) {
@@ -105,7 +106,7 @@ async function initializeTempWorkspaceChildMode(dir, expected, parent, mode) {
105
106
  try {
106
107
  await owner.apply(mode, { check: parent.assertCurrent });
107
108
  const current = inspectDirectoryIdentitySync(dir, expected);
108
- validateAdmittedTempWorkspaceChild(current, parent.ownerUid, mode);
109
+ validateAdmittedTempWorkspaceChild(current, parent.ownerUid, mode, dir);
109
110
  parent.assertCurrent();
110
111
  }
111
112
  finally {
@@ -113,12 +114,12 @@ async function initializeTempWorkspaceChildMode(dir, expected, parent, mode) {
113
114
  }
114
115
  }
115
116
  export function admitTempWorkspaceChild(dir, expected, parent, mode) {
116
- if (!validateInitialTempWorkspaceChild(expected, parent.ownerUid, mode))
117
+ if (!validateInitialTempWorkspaceChild(expected, parent.ownerUid, mode, dir))
117
118
  return undefined;
118
119
  return initializeTempWorkspaceChildMode(dir, expected, parent, mode);
119
120
  }
120
121
  export function admitTempWorkspaceChildSync(dir, expected, parent, mode) {
121
- if (!validateInitialTempWorkspaceChild(expected, parent.ownerUid, mode))
122
+ if (!validateInitialTempWorkspaceChild(expected, parent.ownerUid, mode, dir))
122
123
  return;
123
124
  parent.assertCurrent();
124
125
  const owner = pinNodeDirectoryForModeSync(dir, {
@@ -128,15 +129,15 @@ export function admitTempWorkspaceChildSync(dir, expected, parent, mode) {
128
129
  try {
129
130
  owner.apply(mode, parent.assertCurrent);
130
131
  const current = inspectDirectoryIdentitySync(dir, expected);
131
- validateAdmittedTempWorkspaceChild(current, parent.ownerUid, mode);
132
+ validateAdmittedTempWorkspaceChild(current, parent.ownerUid, mode, dir);
132
133
  parent.assertCurrent();
133
134
  }
134
135
  finally {
135
136
  owner.close();
136
137
  }
137
138
  }
138
- export function validateAdmittedTempWorkspaceChild(current, ownerUid, mode) {
139
- assertTempWorkspaceChildState(current, ownerUid);
139
+ export function validateAdmittedTempWorkspaceChild(current, ownerUid, mode, dir) {
140
+ assertTempWorkspaceChildState(current, ownerUid, dir);
140
141
  if (!childHasRequestedMode(current, mode)) {
141
142
  throw new FsSafeError("path-mismatch", "temp workspace final mode could not be verified");
142
143
  }
@@ -133,9 +133,8 @@ export class TempWorkspaceRetainedChild {
133
133
  // the synchronous caller validates it and decides whether to correct.
134
134
  const stat = fsSync.fstatSync(descriptor.fd, { bigint: true });
135
135
  Object.freeze(stat);
136
- const receipt = Object.freeze({ stat });
137
136
  return {
138
- retained: new TempWorkspaceRetainedChild(dir, stat, descriptor, receipt),
137
+ retained: new TempWorkspaceRetainedChild(dir, stat, descriptor, stat),
139
138
  stat,
140
139
  };
141
140
  }
@@ -151,23 +150,27 @@ export class TempWorkspaceRetainedChild {
151
150
  // Clear first so validation failures, procfs checks, and later admission
152
151
  // can never reuse the creation observation.
153
152
  this.#initialReceipt = undefined;
154
- return receipt?.stat;
153
+ return receipt;
155
154
  }
156
155
  finalizeAdmission(ownerUid, mode) {
157
156
  this.#assertModeLeaseReleased();
158
157
  this.discardInitialReceipt();
159
- if (this.#fd === undefined) {
160
- throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
161
- }
158
+ const fd = this.#requireDescriptor();
162
159
  // A failed revalidation must never leave an earlier receipt transferable.
163
160
  this.#transferAuthorized = false;
164
- const current = inspectTempWorkspaceDescriptorIdentitySync(this.#fd, this.#identity, this.#numericIdentity);
165
- validateAdmittedTempWorkspaceChild(current, ownerUid, mode);
161
+ const current = inspectTempWorkspaceDescriptorIdentitySync(fd, this.#identity, this.#numericIdentity);
162
+ validateAdmittedTempWorkspaceChild(current, ownerUid, mode, this.#dir);
166
163
  const named = inspectTempWorkspaceDirectoryIdentitySync(this.#dir, this.#identity, this.#numericIdentity);
167
- validateAdmittedTempWorkspaceChild(named, ownerUid, mode);
164
+ validateAdmittedTempWorkspaceChild(named, ownerUid, mode, this.#dir);
168
165
  this.#transferAuthorized = true;
169
166
  return named;
170
167
  }
168
+ #requireDescriptor() {
169
+ if (this.#fd === undefined) {
170
+ throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
171
+ }
172
+ return this.#fd;
173
+ }
171
174
  #assertModeLeaseReleased() {
172
175
  if (this.#modeLease) {
173
176
  throw new FsSafeError("path-mismatch", "temp workspace child mode operation is active");
@@ -175,9 +178,9 @@ export class TempWorkspaceRetainedChild {
175
178
  }
176
179
  #inspectModeTarget(fd, ownerUid, initial) {
177
180
  const descriptor = initial ?? inspectTempWorkspaceDescriptorIdentitySync(fd, this.#identity, this.#numericIdentity);
178
- assertTempWorkspaceChildState(descriptor, ownerUid);
181
+ assertTempWorkspaceChildState(descriptor, ownerUid, this.#dir);
179
182
  const named = inspectTempWorkspaceDirectoryIdentitySync(this.#dir, this.#identity, this.#numericIdentity);
180
- assertTempWorkspaceChildState(named, ownerUid);
183
+ assertTempWorkspaceChildState(named, ownerUid, this.#dir);
181
184
  return descriptor;
182
185
  }
183
186
  async #assertProcAuthority(fd, ownerUid) {
@@ -196,16 +199,13 @@ export class TempWorkspaceRetainedChild {
196
199
  const opened = inspectFileIdentitySync(() => fsSync.fstatSync(fd, { bigint: true }), this.#identity);
197
200
  const followed = inspectFileIdentitySync(() => fsSync.statSync(procPath, { bigint: true }), this.#identity);
198
201
  assertOwnedDirectory(opened, followed);
199
- assertTempWorkspaceChildState(opened, ownerUid);
200
- assertTempWorkspaceChildState(followed, ownerUid);
202
+ assertTempWorkspaceChildState(opened, ownerUid, this.#dir);
203
+ assertTempWorkspaceChildState(followed, ownerUid, this.#dir);
201
204
  }
202
205
  async initializeMode(mode, ownerUid, assertParent) {
203
206
  this.#assertModeLeaseReleased();
204
207
  this.discardInitialReceipt();
205
- if (this.#fd === undefined) {
206
- throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
207
- }
208
- const fd = this.#fd;
208
+ const fd = this.#requireDescriptor();
209
209
  this.#transferAuthorized = false;
210
210
  this.#modeLease = true;
211
211
  try {
@@ -238,10 +238,7 @@ export class TempWorkspaceRetainedChild {
238
238
  }
239
239
  initializeModeSync(mode, ownerUid, assertParent) {
240
240
  this.#assertModeLeaseReleased();
241
- if (this.#fd === undefined) {
242
- throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
243
- }
244
- const fd = this.#fd;
241
+ const fd = this.#requireDescriptor();
245
242
  this.#transferAuthorized = false;
246
243
  this.#modeLease = true;
247
244
  try {
@@ -270,9 +267,7 @@ export class TempWorkspaceRetainedChild {
270
267
  this.discardInitialReceipt();
271
268
  if (this.canEnumerate)
272
269
  return true;
273
- if (this.#fd === undefined) {
274
- throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
275
- }
270
+ this.#requireDescriptor();
276
271
  // Opening or validating a replacement crosses a new pathname boundary.
277
272
  // Even failure must revoke any earlier final-admission receipt.
278
273
  this.#transferAuthorized = false;
@@ -312,13 +307,10 @@ export class TempWorkspaceRetainedChild {
312
307
  transfer(retainDescriptor) {
313
308
  this.#assertModeLeaseReleased();
314
309
  this.discardInitialReceipt();
315
- if (this.#fd === undefined) {
316
- throw new FsSafeError("path-mismatch", "temp workspace child descriptor is unavailable");
317
- }
310
+ const fd = this.#requireDescriptor();
318
311
  if (!this.#transferAuthorized) {
319
312
  throw new FsSafeError("path-mismatch", "temp workspace child has not completed final admission");
320
313
  }
321
- const fd = this.#fd;
322
314
  this.#fd = undefined;
323
315
  if (retainDescriptor && !this.canEnumerate) {
324
316
  closeAfterAdmissionFailure(fd, new FsSafeError("helper-unavailable", "temp workspace cleanup requires a readable child descriptor"), "temp workspace child descriptor rejection and close failed");
@@ -32,17 +32,6 @@ function kindForDirent(dirent) {
32
32
  function shouldStop(result, options) {
33
33
  return options.maxEntries !== undefined && result.scannedEntryCount >= Math.max(0, options.maxEntries);
34
34
  }
35
- function buildEntry(params) {
36
- const fullPath = params.fullPath;
37
- return {
38
- name: params.dirent.name,
39
- path: fullPath,
40
- relativePath: params.relativePath,
41
- depth: params.depth,
42
- kind: params.kind,
43
- dirent: params.dirent,
44
- };
45
- }
46
35
  function recordFailedDir(result, root, dir, depth, error) {
47
36
  const relativePath = path.relative(root, dir);
48
37
  result.failedDirs.push({
@@ -138,7 +127,7 @@ export function walkDirectorySync(rootDir, options = {}) {
138
127
  if (!kind)
139
128
  continue;
140
129
  const relativePath = relativeDir ? `${relativeDir}${path.sep}${dirent.name}` : dirent.name;
141
- const entry = buildEntry({ relativePath, fullPath, dirent, depth, kind });
130
+ const entry = { name: dirent.name, path: fullPath, relativePath, depth, kind, dirent };
142
131
  if (options.include?.(entry) ?? true) {
143
132
  result.entries.push(entry);
144
133
  }
@@ -229,7 +218,7 @@ export async function walkDirectory(rootDir, options = {}) {
229
218
  if (!kind)
230
219
  continue;
231
220
  const relativePath = relativeDir ? `${relativeDir}${path.sep}${dirent.name}` : dirent.name;
232
- const entry = buildEntry({ relativePath, fullPath, dirent, depth, kind });
221
+ const entry = { name: dirent.name, path: fullPath, relativePath, depth, kind, dirent };
233
222
  const include = options.include;
234
223
  const included = include == null ? true : Reflect.apply(include, options, [entry]);
235
224
  if ((isObjectResult(included) ? await included : included) ?? true) {
@@ -1,7 +1,7 @@
1
1
  import { type NativeBinding } from "./native.js";
2
2
  import type { RootContext } from "./root-context.js";
3
3
  import type { DirectoryIdentity, WatchSnapshot } from "./watch-scan.js";
4
- import type { WatchStreamPaths } from "./watch-stream.js";
4
+ import type { WatchScope } from "./watch-types.js";
5
5
  export type NativeWatchHint = {
6
6
  directory: string;
7
7
  name: string;
@@ -50,6 +50,6 @@ export declare class NativeWatchBackend {
50
50
  add(name: string, identity: DirectoryIdentity): void;
51
51
  testEvent(path: string, flags: number): void;
52
52
  entries(snapshot: WatchSnapshot): boolean;
53
- configure(paths: WatchStreamPaths): boolean;
53
+ configure(snapshot: WatchSnapshot, scopes: readonly WatchScope[]): boolean;
54
54
  close(): void;
55
55
  }
@@ -1,6 +1,7 @@
1
1
  import { FsSafeError } from "./errors.js";
2
2
  import { getNativeBinding } from "./native.js";
3
3
  import { getFsSafeNativeConfig } from "./native-config.js";
4
+ import { watchStreamPaths } from "./watch-stream.js";
4
5
  export function watchBinding(mode) {
5
6
  if (mode === "poll")
6
7
  return;
@@ -61,9 +62,10 @@ export class NativeWatchBackend {
61
62
  throw watchError(cause);
62
63
  }
63
64
  }
64
- configure(paths) {
65
+ configure(snapshot, scopes) {
65
66
  if (process.platform !== "darwin")
66
67
  return false;
68
+ const paths = watchStreamPaths(snapshot, scopes);
67
69
  const key = JSON.stringify(paths);
68
70
  if (this.streamPaths === key)
69
71
  return false;
@@ -55,15 +55,9 @@ export function mergeWatchRescan(scopes, before, slice, requested) {
55
55
  for (const name of slice.childPaths?.get(directory)?.values() ?? [])
56
56
  selected.add(name);
57
57
  }
58
- for (const [name, previous] of before.entries) {
59
- if (!selected.has(name))
60
- continue;
61
- const current = slice.entries.get(name);
62
- if ((previous.startsWith("directory:") || current?.startsWith("directory:")) && identity(previous) !== identity(current))
63
- return;
64
- }
65
- for (const [name, current] of slice.entries) {
66
- if (selected.has(name) && current.startsWith("directory:") && identity(current) !== identity(before.entries.get(name)))
58
+ for (const name of selected) {
59
+ const previous = before.entries.get(name), current = slice.entries.get(name);
60
+ if ((previous?.startsWith("directory:") || current?.startsWith("directory:")) && identity(previous) !== identity(current))
67
61
  return;
68
62
  }
69
63
  // Exclusion changes can retire or admit a subtree, including callback-driven changes.
@@ -5,7 +5,6 @@ import { rootHandleContext } from "./root-handle-context.js";
5
5
  import { createSuppressedError } from "./suppressed-error.js";
6
6
  import { getFsSafeTestHooks } from "./test-hooks.js";
7
7
  import { mergeWatchRescan, watchRescanScopes } from "./watch-rescan.js";
8
- import { watchStreamPaths } from "./watch-stream.js";
9
8
  import { admittedNativeChanges, changedEntries, excludedWatchPath, guardedHintChanges, scopedChanges } from "./watch-hints.js";
10
9
  import path from "node:path";
11
10
  import { watchBinding, NativeWatchBackend } from "./watch-native.js";
@@ -338,7 +337,7 @@ export function watch(root, input) {
338
337
  }, maxPendingPaths, persistent);
339
338
  backend = candidate;
340
339
  if (snapshot)
341
- candidate.configure(watchStreamPaths(snapshot, g.scopes));
340
+ candidate.configure(snapshot, g.scopes);
342
341
  const hookResult = getFsSafeTestHooks()?.afterWatchBackendCreated?.(context.rootReal, batch => {
343
342
  if (backend === candidate)
344
343
  onHint(g, batch);
@@ -401,7 +400,7 @@ export function watch(root, input) {
401
400
  }
402
401
  try {
403
402
  const entriesChanged = backend?.entries(next);
404
- const streamsChanged = backend?.configure(watchStreamPaths(next, g.scopes));
403
+ const streamsChanged = backend?.configure(next, g.scopes);
405
404
  if (entriesChanged || streamsChanged) {
406
405
  // Complete a guarded pass with the new transport before publishing readiness.
407
406
  // Bound handovers under churn; later passes still reconcile ongoing changes.
@@ -82,7 +82,7 @@ concurrent namespace changes.
82
82
  | `appendRegularFile`, `appendRegularFileSync`, `readRegularFile`, `readRegularFileSync`, `statRegularFile`, `statRegularFileSync`, `resolveRegularFileAppendFlags`, `AppendRegularFileOptions`, `RegularFileStatResult` | [regular-file.md](regular-file.md) | Type-checked regular-file I/O. |
83
83
  | `retainEntryForPublication`, `RetainedEntryPublication`, `RetainEntryForPublicationOptions`, `EntryPublicationReceipt`, `EntryPublicationResult`, `EntryPublicationIssue`, `PublicationIdentity`, `PublicationParent` | [One-way entry publication](entry-publication.md) | Native no-replace directory/regular-file/symlink export, including Windows NTFS junctions, under caller-exclusive namespace; explicit transition receipts, close-only disposal, no source CAS. |
84
84
  | `retainFileInDirectory`, `RetainedFile`, related receipt/result types | [Retained Windows files](retained-file.md) | Existing-file native handle custody and explicit removal; local NTFS, producer authority required, no persistence guarantee. |
85
- | `copyRootFileSync`, `CopyRootFileSyncOptions`, `CopiedRootFileSync` | [copy.md](copy.md#synchronous-guarded-file-copies) | Synchronous guarded exclusive file copy, optionally cloned and bound to an expected source identity, returning an owned destination descriptor and both identities. |
85
+ | `copyRootFileSync`, `createRootFileCopyBatchSync`, `RootFileCopyBatchSync`, `CopyRootFileSyncOptions`, `CopiedRootFileSync` | [copy.md](copy.md#synchronous-guarded-file-copies) | Synchronous guarded exclusive file copy, optionally cloned and bound to an expected source identity, returning an owned destination descriptor and both identities. |
86
86
  | `sameFileIdentity`, `FileIdentityStat` | – | Compare two stats for same-inode equality. |
87
87
  | `readDirectoryIdentity`, `assertDirectoryIdentitySync`, `DirectoryIdentity` | [directory-identity.md](directory-identity.md) | Observe exact bigint directory identity and synchronously check a caller-selected path, optionally retaining its canonical path. |
88
88
  | `pathExists`, `pathExistsSync` | – | Boolean existence check that does not throw on `ENOENT`. |
@@ -702,6 +702,9 @@ await extractArchive({
702
702
 
703
703
  ## `readArchiveEntry`
704
704
 
705
+ The byte limit is selected and validated once before reading the archive; changing
706
+ the options object during a read does not change the active limit.
707
+
705
708
  `readArchiveEntry(archivePath, entryPath, { maxBytes, kind? })` reads one
706
709
  regular-file entry into a bounded `Buffer` without extracting a tree. It reads
707
710
  the input through an identity-checked descriptor, rejects a requested link or
@@ -16,6 +16,11 @@ import {
16
16
 
17
17
  Write `content` to a sibling temp file in the destination directory, apply the parent-directory and final file modes through verified descriptors, optionally `fsync` the file descriptor, optionally `fsync` the parent directory after rename, then atomically rename over the destination. No permission change follows a caller-supplied pathname.
18
18
 
19
+ On POSIX, non-durable asynchronous writes using Node inspect the staged file's
20
+ complete permission bits with their final identity check and skip a redundant
21
+ mode change when they already match. A restrictive umask or differing special
22
+ bits still require descriptor mode correction before publication.
23
+
19
24
  On POSIX, the parent is opened with no-follow and directory-only flags, checked against its exact pre-open device/inode identity, and mode-adjusted through that descriptor. A replacement symlink is rejected rather than followed. If the directory cannot be opened for descriptor access, the operation fails closed instead of retrying by pathname. Windows does not enforce POSIX directory modes and Node cannot consistently open directory descriptors there, so `dirMode` is passed only to `mkdir`; no pathname `chmod` fallback is attempted.
20
25
 
21
26
  Async replacements to the same destination are serialized inside the current process, so two overlapping `replaceFileAtomic()` calls do not interleave their temp-write/rename phases. Use a sidecar lock when multiple processes may write the same target.
@@ -258,7 +263,9 @@ opened, removed, or replaced. A successor at that name is left untouched.
258
263
  `details.cleanup: "restored"` means the retained original file's bytes and mode
259
264
  were restored and synchronized, not that the pathname still names it. The existing
260
265
  `writing` receipt identifies that file; no `published` receipt is emitted for a
261
- failed replacement. Restoration I/O failures report `"restore-failed"`.
266
+ failed replacement. Restoration I/O failures report `"restore-failed"`, even if
267
+ the thrown error itself carries a `cleanup: "restored"` receipt from another
268
+ operation; the cause retains both the replacement and restoration failures.
262
269
 
263
270
  Callback refusals, detected identity/type/link changes, and other metadata errors
264
271
  remain terminal. Failed descriptor revalidation also stops restoration. These
@@ -539,8 +546,9 @@ remain a best-effort sequence, not atomic.
539
546
  `onDestinationPublished` runs exactly once after a successful rename resolves,
540
547
  before awaited post-rename directory checks or source cleanup. It receives a
541
548
  frozen receipt with the resolved absolute destination path and the exact bigint
542
- device/inode identity observed on the rename source before dispatch: the
543
- original source for a direct rename, or the staged copy for fallback. Failed
549
+ device/inode identity observed on the rename source after the synchronous
550
+ authority callbacks return and before dispatch: the source selected for a direct
551
+ rename, or the staged copy for fallback. Failed
544
552
  rename attempts never emit receipts. The return contract remains `Promise<void>`.
545
553
 
546
554
  The receipt records an observed identity, not authorization, durable storage,
@@ -175,7 +175,7 @@ temporary storage; session scratch trees may suppress macOS filesystem events.
175
175
  ### Optional Linux Testbox
176
176
 
177
177
  The manual `testbox-validation.yml` workflow prepares a 16-vCPU Ubuntu 24.04
178
- Blacksmith Testbox with Node 24.21.0, pnpm 12.4.2, dependencies, the Rust WASM
178
+ Blacksmith Testbox with Node 24.21.0, pnpm 12.10.1, dependencies, the Rust WASM
179
179
  target, and the pinned portable archive compiler. It leaves library builds and
180
180
  validation commands to the caller and does not replace required CI checks.
181
181
 
@@ -257,3 +257,51 @@ replacement entries. This helper creates directly at the destination name, so
257
257
  other processes may observe partial bytes until it returns. It does not promise
258
258
  crash durability or a coherent snapshot of concurrent in-place source edits.
259
259
  Use a private capture directory and keep sources unchanged while capturing.
260
+
261
+ ### Batches of synchronous guarded copies
262
+
263
+ `createRootFileCopyBatchSync()` on `advanced` returns a disposable
264
+ `RootFileCopyBatchSync`. Its `copyFile(options)` takes the same
265
+ `CopyRootFileSyncOptions` and returns the same owned `CopiedRootFileSync` as
266
+ `copyRootFileSync`:
267
+
268
+ ```ts
269
+ import { createRootFileCopyBatchSync } from "@openclaw/fs-safe/advanced";
270
+
271
+ using batch = createRootFileCopyBatchSync();
272
+ for (const name of ["plugin.js", "package.json"]) {
273
+ using copied = batch.copyFile({
274
+ source: { rootPath: "/srv/plugins", absolutePath: `/srv/plugins/${name}` },
275
+ destination: { rootPath: "/srv/capture", absolutePath: `/srv/capture/${name}` },
276
+ clone: "auto",
277
+ maxBytes: 16 * 1024 * 1024,
278
+ });
279
+ console.log(copied.bytes, copied.sourceIdentity);
280
+ }
281
+ ```
282
+
283
+ On canonical POSIX paths, the batch retains root and ancestor directory
284
+ identities across files. Every use still checks those identities without
285
+ following directory symlinks; root and parent canonical paths are rechecked.
286
+ Source opens, source and destination file identities, hardlink policy, exclusive
287
+ creation, bounds, permissions, and cleanup are checked separately for every file.
288
+ No source descriptor, file contents, or successful file-admission result is cached.
289
+ An ancestor replacement rejects even when the leaf parent has not changed.
290
+ Windows and noncanonical path spellings keep the full per-file resolver and its
291
+ alias handling. There is no option to bypass validation.
292
+
293
+ Keep the batch scoped to one capture or materialization, with unchanged source
294
+ and destination directory topology. `close()` and `Symbol.dispose` idempotently
295
+ release its retained metadata; later calls reject with `invalid-path`. Returned
296
+ file descriptors remain independently caller-owned. Successful earlier files
297
+ are not rolled back if a later copy fails. A failed copy keeps the ordinary
298
+ identity-checked cleanup contract; the batch is not an atomic tree transaction
299
+ or a coherent snapshot of concurrent edits. The single-file helper also reuses
300
+ directory admissions for the duration of its one copy.
301
+
302
+ Both APIs reuse the freshly checked canonical root during initial POSIX path
303
+ admission. This avoids repeatedly resolving every absolute root component while
304
+ retaining lexical traversal and the before/after root and parent identity checks.
305
+ Windows and root aliases retain the ordinary resolver, including its handling
306
+ of dot segments in symlink targets. No caller changes are needed for the
307
+ single-file improvement.
@@ -43,9 +43,26 @@ The fragment has no argument preflight of its own.
43
43
 
44
44
  On Linux it uses `renameat2(RENAME_NOREPLACE)`; on macOS it uses
45
45
  `renameatx_np(RENAME_EXCL)`. If Linux lacks that function or reports it as
46
- unsupported, it falls back to `link(..., follow_symlinks=False)`, leaving the
47
- source entry for caller cleanup. That fallback supports files, not directory
48
- publication. Existing destinations are never replaced by this fragment.
46
+ unsupported, it falls back to `link(..., follow_symlinks=False)`, verifying the
47
+ source and target against the admitted inode with exactly two links
48
+ before unlinking the source. Admission and final target verification require
49
+ one link. A successful file publication consumes the source in both paths.
50
+
51
+ For directories, a definitive Linux rejection (`EINVAL`, `ENOSYS`, `ENOTSUP`,
52
+ or `EOPNOTSUPP`) or missing `renameat2` rechecks the source identity and target
53
+ absence, then uses plain rename through the same directory descriptors. A
54
+ trailing slash enforces directory source type at the syscall. Directory rename
55
+ can replace only an **empty directory created concurrently**; non-empty
56
+ directories and non-directory targets are refused as `EEXIST`. An existing
57
+ empty directory observed by the absence check is also refused. No empty claim
58
+ directory is exposed before publishing the completed source.
59
+
60
+ Identity checks and mutation remain separate, not source-name compare-and-swap.
61
+ The fallback verifies the published identity afterward. A file fallback failure
62
+ can leave both names, and post-publication failures preserve the destination
63
+ for caller reconciliation. Exclusive-create cleanup preserves changed payloads
64
+ and incomplete link pairs. The guest has no strict/require mode; host native
65
+ policy does not apply. macOS and other errors retain their fail-closed behavior.
49
66
 
50
67
  ## Invocation protocol
51
68
 
@@ -107,7 +124,7 @@ entries, including symlinks, without following them. A force removal tolerates
107
124
  a missing leaf but does not suppress failure to open its parent.
108
125
 
109
126
  Write preserves an existing regular file's mode and otherwise creates private
110
- files. Copy preserves the source mode. Exclusive create publishes a mode-0600
127
+ files. Copy and cross-device file moves preserve the admitted source descriptor's mode. Exclusive create publishes a mode-0600
111
128
  file from a private staging directory. Staging names retain the `.openclaw-*`
112
129
  prefixes and use short random suffixes independent of the destination basename,
113
130
  so legal names near the filesystem's component limit also work for writes and
@@ -1,5 +1,9 @@
1
1
  # pathScope()
2
2
 
3
+ Paths supplied to a scope are literal filesystem names. In particular, `~/file`
4
+ selects a file inside a directory named `~` beneath the scope; it does not expand
5
+ the user's home directory.
6
+
3
7
  `pathScope()` prepares absolute paths and returns plain `{ ok, path }` results. `resolve()` and `resolveAll()` check lexical containment without touching the filesystem; `existing()`, `files()`, and `writable()` add the filesystem checks described below. Use it to prepare paths before handing them to another library, whose file-opening and mutation behavior still applies.
4
8
 
5
9
  ```ts