@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.
- package/dist/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
- package/dist/.setup/{channel-DZakdZ3r.mjs → channel-CjGGyrdx.mjs} +87 -174
- package/dist/.setup/{channel.runtime-rXFuQXLL.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
- package/dist/.setup/{chat-mTBvMMvx.mjs → chat-fC3dvxFs.mjs} +16 -28
- package/dist/.setup/{client-CcxmEkoy.mjs → client-wwr8PGPH.mjs} +24 -30
- package/dist/.setup/{conversation-id-C1ofUfU8.mjs → conversation-id-D00i9uy5.mjs} +5 -10
- package/dist/.setup/{doctor-contract-DyOo8NvC.mjs → doctor-contract-oIpUWtNO.mjs} +8 -15
- package/dist/.setup/{monitor-CXaFHMmi.mjs → monitor-Yt__BUki.mjs} +33 -54
- package/dist/.setup/{monitor.account-cJ8gavqv.mjs → monitor.account-CVz16781.mjs} +359 -658
- package/dist/.setup/{probe-BjSykXB8.mjs → probe-DXnFxq5j.mjs} +14 -17
- package/dist/.setup/{reply-delivery-result-laBNOmBu.mjs → reply-delivery-result-iCCrdxE1.mjs} +153 -181
- package/dist/.setup/{session-conversation-C53IEUWt.mjs → session-conversation-BSBNK5Mq.mjs} +1 -1
- package/dist/.setup/{setup-api-fZcYXGxe.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
- package/dist/.setup/{subagent-hooks-C8Z_x3KJ.mjs → subagent-hooks-9Pc1-k37.mjs} +7 -17
- package/dist/.setup/{thread-bindings-jW2x5VuN.mjs → thread-bindings-DdNLxoL3.mjs} +21 -44
- package/dist/api.js +218 -326
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
- package/node_modules/@openclaw/fs-safe/README.md +1 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
- package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
- package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
- package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
- package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
- package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
- package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
- package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
- package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
- package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
- package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
- package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
- package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
- package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
- package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
- package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
- package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
- package/node_modules/@openclaw/fs-safe/package.json +15 -15
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/node_modules/follow-redirects/index.js +10 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
- package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
- package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
- package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
- package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
- package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
- package/node_modules/mdast-util-to-markdown/package.json +13 -57
- package/node_modules/mdast-util-to-markdown/readme.md +139 -84
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/package.json +5 -5
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
- package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
- package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
- package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
- package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +0 -1
|
@@ -10,10 +10,40 @@ import { SyncLockAcquisition } from "./file-lock-sync-acquisition.js";
|
|
|
10
10
|
import { assertSynchronousCallbackResult } from "./mutation-authority.js";
|
|
11
11
|
import { assertNoWindowsPathAlias } from "./windows-path-alias.js";
|
|
12
12
|
import { admitFileLockSyncRootPath, assertFileLockSyncRootPathsCurrent, captureFileLockSyncRootAuthority, normalizeFileLockSyncTargetWithRoot, } from "./file-lock-sync-root.js";
|
|
13
|
-
import { cleanupCreatedRootSyncLock, FileLockSyncRootArbitrationCollision, tryReuseCurrentRootSyncHeldLock, } from "./file-lock-sync-root-arbitration.js";
|
|
14
13
|
import { fileLockSyncRootSnapshotStillCurrent, } from "./file-lock-sync-root-io.js";
|
|
15
14
|
import { createFileLockSyncRootDirectory, createFileLockSyncRootFile, fileLockSyncRootGuardExists, fileLockSyncRootDirectoryReceiptStillCurrent, refreshFileLockSyncRootFileReceipt, removeFileLockSyncRootDirectory, removeFileLockSyncRootFile, } from "./file-lock-sync-root-mutation.js";
|
|
16
|
-
import { createRootSyncHeldLockHandle, ensureRootSyncExitCleanupRegistered, getRootSyncHeldLocks, readRootSidecarSnapshotSync, } from "./file-lock-sync-root-held.js";
|
|
15
|
+
import { createRootSyncHeldLockHandle, ensureRootSyncExitCleanupRegistered, getRootSyncHeldLocks, readRootSidecarSnapshotSync, verifyRootSyncHeldLock, } from "./file-lock-sync-root-held.js";
|
|
16
|
+
class FileLockSyncRootArbitrationCollision extends FsSafeError {
|
|
17
|
+
constructor() {
|
|
18
|
+
super("path-mismatch", "file lock arbitration changed during local creation");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function cleanupCreatedRootSyncLock(lockRootPath, fd, receipt, timer) {
|
|
22
|
+
let timerCleanupFailed = false;
|
|
23
|
+
let timerCleanupError;
|
|
24
|
+
try {
|
|
25
|
+
if (timer)
|
|
26
|
+
clearInterval(timer);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
timerCleanupFailed = true;
|
|
30
|
+
timerCleanupError = error;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
fs.closeSync(fd);
|
|
34
|
+
if (!removeFileLockSyncRootFile(lockRootPath, receipt)) {
|
|
35
|
+
throw new FsSafeError("path-mismatch", "created sidecar lock changed before cleanup");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (fileCleanupError) {
|
|
39
|
+
if (timerCleanupFailed) {
|
|
40
|
+
throw createSuppressedError(timerCleanupError, fileCleanupError, "unpublished lock timer and file cleanup both failed");
|
|
41
|
+
}
|
|
42
|
+
throw fileCleanupError;
|
|
43
|
+
}
|
|
44
|
+
if (timerCleanupFailed)
|
|
45
|
+
throw timerCleanupError;
|
|
46
|
+
}
|
|
17
47
|
export function acquireFileLockSyncWithRoot(targetPath, inputOptions, lockRoot) {
|
|
18
48
|
// The public dispatcher already read lockRoot exactly once. Validate and
|
|
19
49
|
// snapshot that genuine Root before any remaining option or retry getter can
|
|
@@ -37,23 +67,39 @@ export function acquireFileLockSyncWithRoot(targetPath, inputOptions, lockRoot)
|
|
|
37
67
|
const heldLocks = getRootSyncHeldLocks();
|
|
38
68
|
const currentTargetHolder = () => heldLocks.get(normalizedTargetPath) ??
|
|
39
69
|
foreignSyncHeldLock("root", normalizedTargetPath);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
const tryReuseCurrentHeld = () => {
|
|
71
|
+
const held = heldLocks.get(normalizedTargetPath);
|
|
72
|
+
const reusable = held && !foreignSyncHeldLock("root", normalizedTargetPath) &&
|
|
73
|
+
options.reentrantOwner !== undefined && held.reentrantOwner !== undefined &&
|
|
74
|
+
options.reentrantOwner === held.reentrantOwner &&
|
|
75
|
+
authority.adapter === held.rootAuthority.adapter &&
|
|
76
|
+
lockRootPath.relativePath === held.rootPath.relativePath &&
|
|
77
|
+
path.relative(lockRootPath.path, held.rootPath.path) === "" &&
|
|
78
|
+
held.releaseState !== "released";
|
|
79
|
+
if (!reusable)
|
|
80
|
+
return undefined;
|
|
81
|
+
if (!verifyRootSyncHeldLock(held)) {
|
|
82
|
+
throw new FsSafeError("path-mismatch", "held sidecar lock changed before reentrant reuse");
|
|
83
|
+
}
|
|
84
|
+
// The parser can reenter acquisition; recheck the exact held entry before reuse.
|
|
85
|
+
if (heldLocks.get(normalizedTargetPath) !== held || held.releaseState === "released" ||
|
|
86
|
+
foreignSyncHeldLock("root", normalizedTargetPath)) {
|
|
87
|
+
throw new FsSafeError("path-mismatch", "held sidecar lock changed during reentrant reuse");
|
|
88
|
+
}
|
|
89
|
+
held.refCount += 1;
|
|
90
|
+
held.revision += 1;
|
|
91
|
+
return createRootSyncHeldLockHandle(held);
|
|
92
|
+
};
|
|
47
93
|
if (heldLocks.has(normalizedTargetPath) && !foreignSyncHeldLock("root", normalizedTargetPath)) {
|
|
48
94
|
assertFileLockSyncRootPathsCurrent(guardedPaths);
|
|
49
|
-
const initiallyReusable =
|
|
95
|
+
const initiallyReusable = tryReuseCurrentHeld();
|
|
50
96
|
if (initiallyReusable)
|
|
51
97
|
return initiallyReusable;
|
|
52
98
|
}
|
|
53
99
|
const acquisition = new SyncLockAcquisition(lockPath, normalizedTargetPath, options.retry, options.timeoutMs);
|
|
54
100
|
let ownedReclaimGuard;
|
|
55
101
|
let reclaimCleanupAttempted = false;
|
|
56
|
-
const reuseCurrentHeld = () => ownedReclaimGuard ? undefined :
|
|
102
|
+
const reuseCurrentHeld = () => ownedReclaimGuard ? undefined : tryReuseCurrentHeld();
|
|
57
103
|
const releaseReclaimGuard = () => {
|
|
58
104
|
const receipt = ownedReclaimGuard;
|
|
59
105
|
if (!receipt)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import fsSync, {} from "node:fs";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { assertDirectoryGuard, assertSyncDirectoryGuard, createAsyncDirectoryGuard, createSyncDirectoryGuard, } from "./directory-guard.js";
|
|
5
5
|
export async function withAsyncDirectoryGuards(guards, mutate, options = {}) {
|
|
6
6
|
for (const guard of guards) {
|
|
7
|
-
|
|
7
|
+
assertDirectoryGuard(guard, "native");
|
|
8
8
|
}
|
|
9
9
|
const result = await mutate();
|
|
10
10
|
if (options.verifyAfter !== false) {
|
|
11
11
|
try {
|
|
12
12
|
for (const guard of guards) {
|
|
13
|
-
|
|
13
|
+
assertDirectoryGuard(guard, "native");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
@@ -46,11 +46,11 @@ export async function guardedRename(params) {
|
|
|
46
46
|
const sourceGuard = await createAsyncDirectoryGuard(path.dirname(params.from));
|
|
47
47
|
const targetGuard = await createAsyncDirectoryGuard(path.dirname(params.to));
|
|
48
48
|
await withAsyncDirectoryGuards([sourceGuard, targetGuard], async () => {
|
|
49
|
+
// Authority must survive all awaited guards; do not yield before rename dispatch.
|
|
50
|
+
params.assertBeforeRename?.();
|
|
49
51
|
if (params.onSourceInspected) {
|
|
50
52
|
params.onSourceInspected(fsSync.lstatSync(params.from, { bigint: true }));
|
|
51
53
|
}
|
|
52
|
-
// Authority must survive all awaited guards; do not yield before rename dispatch.
|
|
53
|
-
params.assertBeforeRename?.();
|
|
54
54
|
await fs.rename(params.from, params.to);
|
|
55
55
|
params.onRenamed?.();
|
|
56
56
|
});
|
|
@@ -32,6 +32,16 @@ export const GUEST_FILESYSTEM_CREATE_STAGING_PYTHON = [
|
|
|
32
32
|
].join("\n");
|
|
33
33
|
export const GUEST_FILESYSTEM_RENAME_NO_REPLACE_PYTHON = [
|
|
34
34
|
"def rename_no_replace(src_parent_fd, src_basename, dst_parent_fd, dst_basename):",
|
|
35
|
+
" import stat",
|
|
36
|
+
" source = os.lstat(src_basename, dir_fd=src_parent_fd)",
|
|
37
|
+
" kind = stat.S_IFMT(source.st_mode)",
|
|
38
|
+
" expected = (source.st_dev, source.st_ino, kind)",
|
|
39
|
+
" def verify(parent_fd, basename, links):",
|
|
40
|
+
" current = os.lstat(basename, dir_fd=parent_fd)",
|
|
41
|
+
" if (current.st_dev, current.st_ino, stat.S_IFMT(current.st_mode)) != expected:",
|
|
42
|
+
" raise OSError(errno.ESTALE, 'no-replace publication identity changed', basename)",
|
|
43
|
+
" if kind == stat.S_IFREG and current.st_nlink != links:",
|
|
44
|
+
" raise OSError(errno.ESTALE, 'no-replace publication link count changed', basename)",
|
|
35
45
|
" libc = ctypes.CDLL(None, use_errno=True)",
|
|
36
46
|
" is_linux = sys.platform.startswith('linux')",
|
|
37
47
|
" if is_linux:",
|
|
@@ -62,6 +72,31 @@ export const GUEST_FILESYSTEM_RENAME_NO_REPLACE_PYTHON = [
|
|
|
62
72
|
" raise OSError(error_code, os.strerror(error_code), dst_basename)",
|
|
63
73
|
" elif not is_linux:",
|
|
64
74
|
" raise OSError(errno.ENOSYS, 'atomic no-replace rename is unavailable')",
|
|
75
|
+
" # Only a definitive rejection of the fixed flags reaches this fallback.",
|
|
76
|
+
" if kind not in (stat.S_IFDIR, stat.S_IFREG):",
|
|
77
|
+
" raise OSError(errno.EINVAL, 'no-replace fallback requires a file or directory', src_basename)",
|
|
78
|
+
" verify(src_parent_fd, src_basename, 1)",
|
|
79
|
+
" try:",
|
|
80
|
+
" os.lstat(dst_basename, dir_fd=dst_parent_fd)",
|
|
81
|
+
" except FileNotFoundError:",
|
|
82
|
+
" pass",
|
|
83
|
+
" else:",
|
|
84
|
+
" raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), dst_basename)",
|
|
85
|
+
" if kind == stat.S_IFDIR:",
|
|
86
|
+
" verify(src_parent_fd, src_basename, 1)",
|
|
87
|
+
" # A directory rename can replace only an EMPTY directory raced into",
|
|
88
|
+
" # the absent target. Non-empty directories and files are refused.",
|
|
89
|
+
" # The slash enforces source directory type at the syscall, even if",
|
|
90
|
+
" # a peer substitutes a file/symlink after verification. Identity",
|
|
91
|
+
" # checks are not compare-and-swap; verify publication afterward.",
|
|
92
|
+
" try:",
|
|
93
|
+
" os.rename(src_basename + '/', dst_basename, src_dir_fd=src_parent_fd, dst_dir_fd=dst_parent_fd)",
|
|
94
|
+
" except OSError as error:",
|
|
95
|
+
" if error.errno in (errno.ENOTEMPTY, errno.ENOTDIR, errno.EEXIST):",
|
|
96
|
+
" raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), dst_basename) from error",
|
|
97
|
+
" raise",
|
|
98
|
+
" verify(dst_parent_fd, dst_basename, 1)",
|
|
99
|
+
" return",
|
|
65
100
|
" os.link(",
|
|
66
101
|
" src_basename,",
|
|
67
102
|
" dst_basename,",
|
|
@@ -69,12 +104,19 @@ export const GUEST_FILESYSTEM_RENAME_NO_REPLACE_PYTHON = [
|
|
|
69
104
|
" dst_dir_fd=dst_parent_fd,",
|
|
70
105
|
" follow_symlinks=False,",
|
|
71
106
|
" )",
|
|
107
|
+
" # Only this exact two-name interval permits nlink=2. Never roll back the",
|
|
108
|
+
" # target on failure: it may be the only remaining link to the source.",
|
|
109
|
+
" verify(dst_parent_fd, dst_basename, 2)",
|
|
110
|
+
" verify(src_parent_fd, src_basename, 2)",
|
|
111
|
+
" os.unlink(src_basename, dir_fd=src_parent_fd)",
|
|
112
|
+
" verify(dst_parent_fd, dst_basename, 1)",
|
|
72
113
|
].join("\n");
|
|
73
114
|
export const GUEST_FILESYSTEM_CREATE_EXCLUSIVE_PYTHON = [
|
|
74
115
|
"def create_exclusive(parent_fd, basename, stdin_buffer):",
|
|
75
116
|
" staging_fd = None",
|
|
76
117
|
" staging_name = None",
|
|
77
118
|
" temp_fd = None",
|
|
119
|
+
" temp_inode = None",
|
|
78
120
|
" temp_name = 'payload'",
|
|
79
121
|
" try:",
|
|
80
122
|
" try:",
|
|
@@ -85,6 +127,7 @@ export const GUEST_FILESYSTEM_CREATE_EXCLUSIVE_PYTHON = [
|
|
|
85
127
|
" raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), basename)",
|
|
86
128
|
" staging_name, staging_fd = create_staging_dir(parent_fd)",
|
|
87
129
|
" temp_fd = os.open(temp_name, WRITE_FLAGS, 0o600, dir_fd=staging_fd)",
|
|
130
|
+
" temp_inode = inode_identity(os.fstat(temp_fd))",
|
|
88
131
|
" while True:",
|
|
89
132
|
" chunk = stdin_buffer.read(65536)",
|
|
90
133
|
" if not chunk:",
|
|
@@ -92,8 +135,7 @@ export const GUEST_FILESYSTEM_CREATE_EXCLUSIVE_PYTHON = [
|
|
|
92
135
|
" write_all(temp_fd, chunk)",
|
|
93
136
|
" # exclusive create payload is durable before publication",
|
|
94
137
|
" os.fsync(temp_fd)",
|
|
95
|
-
"
|
|
96
|
-
" # Publish with a native atomic no-replace rename.",
|
|
138
|
+
" # Publish with no-replace rename or the checked file fallback.",
|
|
97
139
|
" rename_no_replace(staging_fd, temp_name, parent_fd, basename)",
|
|
98
140
|
" target_stat = os.lstat(basename, dir_fd=parent_fd)",
|
|
99
141
|
" if temp_inode != inode_identity(target_stat):",
|
|
@@ -105,14 +147,19 @@ export const GUEST_FILESYSTEM_CREATE_EXCLUSIVE_PYTHON = [
|
|
|
105
147
|
" if staging_fd is not None:",
|
|
106
148
|
" # Cleanup stays relative to the private pinned directory, so a",
|
|
107
149
|
" # parent-path substitution cannot redirect payload deletion.",
|
|
150
|
+
" payload_removed = False",
|
|
108
151
|
" try:",
|
|
109
|
-
" os.
|
|
152
|
+
" current_payload = os.lstat(temp_name, dir_fd=staging_fd)",
|
|
153
|
+
" # Preserve ambiguous or partially published link pairs.",
|
|
154
|
+
" if temp_inode == inode_identity(current_payload) and current_payload.st_nlink == 1:",
|
|
155
|
+
" os.unlink(temp_name, dir_fd=staging_fd)",
|
|
156
|
+
" payload_removed = True",
|
|
110
157
|
" except FileNotFoundError:",
|
|
111
|
-
"
|
|
158
|
+
" payload_removed = True",
|
|
112
159
|
" staging_identity = entry_identity(os.fstat(staging_fd))",
|
|
113
160
|
" os.close(staging_fd)",
|
|
114
161
|
" staging_removed = False",
|
|
115
|
-
" if staging_name is not None:",
|
|
162
|
+
" if staging_name is not None and payload_removed:",
|
|
116
163
|
" try:",
|
|
117
164
|
" current_staging = os.lstat(staging_name, dir_fd=parent_fd)",
|
|
118
165
|
" if same_identity(staging_identity, current_staging):",
|
|
@@ -395,7 +395,7 @@ export const GUEST_FILESYSTEM_PYTHON = [
|
|
|
395
395
|
" break",
|
|
396
396
|
" write_all(temp_fd, chunk)",
|
|
397
397
|
" try:",
|
|
398
|
-
" os.fchmod(temp_fd, stat.S_IMODE(
|
|
398
|
+
" os.fchmod(temp_fd, stat.S_IMODE(src_file_stat.st_mode))",
|
|
399
399
|
" except AttributeError:",
|
|
400
400
|
" pass",
|
|
401
401
|
" os.fsync(temp_fd)",
|
|
@@ -139,6 +139,7 @@ export interface NativeBinding {
|
|
|
139
139
|
renameReplaceWithIdentity?(sourceParent: number, source: string, targetParent: number, target: string, dev: bigint, ino: bigint): void;
|
|
140
140
|
/** Windows-only, private handle custody; no borrowed/runtime descriptors. */
|
|
141
141
|
retainWindowsFile?(directory: string, basename: string, parentDev: bigint, parentIno: bigint, dev: bigint, ino: bigint, size: bigint, mtimeNs: bigint, ctimeNs: bigint, sha256: string, maxBytes: number): NativeRetainedFile;
|
|
142
|
+
retainWindowsSidecar?(parentFd: number, directory: string, basename: string, parentDev: bigint, parentIno: bigint, dev: bigint, ino: bigint, size: bigint, sha256: string, maxBytes: number): NativeRetainedFile;
|
|
142
143
|
watchRegister?(root: string, limit: number, callback: (batch: import("./watch-native.js").NativeWatchWireBatch) => void, persistent: boolean): number;
|
|
143
144
|
watchConfigure?(id: number, anchors: string[], exclusions: string[]): void;
|
|
144
145
|
watchEntries?(id: number, entries: import("./watch-native.js").NativeWatchEntry[]): {
|
|
@@ -5,7 +5,6 @@ export type NativeFileHandle = {
|
|
|
5
5
|
writeFile(data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
|
|
6
6
|
};
|
|
7
7
|
export declare function nativeOpenFlags(flags: number): number;
|
|
8
|
-
export declare function writeNativeFd(fd: number, data: Buffer): void;
|
|
9
8
|
export declare function removeNativeCreatedFileIfStillPinned(params: {
|
|
10
9
|
parentPath: string;
|
|
11
10
|
parentFd: number;
|
|
@@ -10,31 +10,6 @@ export function nativeOpenFlags(flags) {
|
|
|
10
10
|
(closeOnExec ?? 0) |
|
|
11
11
|
(typeof fsSync.constants.O_NOFOLLOW === "number" ? fsSync.constants.O_NOFOLLOW : 0));
|
|
12
12
|
}
|
|
13
|
-
export function writeNativeFd(fd, data) {
|
|
14
|
-
let offset = 0;
|
|
15
|
-
while (offset < data.byteLength) {
|
|
16
|
-
const written = fsSync.writeSync(fd, data, offset, data.byteLength - offset);
|
|
17
|
-
if (written <= 0) {
|
|
18
|
-
throw Object.assign(new Error("native file write made no progress"), { code: "EIO" });
|
|
19
|
-
}
|
|
20
|
-
offset += written;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function wrapNativeFd(fd, closeFd) {
|
|
24
|
-
let open = true;
|
|
25
|
-
return {
|
|
26
|
-
fd,
|
|
27
|
-
async close() {
|
|
28
|
-
if (open) {
|
|
29
|
-
open = false;
|
|
30
|
-
closeFd(fd);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
async writeFile(data, encoding) {
|
|
34
|
-
writeNativeFd(fd, Buffer.isBuffer(data) ? data : Buffer.from(data, encoding ?? "utf8"));
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
13
|
export function removeNativeCreatedFileIfStillPinned(params) {
|
|
39
14
|
if (!params.created) {
|
|
40
15
|
return;
|
|
@@ -86,7 +61,28 @@ export async function createNativeExclusiveFile(targetPath, mode) {
|
|
|
86
61
|
fd = opened.fd;
|
|
87
62
|
fsSync.fchmodSync(fd, mode);
|
|
88
63
|
created = fsSync.fstatSync(fd, { bigint: true });
|
|
89
|
-
|
|
64
|
+
const ownedFd = fd;
|
|
65
|
+
let open = true;
|
|
66
|
+
return {
|
|
67
|
+
fd: ownedFd,
|
|
68
|
+
async close() {
|
|
69
|
+
if (open) {
|
|
70
|
+
open = false;
|
|
71
|
+
closeFd(ownedFd);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
async writeFile(data, encoding) {
|
|
75
|
+
const buffer = Buffer.isBuffer(data) ? data : Buffer.from(data, encoding ?? "utf8");
|
|
76
|
+
let offset = 0;
|
|
77
|
+
while (offset < buffer.byteLength) {
|
|
78
|
+
const written = fsSync.writeSync(ownedFd, buffer, offset, buffer.byteLength - offset);
|
|
79
|
+
if (written <= 0) {
|
|
80
|
+
throw Object.assign(new Error("native file write made no progress"), { code: "EIO" });
|
|
81
|
+
}
|
|
82
|
+
offset += written;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
};
|
|
90
86
|
}
|
|
91
87
|
catch (error) {
|
|
92
88
|
if (fd !== undefined) {
|
|
@@ -188,7 +188,11 @@ export async function runPinnedWriteWindows(binding, params, root, parentFd, par
|
|
|
188
188
|
if (params.sync !== false)
|
|
189
189
|
syncFileBestEffortSync(parentFd);
|
|
190
190
|
// Verification follows publication and final chmod, outside rollback handling.
|
|
191
|
-
|
|
191
|
+
if (params.overwrite === false && params.input.kind === "buffer" && params.input.stageBeforePublish === false) {
|
|
192
|
+
await params.verifyPublished?.(targetFd, verificationIdentity, parentGuard, { fd: parentFd, binding });
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
await params.verifyPublished?.(targetFd, verificationIdentity, parentGuard);
|
|
192
196
|
completed = true;
|
|
193
197
|
return { dev: targetIdentity.dev, ino: targetIdentity.ino };
|
|
194
198
|
}
|
|
@@ -177,7 +177,10 @@ class NativeStagedFile {
|
|
|
177
177
|
}
|
|
178
178
|
const identity = published.staged.identity;
|
|
179
179
|
try {
|
|
180
|
-
|
|
180
|
+
if (exclusive)
|
|
181
|
+
await params.verifyPublished?.(staged.#file(), identity, parentGuard, { fd: parentFd, binding });
|
|
182
|
+
else
|
|
183
|
+
await params.verifyPublished?.(staged.#file(), identity, parentGuard);
|
|
181
184
|
}
|
|
182
185
|
catch (error) {
|
|
183
186
|
if (params.overwrite === false && params.input.kind !== "file" && params.input.stageBeforePublish === true) {
|
|
@@ -5,7 +5,8 @@ import { formatErrorDetail } from "./error-detail.js";
|
|
|
5
5
|
const execFileAsync = promisify(execFile);
|
|
6
6
|
export const DEFAULT_PERMISSION_EXEC_TIMEOUT_MS = 30_000;
|
|
7
7
|
export function formatPermissionErrorDetail(value) {
|
|
8
|
-
|
|
8
|
+
// Escaping cannot shrink input; 401 code units decide the 400-character excerpt.
|
|
9
|
+
const formatted = formatErrorDetail(value.slice(0, 401));
|
|
9
10
|
return formatted.length > 400 ? `${formatted.slice(0, 399)}…` : formatted;
|
|
10
11
|
}
|
|
11
12
|
const MAX_CAUGHT_FAILURE_PROTOTYPES = 4;
|
|
@@ -2,6 +2,11 @@ import type { CopyFileInput } from "./copy-file-input.js";
|
|
|
2
2
|
import type { AnyAsyncDirectoryGuard } from "./directory-guard.js";
|
|
3
3
|
import type { FileIdentityStat } from "./file-identity.js";
|
|
4
4
|
import type { MutationDirectoryObservation } from "./pinned-mutation-observation.js";
|
|
5
|
+
import type { NativeBinding } from "./native-binding.js";
|
|
6
|
+
export type NativeWriteParent = Readonly<{
|
|
7
|
+
fd: number;
|
|
8
|
+
binding: NativeBinding;
|
|
9
|
+
}>;
|
|
5
10
|
export type PinnedWriteInput = {
|
|
6
11
|
kind: "buffer";
|
|
7
12
|
data: string | Buffer;
|
|
@@ -64,5 +69,5 @@ export type PinnedWriteParams = {
|
|
|
64
69
|
mutationAdmission?: PinnedWriteMutationAdmission;
|
|
65
70
|
onRenameIdentityMismatch?: "verify-content";
|
|
66
71
|
onPublished?: (identity: PublishedWriteIdentity) => void;
|
|
67
|
-
verifyPublished?: (fd: number, identity: PublishedWriteIdentity, parentGuard: AnyAsyncDirectoryGuard) => Promise<void>;
|
|
72
|
+
verifyPublished?: (fd: number, identity: PublishedWriteIdentity, parentGuard: AnyAsyncDirectoryGuard, nativeParent?: NativeWriteParent) => Promise<void>;
|
|
68
73
|
};
|
|
@@ -166,7 +166,7 @@ async function createTempWorkspace(options, scopedPrefix = false) {
|
|
|
166
166
|
else
|
|
167
167
|
admission.assertCurrent();
|
|
168
168
|
const stat = inspectDirectoryIdentitySync(dir);
|
|
169
|
-
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
169
|
+
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode, dir);
|
|
170
170
|
// Retain while the child still has its private creation mode so an
|
|
171
171
|
// explicit dirMode such as 0 cannot make identity descriptor acquisition fail.
|
|
172
172
|
retainedChild = TempWorkspaceRetainedChild.retain(dir, stat);
|
|
@@ -261,7 +261,7 @@ function createTempWorkspaceSync(options, scopedPrefix = false) {
|
|
|
261
261
|
else {
|
|
262
262
|
stat = inspectDirectoryIdentitySync(dir);
|
|
263
263
|
}
|
|
264
|
-
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
264
|
+
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode, dir);
|
|
265
265
|
retainedChild ??= TempWorkspaceRetainedChild.retain(dir, stat);
|
|
266
266
|
if (needsModeInitialization) {
|
|
267
267
|
retainedChild.initializeModeSync(dirMode, admission.ownerUid, admission.assertCurrent);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nativeMoveNoReplace } from "./native-move-fallback.js";
|
|
2
|
+
import { getFsSafeNativeConfig } from "./native-config.js";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import fsSync, {} from "node:fs";
|
|
4
5
|
import fs, {} from "node:fs/promises";
|
|
@@ -270,12 +271,38 @@ export async function publishFileExclusive(params) {
|
|
|
270
271
|
}
|
|
271
272
|
if (strategy === "rename-noreplace") {
|
|
272
273
|
const binding = requireNativeBinding();
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
try {
|
|
275
|
+
const fallback = nativeMoveNoReplace(binding, [
|
|
276
|
+
sourceNativeParent.handle.fd, sourceNativeParent.basename,
|
|
277
|
+
targetNativeParent.handle.fd, targetNativeParent.basename,
|
|
278
|
+
], sourceExactIdentity, getFsSafeNativeConfig().mode === "auto", "file publication");
|
|
279
|
+
if (fallback) {
|
|
280
|
+
failure.fallback = fallback;
|
|
281
|
+
failure.sourceRemoval = "removed";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
if (error instanceof FsSafeError) {
|
|
286
|
+
if (error.details?.publication === "published") {
|
|
287
|
+
failure.targetCreated = true;
|
|
288
|
+
failure.preserveTarget = true;
|
|
289
|
+
failure.phase = "rename-verify";
|
|
290
|
+
failure.fallback = "link-unlink";
|
|
291
|
+
failure.sourceRemoval = error.details.sourceRemoval;
|
|
292
|
+
// Changed/unverified pairs cannot establish which inode was published.
|
|
293
|
+
if (failure.sourceRemoval === "still-linked")
|
|
294
|
+
rememberCreatedTarget(failure, sourceExactIdentity, "rename-verify");
|
|
295
|
+
}
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
const code = error?.code;
|
|
299
|
+
if (code === "path-mismatch" || code === "hardlink") {
|
|
300
|
+
throw new FsSafeError(code, "publication source changed before fallback", { cause: error });
|
|
301
|
+
}
|
|
302
|
+
if (code === "ELOOP")
|
|
303
|
+
throw new FsSafeError("symlink", "publication source became a symlink", { cause: error });
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
279
306
|
rememberCreatedTarget(failure, sourceExactIdentity, "rename-verify");
|
|
280
307
|
// A failed post-rename fence must not delete the only remaining name.
|
|
281
308
|
failure.preserveTarget = true;
|
|
@@ -139,15 +139,12 @@ function* replacePinnedWithRestore(io, file, replacement, maxRestoreBytes, repla
|
|
|
139
139
|
if (io.asynchronous)
|
|
140
140
|
yield chmod;
|
|
141
141
|
yield* file.sync();
|
|
142
|
-
throw restoreFailure(writeError, "restored");
|
|
143
142
|
}
|
|
144
143
|
catch (restoreError) {
|
|
145
144
|
mutation.rethrowRefusal();
|
|
146
|
-
if (restoreError instanceof FsSafeError && restoreError.details?.cleanup === "restored") {
|
|
147
|
-
throw restoreError;
|
|
148
|
-
}
|
|
149
145
|
throw restoreFailure(writeError, "restore-failed", restoreError);
|
|
150
146
|
}
|
|
147
|
+
throw restoreFailure(writeError, "restored");
|
|
151
148
|
}
|
|
152
149
|
}
|
|
153
150
|
export function* copyFallbackReplace(io, params) {
|
|
@@ -139,6 +139,12 @@ export function* writeTempFile(io, params) {
|
|
|
139
139
|
const writing = file.writeFile(params.content, true);
|
|
140
140
|
if (io.asynchronous)
|
|
141
141
|
yield writing;
|
|
142
|
+
if (io.asyncFs === fs && process.platform !== "win32" && !params.sync) {
|
|
143
|
+
// Matching non-durable writes have no I/O left after this identity fence.
|
|
144
|
+
const current = inspectAtomicIdentity(io, () => file.statExact(), identity, true);
|
|
145
|
+
if (Number(current.mode & 4095n) === (params.mode & 0o7777))
|
|
146
|
+
return { file, identity };
|
|
147
|
+
}
|
|
142
148
|
const chmod = file.chmod(params.mode);
|
|
143
149
|
if (io.asynchronous)
|
|
144
150
|
yield chmod;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import type { PinnedWriteInput } from "./pinned-write-types.js";
|
|
1
|
+
import type { NativeWriteParent, PinnedWriteInput, PublishedWriteIdentity } from "./pinned-write-types.js";
|
|
2
2
|
import type { RootCreateOptions, RootCreateStreamOptions, RootWriteOptions } from "./root-options.js";
|
|
3
|
+
import type { AnyAsyncDirectoryGuard } from "./directory-guard.js";
|
|
3
4
|
declare const exclusiveSidecarCreate: unique symbol;
|
|
4
5
|
export declare const sidecarExclusiveCreate: Readonly<{
|
|
5
6
|
[exclusiveSidecarCreate]: true;
|
|
6
7
|
}>;
|
|
8
|
+
export declare const retainSidecarCreated: unique symbol;
|
|
9
|
+
export type SidecarCreationRetention = Readonly<{
|
|
10
|
+
retain(fd: number, parent: AnyAsyncDirectoryGuard, nativeParent?: NativeWriteParent): void;
|
|
11
|
+
cleanup(fd: number, parent: NativeWriteParent, identity: PublishedWriteIdentity): void;
|
|
12
|
+
}>;
|
|
7
13
|
export type RootWriteParams = RootWriteOptions & RootCreateOptions & RootCreateStreamOptions & {
|
|
8
14
|
relativePath: string;
|
|
9
15
|
data: string | Buffer | AsyncIterable<Uint8Array>;
|
|
10
16
|
strictFileSync?: boolean;
|
|
11
17
|
[exclusiveSidecarCreate]?: true;
|
|
18
|
+
[retainSidecarCreated]?: SidecarCreationRetention;
|
|
19
|
+
};
|
|
20
|
+
export declare function sidecarRetainedCreate(retain: NonNullable<RootWriteParams[typeof retainSidecarCreated]>): {
|
|
21
|
+
[exclusiveSidecarCreate]: true;
|
|
22
|
+
[retainSidecarCreated]: Readonly<{
|
|
23
|
+
retain(fd: number, parent: AnyAsyncDirectoryGuard, nativeParent?: NativeWriteParent): void;
|
|
24
|
+
cleanup(fd: number, parent: NativeWriteParent, identity: PublishedWriteIdentity): void;
|
|
25
|
+
}>;
|
|
12
26
|
};
|
|
13
27
|
export declare function rethrowCreateInputError(error: unknown): never;
|
|
14
28
|
export declare function createInputOptions(data: RootWriteParams["data"], options: RootCreateOptions & RootCreateStreamOptions, defaultMaxBytes?: number): RootCreateOptions & RootCreateStreamOptions;
|
|
@@ -5,6 +5,10 @@ import { MutationAuthorityError } from "./mutation-authority.js";
|
|
|
5
5
|
// Keep this composition hook off the public Root options and package exports.
|
|
6
6
|
const exclusiveSidecarCreate = Symbol("exclusiveSidecarCreate");
|
|
7
7
|
export const sidecarExclusiveCreate = Object.freeze({ [exclusiveSidecarCreate]: true });
|
|
8
|
+
export const retainSidecarCreated = Symbol("retainSidecarCreated");
|
|
9
|
+
export function sidecarRetainedCreate(retain) {
|
|
10
|
+
return { ...sidecarExclusiveCreate, [retainSidecarCreated]: retain };
|
|
11
|
+
}
|
|
8
12
|
class CreateInputError extends FsSafeError {
|
|
9
13
|
rejection;
|
|
10
14
|
constructor(rejection) {
|
|
@@ -17,7 +17,7 @@ export async function lookupRootDirectoryEntry(root, guard, name) {
|
|
|
17
17
|
const observed = inspectStatObservationSync(bigint => bigint
|
|
18
18
|
? fs.lstatSync(pathname, { bigint: true }) : fs.lstatSync(pathname));
|
|
19
19
|
await assertRootDirectoryObservationGuard(root, guard);
|
|
20
|
-
return { entry:
|
|
20
|
+
return { entry: pathStatFromStats(observed.stat, name), identity: observed.identity };
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
23
|
await assertRootDirectoryObservationGuard(root, guard);
|
|
@@ -16,6 +16,5 @@ export declare function assertRootDirectoryObservationGuard(root: RootContext, g
|
|
|
16
16
|
* both its identity and canonical check here.
|
|
17
17
|
*/
|
|
18
18
|
export declare function assertRootPathObservationReceiptCurrent(root: RootContext, receipt: RootPathObservationReceipt | RootPathParentObservationReceipt, finalTarget?: Stats | BigIntStats): void;
|
|
19
|
-
export declare function listDirectoryPath(root: RootContext, directory: string, withFileTypes: true, receipt?: RootPathObservationReceipt): Promise<DirEntry[]>;
|
|
20
19
|
export declare function listDirectoryPath(root: RootContext, directory: string, withFileTypes: boolean, receipt?: RootPathObservationReceipt): Promise<string[] | DirEntry[]>;
|
|
21
20
|
export declare function openRootDirectoryListing(root: RootContext, directory: string, options: RootDirectoryListingOptions, receipt?: RootPathObservationReceipt): Promise<RootDirectoryListing>;
|
|
@@ -105,10 +105,6 @@ export async function assertRootDirectoryObservationGuard(root, guard) {
|
|
|
105
105
|
throw directoryChangedError(error);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function sameObservationDirectory(left, right) {
|
|
109
|
-
return left.dir === right.dir && left.realPath === right.realPath &&
|
|
110
|
-
left.identity.dev === right.identity.dev && left.identity.ino === right.identity.ino;
|
|
111
|
-
}
|
|
112
108
|
function assertReceiptDirectoryGuardSync(root, guard, backend) {
|
|
113
109
|
if (backend) {
|
|
114
110
|
const observed = inspectNativeDirectoryObservation(backend, guard.dir, guard.identity);
|
|
@@ -139,7 +135,8 @@ export function assertRootPathObservationReceiptCurrent(root, receipt, finalTarg
|
|
|
139
135
|
rootGuard.identity.dev !== root.rootIdentity.dev || rootGuard.identity.ino !== root.rootIdentity.ino) {
|
|
140
136
|
throw rootPathChangedError();
|
|
141
137
|
}
|
|
142
|
-
if (
|
|
138
|
+
if (rootGuard.dir === directoryGuard.dir && rootGuard.realPath === directoryGuard.realPath &&
|
|
139
|
+
rootGuard.identity.dev === directoryGuard.identity.dev && rootGuard.identity.ino === directoryGuard.identity.ino) {
|
|
143
140
|
try {
|
|
144
141
|
if (receipt.kind === "stat" && receipt.target === rootGuard && finalTarget &&
|
|
145
142
|
!receipt.directoryObserver) {
|
|
@@ -176,12 +173,6 @@ function normalizeDirectoryError(error) {
|
|
|
176
173
|
}
|
|
177
174
|
return error;
|
|
178
175
|
}
|
|
179
|
-
function normalizeInitialDirectoryError(error) {
|
|
180
|
-
if (error instanceof FsSafeError && error.code === "not-file") {
|
|
181
|
-
return new FsSafeError("not-found", "directory not found", { cause: error });
|
|
182
|
-
}
|
|
183
|
-
return normalizeDirectoryError(error);
|
|
184
|
-
}
|
|
185
176
|
export async function listDirectoryPath(root, directory, withFileTypes, receipt) {
|
|
186
177
|
let guard;
|
|
187
178
|
if (receipt) {
|
|
@@ -192,7 +183,10 @@ export async function listDirectoryPath(root, directory, withFileTypes, receipt)
|
|
|
192
183
|
guard = await createRootDirectoryObservationGuard(root, directory);
|
|
193
184
|
}
|
|
194
185
|
catch (error) {
|
|
195
|
-
|
|
186
|
+
if (error instanceof FsSafeError && error.code === "not-file") {
|
|
187
|
+
throw new FsSafeError("not-found", "directory not found", { cause: error });
|
|
188
|
+
}
|
|
189
|
+
throw normalizeDirectoryError(error);
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
192
|
return await listGuardedDirectoryPath(root, guard, withFileTypes, receipt);
|