@openclaw/feishu 2026.10.5 → 2026.10.10-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/{channel-DykAJJhn.mjs → channel-VyjzWvqm.mjs} +40 -39
- package/dist/.setup/{channel.runtime-CC15v8AP.mjs → channel.runtime-BjGRGNPJ.mjs} +6 -6
- package/dist/.setup/{chat-fC3dvxFs.mjs → chat-qj1pEIcO.mjs} +2 -2
- package/dist/.setup/{client-wwr8PGPH.mjs → client-BTiFlqqL.mjs} +2 -2
- package/dist/.setup/{doctor-contract-oIpUWtNO.mjs → doctor-contract-BNXcJcWR.mjs} +2 -2
- package/dist/.setup/{monitor-Cy9ofY1Q.mjs → monitor-DzmCjp4q.mjs} +3 -3
- package/dist/.setup/{monitor.account-UbN1RhlP.mjs → monitor.account-CpMwDf-a.mjs} +151 -367
- package/dist/.setup/{probe-DXnFxq5j.mjs → probe-s0hiM44D.mjs} +3 -3
- package/dist/.setup/{reply-delivery-result-iCCrdxE1.mjs → reply-delivery-result-DknmIzOB.mjs} +128 -18
- package/dist/.setup/secret-contract-DEyvsehF.mjs +47 -0
- package/dist/.setup/{secret-contract-api-D2-avpLT.mjs → secret-contract-api-XhxLE0dW.mjs} +1 -1
- package/dist/.setup/{setup-api-CRjDSHmn.mjs → setup-api-CH41-_5S.mjs} +1 -1
- package/dist/.setup/{subagent-hooks-CGq_-NJZ.mjs → subagent-hooks-CvVuM0O4.mjs} +2 -2
- package/dist/.setup/{thread-bindings-Pii2fAST.mjs → thread-bindings-BxKmOara.mjs} +24 -4
- package/dist/api.js +15 -20
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +148 -0
- package/node_modules/@openclaw/fs-safe/README.md +20 -4
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +28 -3
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-read.js +11 -5
- package/node_modules/@openclaw/fs-safe/dist/archive-zip-loader.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/archive.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.js +9 -2
- package/node_modules/@openclaw/fs-safe/dist/clone-metadata.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/clone-metadata.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/config.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/config.js +5 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +3 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +8 -7
- package/node_modules/@openclaw/fs-safe/dist/copy-link.d.ts +26 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-link.js +170 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-metadata.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-metadata.js +39 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +11 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +2 -4
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/copy.js +3 -3
- package/node_modules/@openclaw/fs-safe/dist/create.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/creation-boundary.js +7 -4
- package/node_modules/@openclaw/fs-safe/dist/darwin-acl.d.ts +12 -0
- package/node_modules/@openclaw/fs-safe/dist/darwin-acl.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-durability.d.ts +7 -4
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +20 -5
- package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.js +27 -2
- package/node_modules/@openclaw/fs-safe/dist/directory-receipt.d.ts +7 -7
- package/node_modules/@openclaw/fs-safe/dist/directory-receipt.js +9 -4
- package/node_modules/@openclaw/fs-safe/dist/durability.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/exact-identity.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/exact-identity.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/file-handle-transfer.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/file-hash.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/file-hash.js +11 -9
- package/node_modules/@openclaw/fs-safe/dist/file-identity.d.ts +7 -1
- package/node_modules/@openclaw/fs-safe/dist/file-identity.js +27 -5
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-admission.js +1 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +8 -1
- package/node_modules/@openclaw/fs-safe/dist/file-lock.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/file-write-lease.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/file-write-lease.js +42 -0
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +22 -15
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.js +5 -0
- package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/index.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-ownership.js +16 -3
- package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.js +24 -13
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +85 -18
- package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +5 -0
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +11 -0
- package/node_modules/@openclaw/fs-safe/dist/native-directory-observation.js +6 -4
- package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.js +26 -2
- package/node_modules/@openclaw/fs-safe/dist/native-guidance.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-guidance.js +21 -0
- package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/native-operations.js +8 -6
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +44 -4
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +85 -15
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.d.ts +3 -3
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +33 -6
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.d.ts +4 -1
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +22 -3
- package/node_modules/@openclaw/fs-safe/dist/native-policy-directory-observation.js +4 -3
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.js +16 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +15 -5
- package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.js +7 -0
- package/node_modules/@openclaw/fs-safe/dist/native-status.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/native-status.js +30 -0
- package/node_modules/@openclaw/fs-safe/dist/native.d.ts +31 -4
- package/node_modules/@openclaw/fs-safe/dist/native.js +107 -9
- package/node_modules/@openclaw/fs-safe/dist/opened-realpath.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/overwrite-file-handle.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/permissions-public.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/permissions-public.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/permissions-windows.js +83 -47
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.js +8 -3
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.js +13 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +10 -8
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +7 -5
- package/node_modules/@openclaw/fs-safe/dist/pipe.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/pipe.js +26 -0
- package/node_modules/@openclaw/fs-safe/dist/private-directory.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +2 -5
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.d.ts +3 -2
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +38 -10
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +92 -10
- package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-file.d.ts +5 -3
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +26 -20
- package/node_modules/@openclaw/fs-safe/dist/read-opened-file.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/read-opened-file.js +3 -4
- package/node_modules/@openclaw/fs-safe/dist/realpath.js +32 -0
- package/node_modules/@openclaw/fs-safe/dist/regular-file.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/regular-file.js +11 -15
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +3 -2
- package/node_modules/@openclaw/fs-safe/dist/root-copy.d.ts +18 -0
- package/node_modules/@openclaw/fs-safe/dist/root-copy.js +128 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +8 -13
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +252 -27
- package/node_modules/@openclaw/fs-safe/dist/root-directory-creation.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +11 -8
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +35 -13
- package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.js +108 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.d.ts +7 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.js +15 -0
- package/node_modules/@openclaw/fs-safe/dist/root-impl.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +154 -175
- package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.js +239 -0
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +37 -15
- package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.d.ts +32 -0
- package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.js +56 -0
- package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-public-types.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +95 -16
- package/node_modules/@openclaw/fs-safe/dist/root-remove.js +6 -4
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +23 -19
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +8 -6
- package/node_modules/@openclaw/fs-safe/dist/root-write-publication.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/secure-file-windows.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/secure-file.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/secure-file.js +10 -4
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-target.js +8 -1
- package/node_modules/@openclaw/fs-safe/dist/staged-directory.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/staged-directory.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +5 -3
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +13 -2
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.js +71 -3
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.js +22 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/test-hooks.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/test-hooks.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/trash.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/types.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.d.ts +5 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.js +39 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.js +25 -36
- package/node_modules/@openclaw/fs-safe/dist/windows-security-command.js +24 -5
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.js +7 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.d.ts +16 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.js +51 -0
- package/node_modules/@openclaw/fs-safe/dist/write-file-handle.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/write-file-handle.js +12 -10
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +2 -1
- package/node_modules/@openclaw/fs-safe/docs/archive.md +16 -0
- package/node_modules/@openclaw/fs-safe/docs/config.md +71 -1
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +45 -5
- package/node_modules/@openclaw/fs-safe/docs/copy.md +45 -5
- package/node_modules/@openclaw/fs-safe/docs/durability.md +34 -7
- package/node_modules/@openclaw/fs-safe/docs/errors.md +8 -0
- package/node_modules/@openclaw/fs-safe/docs/guest.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/install.md +47 -27
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +6 -6
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.6.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +79 -6
- package/node_modules/@openclaw/fs-safe/docs/native.md +279 -8
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +64 -15
- package/node_modules/@openclaw/fs-safe/docs/pipe.md +81 -0
- package/node_modules/@openclaw/fs-safe/docs/platform-capabilities.md +63 -0
- package/node_modules/@openclaw/fs-safe/docs/public-api.md +10 -0
- package/node_modules/@openclaw/fs-safe/docs/queue-link-free-design.md +237 -0
- package/node_modules/@openclaw/fs-safe/docs/quickstart.md +23 -3
- package/node_modules/@openclaw/fs-safe/docs/reading.md +56 -2
- package/node_modules/@openclaw/fs-safe/docs/regular-file.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/secret-file.md +5 -5
- package/node_modules/@openclaw/fs-safe/docs/secure-file.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +35 -0
- package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +31 -13
- package/node_modules/@openclaw/fs-safe/docs/staged-file.md +18 -0
- package/node_modules/@openclaw/fs-safe/docs/store.md +15 -0
- package/node_modules/@openclaw/fs-safe/docs/temp.md +39 -0
- package/node_modules/@openclaw/fs-safe/docs/testing.md +13 -0
- package/node_modules/@openclaw/fs-safe/docs/types.md +51 -81
- package/node_modules/@openclaw/fs-safe/docs/walk.md +4 -1
- package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
- package/node_modules/@openclaw/fs-safe/docs/writing.md +121 -14
- package/node_modules/@openclaw/fs-safe/package.json +21 -12
- 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-freebsd-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +29 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +29 -0
- 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-arm64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +29 -0
- 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/mdast-util-from-markdown/dev/lib/index.js +152 -45
- package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +26 -0
- package/node_modules/mdast-util-from-markdown/lib/index.js +133 -40
- package/node_modules/mdast-util-from-markdown/lib/types.d.ts +26 -0
- package/node_modules/mdast-util-from-markdown/package.json +6 -7
- package/node_modules/mdast-util-from-markdown/readme.md +15 -1
- package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +7 -7
- package/dist/.setup/secret-contract-CI1wCr9i.mjs +0 -60
- package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.cs +0 -336
- package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.ps1 +0 -90
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { c as normalizeFeishuExternalKey, g as resolveFeishuRuntimeAccount, h as resolveFeishuAccount, s as normalizeFeishuWebhookPath } from "./doctor-contract-
|
|
1
|
+
import { c as normalizeFeishuExternalKey, g as resolveFeishuRuntimeAccount, h as resolveFeishuAccount, s as normalizeFeishuWebhookPath } from "./doctor-contract-BNXcJcWR.mjs";
|
|
2
2
|
import { o as resolveConfiguredFeishuGroupSessionScope, t as buildFeishuConversationId, u as resolveReceiveIdType } from "./conversation-id-D00i9uy5.mjs";
|
|
3
|
-
import { c as resolveFeishuLegacyWebhookListener, l as gateway_config_runtime_exports, s as describeFeishuWebhookPathConflict } from "./channel-
|
|
4
|
-
import { A as sendMessageFeishu, At as
|
|
3
|
+
import { c as resolveFeishuLegacyWebhookListener, l as gateway_config_runtime_exports, s as describeFeishuWebhookPathConflict } from "./channel-VyjzWvqm.mjs";
|
|
4
|
+
import { A as sendMessageFeishu, At as resolveFeishuGroupConfig, B as parseInteractiveCardContent, D as getMessageFeishu, Dt as hasExplicitFeishuGroupConfig, F as isFeishuBroadcastMention, Ft as normalizeFeishuChatType, G as resolveFeishuIdentityEmoji, H as resolveFeishuSenderName, I as isMentionForwardRequest, It as resolveFeishuChatType, L as normalizeMentions, Mt as resolveFeishuGroupSenderActivationIngressAccess, N as formatFeishuMediaContent, O as listFeishuThreadMessages, Ot as normalizeFeishuAllowEntry, P as extractMentionTargets, Pt as resolveFeishuReplyPolicy, R as isFeishuGroupChatType, Rt as createFeishuCardInteractionEnvelope, S as sendMediaFeishu, T as chunkFeishuCardMarkdown, V as parsePostContent, W as buildFeishuMediaFallbackText, _t as shouldUseFeishuCard, a as shouldSendNoVisibleReplyFallback, b as withinCardTableLimit, ct as buildFeishuCommentTarget, d as consumeFeishuPresentationFallbackMarker, ft as resolveFeishuCardTemplate, ht as materializeFeishuPostMarkdownSoftBreaks, i as noVisibleFeishuReplyDelivery, it as extractReplyText, j as sendStructuredCardFeishu, jt as resolveFeishuGroupConversationIngressAccess, k as sendCardFeishu, kt as resolveFeishuDmIngressAccess, lt as normalizeCommentFileType, mt as chunkFeishuPostMarkdown, n as createFeishuReplyDeliveryResult, nt as createCommentTypingReactionLifecycle, ot as parseCommentContentElements, q as deliverCommentThreadText, r as mergeFeishuReplyDeliveryResults, rt as encodeQuery, st as requestFeishuApi, t as createFeishuPartialReplyDeliveryError, u as buildFeishuPresentationFallback, v as renderFeishuReplyPayload, w as shouldSuppressFeishuTextForVoiceMedia, x as saveMessageResourceFeishu, y as resolveFeishuRichReply, z as normalizeFeishuEventChatType, zt as decodeFeishuCardAction } from "./reply-delivery-result-DknmIzOB.mjs";
|
|
5
5
|
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.mjs";
|
|
6
|
-
import { a as getFeishuUserAgent, f as resolveConfiguredHttpTimeoutMs, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { a as getFeishuUserAgent, f as resolveConfiguredHttpTimeoutMs, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-BTiFlqqL.mjs";
|
|
7
|
+
import { t as createFeishuThreadBindingManager } from "./thread-bindings-BxKmOara.mjs";
|
|
8
|
+
import { r as getChatInfo } from "./chat-qj1pEIcO.mjs";
|
|
9
9
|
import { evaluateSupplementalContextVisibility, normalizeAgentId as normalizeAgentId$1, resolveChannelContextVisibilityMode } from "../runtime-api.js";
|
|
10
10
|
import { t as readFeishuJsonResponse } from "./json-response-DXajw_FU.mjs";
|
|
11
|
-
import { a as waitForAbortableDelay, i as raceWithTimeoutAndAbort } from "./probe-
|
|
12
|
-
import { t as fetchBotIdentityForMonitor } from "./monitor-
|
|
11
|
+
import { a as waitForAbortableDelay, i as raceWithTimeoutAndAbort } from "./probe-s0hiM44D.mjs";
|
|
12
|
+
import { t as fetchBotIdentityForMonitor } from "./monitor-DzmCjp4q.mjs";
|
|
13
13
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
14
14
|
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createChannelMessageReplyPipeline, createReplyPrefixContext, formatChannelProgressDraftLineForEntry, resolveAgentOutboundIdentity, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
15
15
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
16
|
-
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-runtime";
|
|
17
16
|
import { collectErrorGraphCandidates, formatErrorMessage, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
18
|
-
import { asDateTimestampMs, isFutureDateTimestampMs, parseStrictNonNegativeInteger, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveExpiresAtMsFromDurationSeconds, resolvePromptHistoryLimit
|
|
19
|
-
import { asBoolean, asNullableRecord, isRecord,
|
|
17
|
+
import { asDateTimestampMs, isFutureDateTimestampMs, parseStrictNonNegativeInteger, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveExpiresAtMsFromDurationSeconds, resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
|
|
18
|
+
import { asBoolean, asNullableRecord, isRecord, normalizeNullableString, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeTrimmedStringList, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
19
|
import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
21
20
|
import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
22
21
|
import { fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
@@ -25,7 +24,7 @@ import fs from "node:fs";
|
|
|
25
24
|
import os from "node:os";
|
|
26
25
|
import path from "node:path";
|
|
27
26
|
import { normalizeAccountId, resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
28
|
-
import {
|
|
27
|
+
import { getSessionEntryAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
29
28
|
import { formatAgentEnvelope, formatInboundMediaUnavailableText, isChannelPartialDeliveryError, recordChannelBotPairLoopAndCheckSuppression, resolveEnvelopeFormatOptions, resolveInboundReplyDispatchCounts, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
30
29
|
import { getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
31
30
|
import { resolvePinnedMainDmOwnerFromAllowlist, safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -33,10 +32,11 @@ import * as Lark from "@larksuiteoapi/node-sdk";
|
|
|
33
32
|
import { isRecord as isRecord$1 } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
34
33
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
35
34
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
35
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
36
36
|
import { safeParseJson, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
37
|
+
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRouteAsync } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
37
38
|
import * as crypto$1 from "node:crypto";
|
|
38
39
|
import crypto, { createHash } from "node:crypto";
|
|
39
|
-
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
40
40
|
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
41
41
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
42
42
|
import { createChannelReplayGuard } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
@@ -100,15 +100,13 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
100
100
|
const fallbackAbort = new AbortController();
|
|
101
101
|
let fanoutSettled = false;
|
|
102
102
|
let terminal;
|
|
103
|
-
let
|
|
104
|
-
let abandonment;
|
|
103
|
+
let terminalSettled = false;
|
|
105
104
|
let finalizing = false;
|
|
106
105
|
let deferred = false;
|
|
107
|
-
let replayReleased = false;
|
|
108
106
|
const settlement = createDeferred();
|
|
109
107
|
params.trackTask?.(settlement.promise);
|
|
110
108
|
const finishSettlement = () => {
|
|
111
|
-
if (![...lanes].some((lane) => lane.adopting)) settlement.resolve();
|
|
109
|
+
if (terminalSettled && ![...lanes].some((lane) => lane.adopting)) settlement.resolve();
|
|
112
110
|
};
|
|
113
111
|
const beginFinalizing = () => {
|
|
114
112
|
if (finalizing) return;
|
|
@@ -125,37 +123,24 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
125
123
|
params.onReplayCommitError?.(error);
|
|
126
124
|
} catch {}
|
|
127
125
|
};
|
|
128
|
-
const
|
|
129
|
-
if (replayReleased || terminal === "adopted") return;
|
|
130
|
-
replayReleased = true;
|
|
131
|
-
params.replayClaim?.release({ error });
|
|
132
|
-
};
|
|
133
|
-
const runAbandonment = async (error) => {
|
|
126
|
+
const abandon = async (error) => {
|
|
134
127
|
if (terminal) return;
|
|
135
|
-
|
|
128
|
+
terminal = "abandoned";
|
|
129
|
+
params.replayClaim?.release({ error });
|
|
136
130
|
try {
|
|
137
131
|
await params.lifecycle?.onAbandoned();
|
|
138
132
|
} finally {
|
|
139
|
-
terminal = "abandoned";
|
|
140
133
|
fallbackAbort.abort(error);
|
|
134
|
+
terminalSettled = true;
|
|
141
135
|
finishSettlement();
|
|
142
136
|
}
|
|
143
137
|
};
|
|
144
|
-
const
|
|
138
|
+
const adopt = async () => {
|
|
145
139
|
if (terminal) return;
|
|
146
|
-
|
|
147
|
-
await adoption.catch(() => void 0);
|
|
148
|
-
if (terminal) return;
|
|
149
|
-
}
|
|
150
|
-
const activeAbandonment = abandonment ?? runAbandonment(error);
|
|
151
|
-
abandonment = activeAbandonment;
|
|
152
|
-
await activeAbandonment;
|
|
153
|
-
};
|
|
154
|
-
const runAdoption = async () => {
|
|
140
|
+
terminal = "adopted";
|
|
155
141
|
try {
|
|
156
142
|
beginFinalizing();
|
|
157
143
|
await params.lifecycle?.onAdopted();
|
|
158
|
-
terminal = "adopted";
|
|
159
144
|
try {
|
|
160
145
|
params.onAdopted?.();
|
|
161
146
|
} catch {}
|
|
@@ -165,29 +150,21 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
165
150
|
reportReplayCommitError(error);
|
|
166
151
|
}
|
|
167
152
|
} catch (error) {
|
|
168
|
-
|
|
153
|
+
terminal = void 0;
|
|
154
|
+
await abandon(error).catch(() => void 0);
|
|
169
155
|
throw error;
|
|
170
156
|
} finally {
|
|
157
|
+
terminalSettled = true;
|
|
171
158
|
finishSettlement();
|
|
172
159
|
}
|
|
173
160
|
};
|
|
174
|
-
const adopt = async () => {
|
|
175
|
-
if (terminal) return;
|
|
176
|
-
if (abandonment) {
|
|
177
|
-
await abandonment.catch(() => void 0);
|
|
178
|
-
if (terminal) return;
|
|
179
|
-
}
|
|
180
|
-
const activeAdoption = adoption ?? runAdoption();
|
|
181
|
-
adoption = activeAdoption;
|
|
182
|
-
await activeAdoption;
|
|
183
|
-
};
|
|
184
161
|
const maybeSettle = async () => {
|
|
185
162
|
if (!fanoutSettled || terminal) return;
|
|
186
|
-
if (failures.length > 0 || [...lanes].some((lane) => lane.status === "failed"
|
|
163
|
+
if (failures.length > 0 || [...lanes].some((lane) => lane.status === "failed")) {
|
|
187
164
|
await abandon(failures.length === 1 ? failures[0] : new AggregateError(failures, "Feishu broadcast dispatch failed"));
|
|
188
165
|
return;
|
|
189
166
|
}
|
|
190
|
-
if ([...lanes].some((lane) => lane.status
|
|
167
|
+
if ([...lanes].some((lane) => lane.status !== "completed")) return;
|
|
191
168
|
await adopt();
|
|
192
169
|
};
|
|
193
170
|
return {
|
|
@@ -201,8 +178,7 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
201
178
|
lifecycle: {
|
|
202
179
|
abortSignal: params.lifecycle?.abortSignal ?? fallbackAbort.signal,
|
|
203
180
|
onAdopted: async () => {
|
|
204
|
-
if (terminal || lane.
|
|
205
|
-
lane.status = "adopted";
|
|
181
|
+
if (terminal || lane.adopting || lane.status === "completed" || lane.status === "failed") return;
|
|
206
182
|
lane.adopting = true;
|
|
207
183
|
try {
|
|
208
184
|
beginFinalizing();
|
|
@@ -227,14 +203,14 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
227
203
|
deferredHeartbeatIntervalMs: params.lifecycle?.deferredHeartbeatIntervalMs,
|
|
228
204
|
onAdoptionFinalizing: beginFinalizing,
|
|
229
205
|
onAbandoned: async () => {
|
|
230
|
-
if (lane.
|
|
231
|
-
lane.status = "
|
|
206
|
+
if (lane.adopting || lane.status === "completed" || lane.status === "failed") return;
|
|
207
|
+
lane.status = "failed";
|
|
232
208
|
lane.replayClaim?.release({ error: /* @__PURE__ */ new Error("feishu-broadcast-turn-abandoned") });
|
|
233
209
|
await maybeSettle();
|
|
234
210
|
}
|
|
235
211
|
},
|
|
236
212
|
onDispatchComplete: async (dispatched) => {
|
|
237
|
-
if (lane.status !== "pending") return;
|
|
213
|
+
if (lane.adopting || lane.status !== "pending") return;
|
|
238
214
|
const error = /* @__PURE__ */ new Error(dispatched ? "feishu broadcast dispatch returned before turn adoption" : "feishu broadcast lane was not dispatched");
|
|
239
215
|
lane.status = "failed";
|
|
240
216
|
failures.push(error);
|
|
@@ -242,7 +218,7 @@ function createFeishuBroadcastIngressSettlement(params) {
|
|
|
242
218
|
},
|
|
243
219
|
onDispatchFailed: async (error) => {
|
|
244
220
|
failures.push(error);
|
|
245
|
-
if (lane.status !== "completed") {
|
|
221
|
+
if (!lane.adopting && lane.status !== "completed") {
|
|
246
222
|
lane.status = "failed";
|
|
247
223
|
lane.replayClaim?.release({ error });
|
|
248
224
|
}
|
|
@@ -438,23 +414,15 @@ const feishuGroupNameCache = /* @__PURE__ */ new Map();
|
|
|
438
414
|
const GROUP_NAME_CACHE_TTL_MS = 18e5;
|
|
439
415
|
const GROUP_NAME_CACHE_MAX_SIZE = 500;
|
|
440
416
|
function evictGroupNameCache() {
|
|
441
|
-
const now =
|
|
442
|
-
if (
|
|
443
|
-
feishuGroupNameCache.clear();
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
for (const [key, value] of feishuGroupNameCache) {
|
|
447
|
-
const expiresAt = asDateTimestampMs(value.expiresAt);
|
|
448
|
-
if (expiresAt === void 0 || expiresAt <= now) feishuGroupNameCache.delete(key);
|
|
449
|
-
}
|
|
417
|
+
const now = Date.now();
|
|
418
|
+
for (const [key, value] of feishuGroupNameCache) if (value.expiresAt <= now) feishuGroupNameCache.delete(key);
|
|
450
419
|
pruneMapToMaxSize(feishuGroupNameCache, GROUP_NAME_CACHE_MAX_SIZE);
|
|
451
420
|
}
|
|
452
421
|
function setCacheEntry(key, name) {
|
|
453
|
-
const expiresAt = resolveExpiresAtMsFromDurationMs(GROUP_NAME_CACHE_TTL_MS);
|
|
454
422
|
feishuGroupNameCache.delete(key);
|
|
455
|
-
|
|
423
|
+
feishuGroupNameCache.set(key, {
|
|
456
424
|
name,
|
|
457
|
-
expiresAt
|
|
425
|
+
expiresAt: Date.now() + GROUP_NAME_CACHE_TTL_MS
|
|
458
426
|
});
|
|
459
427
|
}
|
|
460
428
|
async function resolveGroupName(params) {
|
|
@@ -463,9 +431,7 @@ async function resolveGroupName(params) {
|
|
|
463
431
|
const cacheKey = `${account.accountId}:${chatId}`;
|
|
464
432
|
const cached = feishuGroupNameCache.get(cacheKey);
|
|
465
433
|
if (cached) {
|
|
466
|
-
|
|
467
|
-
const expiresAt = asDateTimestampMs(cached.expiresAt);
|
|
468
|
-
if (now !== void 0 && expiresAt !== void 0 && expiresAt > now) return cached.name || void 0;
|
|
434
|
+
if (cached.expiresAt > Date.now()) return cached.name || void 0;
|
|
469
435
|
feishuGroupNameCache.delete(cacheKey);
|
|
470
436
|
}
|
|
471
437
|
let resolvedName;
|
|
@@ -617,96 +583,6 @@ async function resolveFeishuBotName(params) {
|
|
|
617
583
|
}
|
|
618
584
|
}
|
|
619
585
|
//#endregion
|
|
620
|
-
//#region extensions/feishu/src/bot-sender-name.ts
|
|
621
|
-
const STALE_CONTACT_SCOPE = "contact:contact.base:readonly";
|
|
622
|
-
const FEISHU_USER_LOOKUP_UNAUTHORIZED_CODE = 41050;
|
|
623
|
-
const SENDER_NAME_TTL_MS = 6e5;
|
|
624
|
-
const SENDER_NAME_NEGATIVE_TTL_MS = 18e5;
|
|
625
|
-
const SENDER_NAME_CACHE_MAX_SIZE = 500;
|
|
626
|
-
const senderNameCache = /* @__PURE__ */ new Map();
|
|
627
|
-
function extractFeishuApiError(err) {
|
|
628
|
-
if (!err || typeof err !== "object") return null;
|
|
629
|
-
const data = err.response?.data;
|
|
630
|
-
if (!data || typeof data !== "object") return null;
|
|
631
|
-
const feishuErr = data;
|
|
632
|
-
if (typeof feishuErr.code !== "number") return null;
|
|
633
|
-
return {
|
|
634
|
-
code: feishuErr.code,
|
|
635
|
-
message: typeof feishuErr.msg === "string" ? feishuErr.msg : ""
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
function extractPermissionError(feishuErr) {
|
|
639
|
-
if (feishuErr?.code !== 99991672) return null;
|
|
640
|
-
const urlMatch = feishuErr.message.match(/https:\/\/[^\s,]+\/app\/[^\s,]+/);
|
|
641
|
-
return {
|
|
642
|
-
code: feishuErr.code,
|
|
643
|
-
message: feishuErr.message,
|
|
644
|
-
grantUrl: urlMatch?.[0]?.replaceAll(encodeURIComponent(STALE_CONTACT_SCOPE), encodeURIComponent("contact:user.base:readonly")).replaceAll(STALE_CONTACT_SCOPE, "contact:user.base:readonly")
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
function writeSenderNameCache(key, entry) {
|
|
648
|
-
senderNameCache.delete(key);
|
|
649
|
-
senderNameCache.set(key, entry);
|
|
650
|
-
pruneMapToMaxSize(senderNameCache, SENDER_NAME_CACHE_MAX_SIZE);
|
|
651
|
-
}
|
|
652
|
-
function resolveSenderLookupIdType(senderId) {
|
|
653
|
-
if (senderId.startsWith("ou_")) return "open_id";
|
|
654
|
-
if (senderId.startsWith("on_")) return "union_id";
|
|
655
|
-
return "user_id";
|
|
656
|
-
}
|
|
657
|
-
async function resolveFeishuSenderName(params) {
|
|
658
|
-
const { account, senderId, log } = params;
|
|
659
|
-
if (!account.configured) return {};
|
|
660
|
-
const normalizedSenderId = senderId.trim();
|
|
661
|
-
if (!normalizedSenderId) return {};
|
|
662
|
-
const cacheKey = `${account.accountId}:${normalizedSenderId}`;
|
|
663
|
-
const cached = senderNameCache.get(cacheKey);
|
|
664
|
-
const now = asDateTimestampMs(Date.now());
|
|
665
|
-
const cachedExpireAt = cached ? asDateTimestampMs(cached.expireAt) : void 0;
|
|
666
|
-
if (cached && now !== void 0 && cachedExpireAt !== void 0 && cachedExpireAt > now) return cached.kind === "resolved" ? { name: cached.name } : {};
|
|
667
|
-
if (cached) senderNameCache.delete(cacheKey);
|
|
668
|
-
try {
|
|
669
|
-
const client = createFeishuClient(account);
|
|
670
|
-
const userIdType = resolveSenderLookupIdType(normalizedSenderId);
|
|
671
|
-
const user = (await client.contact.user.get({
|
|
672
|
-
path: { user_id: normalizedSenderId },
|
|
673
|
-
params: { user_id_type: userIdType }
|
|
674
|
-
})).data?.user;
|
|
675
|
-
const name = user?.name ?? user?.nickname ?? user?.en_name;
|
|
676
|
-
if (name) {
|
|
677
|
-
const expireAt = resolveExpiresAtMsFromDurationMs(SENDER_NAME_TTL_MS);
|
|
678
|
-
if (expireAt !== void 0) writeSenderNameCache(cacheKey, {
|
|
679
|
-
kind: "resolved",
|
|
680
|
-
name,
|
|
681
|
-
expireAt
|
|
682
|
-
});
|
|
683
|
-
return { name };
|
|
684
|
-
}
|
|
685
|
-
return {};
|
|
686
|
-
} catch (err) {
|
|
687
|
-
const feishuErr = extractFeishuApiError(err);
|
|
688
|
-
const permErr = extractPermissionError(feishuErr);
|
|
689
|
-
if (permErr) {
|
|
690
|
-
if (normalizeLowercaseStringOrEmpty(permErr.message).includes(STALE_CONTACT_SCOPE)) {
|
|
691
|
-
log(`feishu: ignoring stale permission scope error: ${permErr.message}`);
|
|
692
|
-
return {};
|
|
693
|
-
}
|
|
694
|
-
log(`feishu: permission error resolving sender name: code=${permErr.code}`);
|
|
695
|
-
return { permissionError: permErr };
|
|
696
|
-
}
|
|
697
|
-
if (feishuErr?.code === FEISHU_USER_LOOKUP_UNAUTHORIZED_CODE) {
|
|
698
|
-
const expireAt = resolveExpiresAtMsFromDurationMs(SENDER_NAME_NEGATIVE_TTL_MS);
|
|
699
|
-
if (expireAt !== void 0) writeSenderNameCache(cacheKey, {
|
|
700
|
-
kind: "unavailable",
|
|
701
|
-
expireAt
|
|
702
|
-
});
|
|
703
|
-
return {};
|
|
704
|
-
}
|
|
705
|
-
log(`feishu: failed to resolve sender name for ${normalizedSenderId}: ${String(err)}`);
|
|
706
|
-
return {};
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
//#endregion
|
|
710
586
|
//#region extensions/feishu/src/bot-thread-mentions.ts
|
|
711
587
|
async function prepareFeishuThreadRoot(params) {
|
|
712
588
|
let { cfg, account } = params;
|
|
@@ -1026,15 +902,15 @@ function resolveUserPath(p) {
|
|
|
1026
902
|
}
|
|
1027
903
|
//#endregion
|
|
1028
904
|
//#region extensions/feishu/src/reasoning-preview.ts
|
|
1029
|
-
function resolveFeishuReasoningPreviewEnabled(params) {
|
|
905
|
+
async function resolveFeishuReasoningPreviewEnabled(params) {
|
|
1030
906
|
const configDefault = resolveAgentConfig(params.cfg, params.agentId)?.reasoningDefault ?? params.cfg.agents?.defaults?.reasoningDefault ?? "off";
|
|
1031
907
|
if (!params.sessionKey) return configDefault === "stream";
|
|
1032
908
|
try {
|
|
1033
|
-
const level =
|
|
909
|
+
const level = (await getSessionEntryAsync({
|
|
1034
910
|
storePath: params.storePath,
|
|
1035
911
|
sessionKey: params.sessionKey,
|
|
1036
912
|
readConsistency: "latest"
|
|
1037
|
-
})?.reasoningLevel;
|
|
913
|
+
}))?.reasoningLevel;
|
|
1038
914
|
if (level === "on" || level === "stream" || level === "off") return level === "stream";
|
|
1039
915
|
} catch {
|
|
1040
916
|
return false;
|
|
@@ -1379,7 +1255,8 @@ var FeishuStreamingSession = class {
|
|
|
1379
1255
|
const result = {
|
|
1380
1256
|
visibleReplySent: visibleContentSent,
|
|
1381
1257
|
...visibleContentSent ? { content: finalState.sentText } : {},
|
|
1382
|
-
...finalState.messageId ? { messageId: finalState.messageId } : {}
|
|
1258
|
+
...finalState.messageId ? { messageId: finalState.messageId } : {},
|
|
1259
|
+
...finalWriteError === void 0 ? {} : { finalTextAccepted: false }
|
|
1383
1260
|
};
|
|
1384
1261
|
if (finalWriteError !== void 0 || closeError !== void 0) throw new FeishuStreamingFinalizationError(finalWriteError !== void 0 && closeError !== void 0 ? new AggregateError([finalWriteError, closeError], "Feishu streaming card finalization failed") : finalWriteError ?? closeError, result);
|
|
1385
1262
|
return result;
|
|
@@ -1412,10 +1289,10 @@ var FeishuStreamingSession = class {
|
|
|
1412
1289
|
//#region extensions/feishu/src/streaming-update.ts
|
|
1413
1290
|
/** Admit captured snapshots in order while the session owns provider writes. */
|
|
1414
1291
|
function queueFeishuStreamingUpdate(params) {
|
|
1415
|
-
const { queue, session,
|
|
1292
|
+
const { queue, session, startPromise, text, accountId, runtime } = params;
|
|
1416
1293
|
return queue.then(async () => {
|
|
1417
1294
|
if (startPromise) await startPromise;
|
|
1418
|
-
if (
|
|
1295
|
+
if (session?.isActive()) session.update(text).catch((error) => runtime.error?.(`feishu[${accountId}] streaming update failed: ${String(error)}`));
|
|
1419
1296
|
});
|
|
1420
1297
|
}
|
|
1421
1298
|
//#endregion
|
|
@@ -1643,13 +1520,12 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1643
1520
|
let lastSnapshotTextLength = 0;
|
|
1644
1521
|
let hasStreamingFinalText = false;
|
|
1645
1522
|
const deliveredFinalTexts = /* @__PURE__ */ new Set();
|
|
1646
|
-
|
|
1523
|
+
let lastStreamingSettlement;
|
|
1647
1524
|
let sentIndependentBlockText = false;
|
|
1648
1525
|
let partialUpdateQueue = Promise.resolve();
|
|
1649
1526
|
let streamingStartPromise = null;
|
|
1650
|
-
let streamingGeneration = 0;
|
|
1651
|
-
let activeStreamingGeneration;
|
|
1652
1527
|
let inFlightStreamingClose;
|
|
1528
|
+
let closingStreamingText;
|
|
1653
1529
|
let visibleReplySent = false;
|
|
1654
1530
|
let replyOutcome;
|
|
1655
1531
|
let idleSideEffectsPromise = Promise.resolve();
|
|
@@ -1668,7 +1544,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1668
1544
|
partialUpdateQueue = queueFeishuStreamingUpdate({
|
|
1669
1545
|
queue: partialUpdateQueue,
|
|
1670
1546
|
session: streaming,
|
|
1671
|
-
generation: activeStreamingGeneration,
|
|
1672
1547
|
startPromise: streamingStartPromise,
|
|
1673
1548
|
text: combined,
|
|
1674
1549
|
accountId: account.accountId,
|
|
@@ -1701,9 +1576,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1701
1576
|
} : null;
|
|
1702
1577
|
if (!creds) return;
|
|
1703
1578
|
const session = new FeishuStreamingSession(createFeishuClient(account), creds, (message) => params.runtime.log?.(`feishu[${account.accountId}] ${message}`));
|
|
1704
|
-
const generation = ++streamingGeneration;
|
|
1705
1579
|
streaming = session;
|
|
1706
|
-
activeStreamingGeneration = generation;
|
|
1707
1580
|
try {
|
|
1708
1581
|
const cardHeader = resolveCardHeader(agentId, identity);
|
|
1709
1582
|
const cardNote = resolveCardNote(agentId, identity, responsePrefixContextProvider());
|
|
@@ -1722,7 +1595,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1722
1595
|
if (streaming === session) {
|
|
1723
1596
|
streaming = null;
|
|
1724
1597
|
streamingStartPromise = null;
|
|
1725
|
-
activeStreamingGeneration = void 0;
|
|
1726
1598
|
}
|
|
1727
1599
|
}
|
|
1728
1600
|
})();
|
|
@@ -1730,7 +1602,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1730
1602
|
const resetStreamingState = () => {
|
|
1731
1603
|
streaming = null;
|
|
1732
1604
|
streamingStartPromise = null;
|
|
1733
|
-
activeStreamingGeneration = void 0;
|
|
1734
1605
|
partialUpdateQueue = Promise.resolve();
|
|
1735
1606
|
streamText = "";
|
|
1736
1607
|
lastPartial = "";
|
|
@@ -1740,27 +1611,21 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1740
1611
|
lastSnapshotTextLength = 0;
|
|
1741
1612
|
hasStreamingFinalText = false;
|
|
1742
1613
|
};
|
|
1743
|
-
const rememberClosedStreamingSettlement = (generation, content, result, error, disposition = "closed") => {
|
|
1744
|
-
if (generation === void 0 || !content && disposition === "closed") return;
|
|
1745
|
-
closedStreamingSettlements.set(generation, {
|
|
1746
|
-
disposition,
|
|
1747
|
-
result,
|
|
1748
|
-
content,
|
|
1749
|
-
...error === void 0 ? {} : { error }
|
|
1750
|
-
});
|
|
1751
|
-
};
|
|
1752
1614
|
const performStreamingClose = async (disposition) => {
|
|
1753
1615
|
const streamingToClose = streaming;
|
|
1754
|
-
|
|
1616
|
+
if (!streamingToClose) return lastStreamingSettlement ?? {
|
|
1617
|
+
disposition,
|
|
1618
|
+
result: noVisibleFeishuReplyDelivery
|
|
1619
|
+
};
|
|
1755
1620
|
const startPromiseToClose = streamingStartPromise;
|
|
1756
1621
|
const updateQueueToClose = partialUpdateQueue;
|
|
1757
1622
|
const finalizedAnswerText = streamText;
|
|
1758
1623
|
const finalizedReasoningText = reasoningText;
|
|
1759
1624
|
const outcome = {
|
|
1760
1625
|
disposition,
|
|
1761
|
-
|
|
1626
|
+
content: finalizedAnswerText
|
|
1762
1627
|
};
|
|
1763
|
-
|
|
1628
|
+
resetStreamingState();
|
|
1764
1629
|
try {
|
|
1765
1630
|
if (startPromiseToClose) await startPromiseToClose;
|
|
1766
1631
|
await updateQueueToClose;
|
|
@@ -1781,61 +1646,48 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1781
1646
|
closed = error.result;
|
|
1782
1647
|
finalizationError = error;
|
|
1783
1648
|
}
|
|
1784
|
-
result =
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1649
|
+
result = {
|
|
1650
|
+
...createFeishuReplyDeliveryResult({
|
|
1651
|
+
results: [closed],
|
|
1652
|
+
visibleReplySent: closed.visibleReplySent,
|
|
1653
|
+
content: closed.content,
|
|
1654
|
+
kind: "card"
|
|
1655
|
+
}),
|
|
1656
|
+
...closed.finalTextAccepted === false ? { finalTextAccepted: false } : {}
|
|
1657
|
+
};
|
|
1790
1658
|
if (result.visibleReplySent) visibleReplySent = true;
|
|
1791
1659
|
if (disposition === "closed" && result.visibleReplySent && finalizedAnswerText && (finalizationError === void 0 || result.content === text)) deliveredFinalTexts.add(finalizedAnswerText);
|
|
1792
1660
|
if (finalizationError instanceof FeishuStreamingFinalizationError && result.visibleReplySent) finalizationError = createFeishuPartialReplyDeliveryError(finalizationError.cause ?? finalizationError, result);
|
|
1793
1661
|
}
|
|
1794
|
-
if (disposition === "discarded" || finalizationError !== void 0 || result.visibleReplySent && finalizedAnswerText) rememberClosedStreamingSettlement(generationToClose, finalizedAnswerText, result, finalizationError, disposition);
|
|
1795
1662
|
return {
|
|
1796
1663
|
...outcome,
|
|
1797
1664
|
result,
|
|
1798
1665
|
...finalizationError === void 0 ? {} : { error: finalizationError }
|
|
1799
1666
|
};
|
|
1800
1667
|
} catch (error) {
|
|
1801
|
-
if (disposition === "discarded") rememberClosedStreamingSettlement(generationToClose, finalizedAnswerText, noVisibleFeishuReplyDelivery, error, disposition);
|
|
1802
1668
|
return {
|
|
1803
1669
|
...outcome,
|
|
1804
1670
|
result: noVisibleFeishuReplyDelivery,
|
|
1805
1671
|
error
|
|
1806
1672
|
};
|
|
1807
|
-
} finally {
|
|
1808
|
-
if (streaming === streamingToClose) resetStreamingState();
|
|
1809
1673
|
}
|
|
1810
1674
|
};
|
|
1811
1675
|
const closeStreaming = (disposition = "closed") => {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
content,
|
|
1822
|
-
disposition,
|
|
1823
|
-
promise: closePromise
|
|
1824
|
-
};
|
|
1825
|
-
inFlightStreamingClose = closing;
|
|
1826
|
-
const clear = () => {
|
|
1827
|
-
if (inFlightStreamingClose === closing) inFlightStreamingClose = void 0;
|
|
1828
|
-
};
|
|
1829
|
-
closePromise.then(clear, clear);
|
|
1830
|
-
}
|
|
1831
|
-
return closePromise;
|
|
1676
|
+
if (inFlightStreamingClose) return inFlightStreamingClose;
|
|
1677
|
+
closingStreamingText = streamText;
|
|
1678
|
+
inFlightStreamingClose = performStreamingClose(disposition).then((outcome) => {
|
|
1679
|
+
lastStreamingSettlement = outcome;
|
|
1680
|
+
inFlightStreamingClose = void 0;
|
|
1681
|
+
closingStreamingText = void 0;
|
|
1682
|
+
return outcome;
|
|
1683
|
+
});
|
|
1684
|
+
return inFlightStreamingClose;
|
|
1832
1685
|
};
|
|
1833
|
-
const deferStreamingDelivery = (result, infoKind
|
|
1686
|
+
const deferStreamingDelivery = (result, infoKind) => {
|
|
1834
1687
|
const { promise: finalization, resolve, reject } = createDeferred();
|
|
1835
1688
|
pendingStreamingDeliveries.push({
|
|
1836
1689
|
result,
|
|
1837
1690
|
...infoKind ? { infoKind } : {},
|
|
1838
|
-
...ownerGeneration === void 0 ? {} : { streamingGeneration: ownerGeneration },
|
|
1839
1691
|
resolve,
|
|
1840
1692
|
reject
|
|
1841
1693
|
});
|
|
@@ -1846,10 +1698,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1846
1698
|
};
|
|
1847
1699
|
};
|
|
1848
1700
|
const discardStreamingPreview = async () => {
|
|
1849
|
-
if (
|
|
1850
|
-
resetStreamingState();
|
|
1851
|
-
return;
|
|
1852
|
-
}
|
|
1701
|
+
if (inFlightStreamingClose && !streaming) return;
|
|
1853
1702
|
const outcome = await closeStreaming("discarded");
|
|
1854
1703
|
if (outcome.error !== void 0) throw toStringifiedError(outcome.error);
|
|
1855
1704
|
};
|
|
@@ -1990,25 +1839,33 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1990
1839
|
params.runtime.error?.(`feishu[${account.accountId}]: sent no-visible-reply fallback (${reason})`);
|
|
1991
1840
|
return true;
|
|
1992
1841
|
};
|
|
1993
|
-
const
|
|
1994
|
-
if (generation !== void 0) {
|
|
1995
|
-
const settlement = closedStreamingSettlements.get(generation);
|
|
1996
|
-
if (settlement) settlement.contentClaimed = true;
|
|
1997
|
-
return settlement;
|
|
1998
|
-
}
|
|
1999
|
-
let result;
|
|
2000
|
-
for (const settlement of closedStreamingSettlements.values()) if (settlement.contentClaimed !== true && (content === void 0 || settlement.content === content)) result = settlement;
|
|
2001
|
-
if (result) result.contentClaimed = true;
|
|
2002
|
-
return result;
|
|
2003
|
-
};
|
|
1842
|
+
const streamingRecoveries = /* @__PURE__ */ new WeakMap();
|
|
2004
1843
|
const ensureVisibleStreamingDelivery = async (result, content, infoKind) => {
|
|
2005
|
-
if (result?.visibleReplySent === true || !content?.trim()) return result;
|
|
2006
|
-
|
|
1844
|
+
if (result?.visibleReplySent === true && result.finalTextAccepted !== false || !content?.trim()) return result;
|
|
1845
|
+
let recoveries = result && streamingRecoveries.get(result);
|
|
1846
|
+
const pending = recoveries?.get(content);
|
|
1847
|
+
if (pending) return pending;
|
|
1848
|
+
const recovery = sendChunkedTextReply({
|
|
2007
1849
|
text: content,
|
|
2008
1850
|
useCard: withinCardTableLimit(content),
|
|
2009
1851
|
infoKind,
|
|
2010
1852
|
preparedPostText: true
|
|
1853
|
+
}).then((delivered) => {
|
|
1854
|
+
lastStreamingSettlement = {
|
|
1855
|
+
disposition: "closed",
|
|
1856
|
+
result: delivered,
|
|
1857
|
+
content
|
|
1858
|
+
};
|
|
1859
|
+
return delivered;
|
|
2011
1860
|
});
|
|
1861
|
+
if (result) {
|
|
1862
|
+
if (!recoveries) {
|
|
1863
|
+
recoveries = /* @__PURE__ */ new Map();
|
|
1864
|
+
streamingRecoveries.set(result, recoveries);
|
|
1865
|
+
}
|
|
1866
|
+
recoveries.set(content, recovery);
|
|
1867
|
+
}
|
|
1868
|
+
return recovery;
|
|
2012
1869
|
};
|
|
2013
1870
|
function queueIdleSideEffects() {
|
|
2014
1871
|
idleRequestedForReply = true;
|
|
@@ -2017,24 +1874,19 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2017
1874
|
try {
|
|
2018
1875
|
do {
|
|
2019
1876
|
const completions = pendingStreamingDeliveries.splice(0);
|
|
2020
|
-
const closeOutcome = await closeStreaming()
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
1877
|
+
const closeOutcome = streaming || inFlightStreamingClose ? await closeStreaming() : completions.length > 0 && lastStreamingSettlement ? lastStreamingSettlement : {
|
|
1878
|
+
disposition: "closed",
|
|
1879
|
+
result: noVisibleFeishuReplyDelivery
|
|
1880
|
+
};
|
|
2024
1881
|
for (const completion of completions) {
|
|
2025
|
-
const
|
|
2026
|
-
|
|
2027
|
-
result
|
|
2028
|
-
...closeOutcome.error === void 0 ? {} : { error: closeOutcome.error }
|
|
2029
|
-
} : claimClosedStreamingResult(completion.streamingGeneration, completion.result.content);
|
|
2030
|
-
const deliveryError = claimedSettlement?.error;
|
|
2031
|
-
if (claimedSettlement?.disposition === "discarded") {
|
|
2032
|
-
const retained = mergeFeishuReplyDeliveryResults([claimedSettlement.result, completion.result], claimedSettlement.result.content ?? "");
|
|
1882
|
+
const deliveryError = closeOutcome.error;
|
|
1883
|
+
if (closeOutcome.disposition === "discarded") {
|
|
1884
|
+
const retained = mergeFeishuReplyDeliveryResults([closeOutcome.result, completion.result], closeOutcome.result.content ?? "");
|
|
2033
1885
|
if (deliveryError !== void 0) completion.reject(createFeishuPartialReplyDeliveryError(deliveryError, retained));
|
|
2034
1886
|
else completion.resolve(retained);
|
|
2035
1887
|
continue;
|
|
2036
1888
|
}
|
|
2037
|
-
let providerFinalized =
|
|
1889
|
+
let providerFinalized = closeOutcome.result;
|
|
2038
1890
|
try {
|
|
2039
1891
|
providerFinalized = await ensureVisibleStreamingDelivery(providerFinalized, completion.result.content, completion.infoKind);
|
|
2040
1892
|
} catch (fallbackError) {
|
|
@@ -2070,11 +1922,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2070
1922
|
let finalized = noVisibleFeishuReplyDelivery;
|
|
2071
1923
|
let finalizationError;
|
|
2072
1924
|
let fallbackPartial;
|
|
2073
|
-
|
|
2074
|
-
if (!settlement && paramsLocal.ownerGeneration !== void 0 && inFlightStreamingClose?.generation === paramsLocal.ownerGeneration) {
|
|
2075
|
-
const closeOutcome = await inFlightStreamingClose.promise;
|
|
2076
|
-
settlement = claimClosedStreamingResult(paramsLocal.ownerGeneration, paramsLocal.content) ?? closeOutcome;
|
|
2077
|
-
} else if (!settlement && paramsLocal.ownerGeneration !== void 0 && activeStreamingGeneration === paramsLocal.ownerGeneration) settlement = await closeStreaming();
|
|
1925
|
+
const settlement = await closeStreaming();
|
|
2078
1926
|
finalized = settlement?.result ?? finalized;
|
|
2079
1927
|
finalizationError = settlement?.error;
|
|
2080
1928
|
const discarded = settlement?.disposition === "discarded";
|
|
@@ -2120,7 +1968,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2120
1968
|
if (!replyLifecycleStateInitialized) {
|
|
2121
1969
|
replyLifecycleStateInitialized = true;
|
|
2122
1970
|
deliveredFinalTexts.clear();
|
|
2123
|
-
|
|
1971
|
+
lastStreamingSettlement = void 0;
|
|
2124
1972
|
sentIndependentBlockText = false;
|
|
2125
1973
|
idleRequestedForReply = false;
|
|
2126
1974
|
visibleReplySent = false;
|
|
@@ -2190,7 +2038,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2190
2038
|
const skipTextForDuplicateFinal = !hasIndependentPresentation && info?.kind === "final" && hasText && deliveredFinalTexts.has(text);
|
|
2191
2039
|
const shouldDeliverText = hasText && (!hasVoiceMedia || hasPresentationFallback) && !skipTextForDuplicateFinal;
|
|
2192
2040
|
const shouldDiscardStreamingPreview = info?.kind === "final" && !(hasIndependentPresentation && payload.isError === true && hasStreamingFinalText) && (hasIndependentPresentation || finalTextExceedsStreamingLimit || hasMedia && (hasVoiceMedia && !shouldDeliverText && !ttsTextAlreadyVisible || skipTextForDuplicateFinal));
|
|
2193
|
-
const priorClosedStreamingSettlement = info?.kind === "final" && hasText && skipTextForDuplicateFinal
|
|
2041
|
+
const priorClosedStreamingSettlement = info?.kind === "final" && hasText && skipTextForDuplicateFinal && lastStreamingSettlement?.content === text ? lastStreamingSettlement : void 0;
|
|
2194
2042
|
if (!shouldDeliverText && !hasMedia && !presentationCard) {
|
|
2195
2043
|
if (priorClosedStreamingSettlement?.error !== void 0) throw toStringifiedError(priorClosedStreamingSettlement.error);
|
|
2196
2044
|
return priorClosedStreamingSettlement?.result ?? noVisibleFeishuReplyDelivery;
|
|
@@ -2236,15 +2084,13 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2236
2084
|
}
|
|
2237
2085
|
return mergeFeishuReplyDeliveryResults(deliveredResults, text);
|
|
2238
2086
|
}
|
|
2239
|
-
|
|
2087
|
+
const matchingClosingStream = inFlightStreamingClose !== void 0 && closingStreamingText === text;
|
|
2088
|
+
if (!matchingClosingStream && (info?.kind === "block" || info?.kind === "final" && useStreamingCard)) {
|
|
2240
2089
|
startStreaming();
|
|
2241
2090
|
if (streamingStartPromise) await streamingStartPromise;
|
|
2242
2091
|
}
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
const ownerGeneration = activeStreamingGeneration ?? matchingInFlightClose?.generation;
|
|
2246
|
-
if (shouldStreamText && ownerGeneration !== void 0 && (streaming?.isActive() || matchingInFlightClose !== void 0)) {
|
|
2247
|
-
if (activeStreamingGeneration !== void 0) {
|
|
2092
|
+
if ((info?.kind === "block" || info?.kind === "final") && (streaming?.isActive() || matchingClosingStream)) {
|
|
2093
|
+
if (!matchingClosingStream) {
|
|
2248
2094
|
if (info?.kind === "block") queueStreamingUpdate(text, {
|
|
2249
2095
|
mode: "delta",
|
|
2250
2096
|
dedupeWithLastPartial: true
|
|
@@ -2263,11 +2109,10 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2263
2109
|
await throwStreamingDeliveryFailure({
|
|
2264
2110
|
error,
|
|
2265
2111
|
content: text,
|
|
2266
|
-
infoKind: info?.kind
|
|
2267
|
-
ownerGeneration
|
|
2112
|
+
infoKind: info?.kind
|
|
2268
2113
|
});
|
|
2269
2114
|
}
|
|
2270
|
-
return deferStreamingDelivery(mergeFeishuReplyDeliveryResults(deliveredResults, text), info?.kind
|
|
2115
|
+
return deferStreamingDelivery(mergeFeishuReplyDeliveryResults(deliveredResults, text), info?.kind);
|
|
2271
2116
|
}
|
|
2272
2117
|
if (useStaticCard || useStreamingCard && !isStreamingStartBackedOff(account.accountId) && withinCardTableLimit(text)) deliveredResults.push(await sendChunkedTextReply({
|
|
2273
2118
|
text,
|
|
@@ -2875,7 +2720,7 @@ async function handleFeishuMessage(params) {
|
|
|
2875
2720
|
});
|
|
2876
2721
|
configuredBinding = configuredRoute.bindingResolution;
|
|
2877
2722
|
route = configuredRoute.route;
|
|
2878
|
-
const runtimeRoute =
|
|
2723
|
+
const runtimeRoute = await resolveRuntimeConversationBindingRouteAsync({
|
|
2879
2724
|
route,
|
|
2880
2725
|
conversation: {
|
|
2881
2726
|
channel: "feishu",
|
|
@@ -3360,7 +3205,7 @@ async function handleFeishuMessage(params) {
|
|
|
3360
3205
|
log(`feishu[${account.accountId}]: failed to record broadcast inbound session ${agentSessionKey}: ${String(err)}`);
|
|
3361
3206
|
}
|
|
3362
3207
|
};
|
|
3363
|
-
const allowReasoningPreview = resolveFeishuReasoningPreviewEnabled({
|
|
3208
|
+
const allowReasoningPreview = await resolveFeishuReasoningPreviewEnabled({
|
|
3364
3209
|
cfg,
|
|
3365
3210
|
agentId,
|
|
3366
3211
|
storePath: agentStorePath,
|
|
@@ -3446,7 +3291,7 @@ async function handleFeishuMessage(params) {
|
|
|
3446
3291
|
const ctxPayload = await buildCtxPayloadForAgent(route.agentId, route.sessionKey, route.accountId, ctx.mentionedBot);
|
|
3447
3292
|
const identity = resolveAgentOutboundIdentity(effectiveCfg, route.agentId);
|
|
3448
3293
|
const storePath = resolveStorePath(effectiveCfg.session?.store, { agentId: route.agentId });
|
|
3449
|
-
const allowReasoningPreview = resolveFeishuReasoningPreviewEnabled({
|
|
3294
|
+
const allowReasoningPreview = await resolveFeishuReasoningPreviewEnabled({
|
|
3450
3295
|
cfg: effectiveCfg,
|
|
3451
3296
|
agentId: route.agentId,
|
|
3452
3297
|
storePath,
|
|
@@ -3905,69 +3750,37 @@ function buildFeishuFlushIngressLifecycle(sources, options) {
|
|
|
3905
3750
|
settle: async () => {}
|
|
3906
3751
|
};
|
|
3907
3752
|
let handedOff = false;
|
|
3908
|
-
let
|
|
3909
|
-
let adopting;
|
|
3910
|
-
let abandoning;
|
|
3753
|
+
let settled = false;
|
|
3911
3754
|
const releaseReplayClaims = () => {
|
|
3912
3755
|
for (const claim of replayClaims) claim.release({ error: /* @__PURE__ */ new Error("feishu-ingress-not-adopted") });
|
|
3913
3756
|
};
|
|
3914
|
-
const
|
|
3915
|
-
if (
|
|
3757
|
+
const abandonAll = async () => {
|
|
3758
|
+
if (settled) return;
|
|
3759
|
+
settled = true;
|
|
3916
3760
|
releaseReplayClaims();
|
|
3917
3761
|
await transportLifecycle.onAbandoned();
|
|
3918
|
-
terminal = "abandoned";
|
|
3919
|
-
};
|
|
3920
|
-
const ensureAbandoned = async () => {
|
|
3921
|
-
if (terminal) return;
|
|
3922
|
-
const activeAbandonment = abandoning ?? runAbandon();
|
|
3923
|
-
abandoning = activeAbandonment;
|
|
3924
|
-
try {
|
|
3925
|
-
await activeAbandonment;
|
|
3926
|
-
} finally {
|
|
3927
|
-
if (abandoning === activeAbandonment && terminal !== "abandoned") abandoning = void 0;
|
|
3928
|
-
}
|
|
3929
|
-
};
|
|
3930
|
-
const abandonAll = async () => {
|
|
3931
|
-
if (terminal) return;
|
|
3932
|
-
if (adopting) {
|
|
3933
|
-
await adopting.catch(() => void 0);
|
|
3934
|
-
if (terminal) return;
|
|
3935
|
-
}
|
|
3936
|
-
await ensureAbandoned();
|
|
3937
3762
|
};
|
|
3938
3763
|
const adoptAll = async () => {
|
|
3939
|
-
if (
|
|
3940
|
-
|
|
3941
|
-
await abandoning.catch(() => void 0);
|
|
3942
|
-
if (terminal) return;
|
|
3943
|
-
}
|
|
3944
|
-
const activeAdoption = adopting ?? (async () => {
|
|
3945
|
-
try {
|
|
3946
|
-
await transportLifecycle.onAdopted();
|
|
3947
|
-
terminal = "adopted";
|
|
3948
|
-
const results = await Promise.allSettled(replayClaims.map(async (claim) => claim.commit()));
|
|
3949
|
-
for (const result of results) if (result.status === "rejected") try {
|
|
3950
|
-
options?.onReplayCommitError?.(result.reason);
|
|
3951
|
-
} catch {}
|
|
3952
|
-
} catch (error) {
|
|
3953
|
-
await ensureAbandoned().catch(() => void 0);
|
|
3954
|
-
throw error;
|
|
3955
|
-
}
|
|
3956
|
-
})();
|
|
3957
|
-
adopting = activeAdoption;
|
|
3958
|
-
options?.trackTask?.(activeAdoption);
|
|
3764
|
+
if (settled) return;
|
|
3765
|
+
settled = true;
|
|
3959
3766
|
try {
|
|
3960
|
-
await
|
|
3961
|
-
}
|
|
3962
|
-
|
|
3767
|
+
await transportLifecycle.onAdopted();
|
|
3768
|
+
} catch (error) {
|
|
3769
|
+
releaseReplayClaims();
|
|
3770
|
+
await Promise.resolve(transportLifecycle.onAbandoned()).catch(() => void 0);
|
|
3771
|
+
throw error;
|
|
3963
3772
|
}
|
|
3773
|
+
const results = await Promise.allSettled(replayClaims.map((claim) => claim.commit()));
|
|
3774
|
+
for (const result of results) if (result.status === "rejected") options?.onReplayCommitError?.(result.reason);
|
|
3964
3775
|
};
|
|
3965
3776
|
return {
|
|
3966
3777
|
lifecycle: {
|
|
3967
3778
|
abortSignal: transportLifecycle.abortSignal,
|
|
3968
3779
|
onAdopted: async () => {
|
|
3969
3780
|
handedOff = true;
|
|
3970
|
-
|
|
3781
|
+
const adoption = adoptAll();
|
|
3782
|
+
options?.trackTask?.(adoption);
|
|
3783
|
+
await adoption;
|
|
3971
3784
|
},
|
|
3972
3785
|
onDeferred: () => {
|
|
3973
3786
|
handedOff = true;
|
|
@@ -3990,9 +3803,9 @@ function buildFeishuFlushIngressLifecycle(sources, options) {
|
|
|
3990
3803
|
try {
|
|
3991
3804
|
transportLifecycle.onAdoptionFinalizing();
|
|
3992
3805
|
await transportLifecycle.onAdopted();
|
|
3993
|
-
|
|
3806
|
+
settled = true;
|
|
3994
3807
|
} catch (error) {
|
|
3995
|
-
await
|
|
3808
|
+
await abandonAll().catch(() => void 0);
|
|
3996
3809
|
throw error;
|
|
3997
3810
|
}
|
|
3998
3811
|
}
|
|
@@ -4247,12 +4060,7 @@ function createQuickActionLauncherCard(params) {
|
|
|
4247
4060
|
}
|
|
4248
4061
|
async function maybeHandleFeishuQuickActionMenu(params) {
|
|
4249
4062
|
if (!QUICK_ACTION_MENU_KEYS.has(normalizeOptionalLowercaseString(params.eventKey) ?? "")) return false;
|
|
4250
|
-
const
|
|
4251
|
-
const expiresAt = now === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(FEISHU_QUICK_ACTION_CARD_TTL_MS, { nowMs: now });
|
|
4252
|
-
if (expiresAt === void 0) {
|
|
4253
|
-
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: failed to open quick-action launcher for ${params.operatorOpenId}: invalid expiry clock`);
|
|
4254
|
-
return false;
|
|
4255
|
-
}
|
|
4063
|
+
const expiresAt = Date.now() + FEISHU_QUICK_ACTION_CARD_TTL_MS;
|
|
4256
4064
|
try {
|
|
4257
4065
|
await sendCardFeishu({
|
|
4258
4066
|
cfg: params.cfg,
|
|
@@ -4894,7 +4702,7 @@ async function resolveDriveCommentEventTurn(params) {
|
|
|
4894
4702
|
return null;
|
|
4895
4703
|
}
|
|
4896
4704
|
const context = await fetchDriveCommentContext({
|
|
4897
|
-
client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./doctor-contract-
|
|
4705
|
+
client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./doctor-contract-BNXcJcWR.mjs").then((n) => n.l)).resolveFeishuAccount({
|
|
4898
4706
|
cfg,
|
|
4899
4707
|
accountId
|
|
4900
4708
|
})),
|
|
@@ -5033,8 +4841,8 @@ async function handleFeishuCommentEvent(params) {
|
|
|
5033
4841
|
senderId: turn.senderId,
|
|
5034
4842
|
senderIdLine: `Your Feishu user id: ${turn.senderId}`,
|
|
5035
4843
|
meta: { name: turn.senderId },
|
|
5036
|
-
onCreated: (
|
|
5037
|
-
log(`feishu[${account.accountId}]: comment pairing request sender=${turn.senderId}
|
|
4844
|
+
onCreated: () => {
|
|
4845
|
+
log(`feishu[${account.accountId}]: comment pairing request sender=${turn.senderId}`);
|
|
5038
4846
|
},
|
|
5039
4847
|
sendPairingReply: async (text) => {
|
|
5040
4848
|
await deliverCommentThreadText(client, {
|
|
@@ -5216,11 +5024,12 @@ async function handleFeishuCommentEvent(params) {
|
|
|
5216
5024
|
const DEFAULT_TASK_TIMEOUT_MS = 3e5;
|
|
5217
5025
|
function createSequentialQueue(options = {}) {
|
|
5218
5026
|
const queues = /* @__PURE__ */ new Map();
|
|
5219
|
-
const taskTimeoutMs = options.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT_MS;
|
|
5220
5027
|
const onTaskTimeout = options.onTaskTimeout;
|
|
5221
5028
|
return (key, task) => {
|
|
5222
5029
|
const previous = queues.get(key) ?? Promise.resolve();
|
|
5223
|
-
const wrapped = () =>
|
|
5030
|
+
const wrapped = () => raceWithTimeout(task, DEFAULT_TASK_TIMEOUT_MS, () => {
|
|
5031
|
+
onTaskTimeout?.(key, DEFAULT_TASK_TIMEOUT_MS);
|
|
5032
|
+
});
|
|
5224
5033
|
const next = previous.then(wrapped, wrapped);
|
|
5225
5034
|
queues.set(key, next);
|
|
5226
5035
|
const cleanup = () => {
|
|
@@ -5230,15 +5039,6 @@ function createSequentialQueue(options = {}) {
|
|
|
5230
5039
|
return next;
|
|
5231
5040
|
};
|
|
5232
5041
|
}
|
|
5233
|
-
async function boundedRun(key, task, timeoutMs, onTaskTimeout) {
|
|
5234
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) return task();
|
|
5235
|
-
const resolvedTimeoutMs = resolveTimerTimeoutMs(timeoutMs, DEFAULT_TASK_TIMEOUT_MS);
|
|
5236
|
-
await raceWithTimeout(task, resolvedTimeoutMs, () => {
|
|
5237
|
-
try {
|
|
5238
|
-
onTaskTimeout?.(key, resolvedTimeoutMs);
|
|
5239
|
-
} catch {}
|
|
5240
|
-
});
|
|
5241
|
-
}
|
|
5242
5042
|
//#endregion
|
|
5243
5043
|
//#region extensions/feishu/src/monitor.comment-notice-handler.ts
|
|
5244
5044
|
function buildCommentNoticeQueueKey(event) {
|
|
@@ -5320,15 +5120,6 @@ function mergeFeishuDebounceMentions(entries) {
|
|
|
5320
5120
|
}
|
|
5321
5121
|
return merged.size > 0 ? Array.from(merged.values()) : void 0;
|
|
5322
5122
|
}
|
|
5323
|
-
function dedupeFeishuDebounceEntriesByDedupeKey(entries) {
|
|
5324
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5325
|
-
return entries.filter(({ messageDedupeKey }) => {
|
|
5326
|
-
if (!messageDedupeKey) return true;
|
|
5327
|
-
if (seen.has(messageDedupeKey)) return false;
|
|
5328
|
-
seen.add(messageDedupeKey);
|
|
5329
|
-
return true;
|
|
5330
|
-
});
|
|
5331
|
-
}
|
|
5332
5123
|
function resolveFeishuDebounceMentions(params) {
|
|
5333
5124
|
const { entries, botOpenId } = params;
|
|
5334
5125
|
if (entries.length === 0) return;
|
|
@@ -5438,19 +5229,12 @@ function createFeishuMessageReceiveHandler({ cfg, channelRuntime, accountId, run
|
|
|
5438
5229
|
await settle();
|
|
5439
5230
|
return;
|
|
5440
5231
|
}
|
|
5441
|
-
const
|
|
5442
|
-
const freshEntries = [];
|
|
5443
|
-
for (const entry of dedupedEntries) if (!await hasProcessedMessage(entry.messageDedupeKey, accountId, log)) freshEntries.push(entry);
|
|
5444
|
-
const dispatchEntry = freshEntries.at(-1);
|
|
5445
|
-
if (!dispatchEntry) {
|
|
5446
|
-
await settle();
|
|
5447
|
-
return;
|
|
5448
|
-
}
|
|
5232
|
+
const dispatchEntry = last;
|
|
5449
5233
|
const dispatchDedupeKey = dispatchEntry.messageDedupeKey;
|
|
5450
|
-
if (!lifecycle) await recordSuppressedMessageIds(
|
|
5451
|
-
const combinedText =
|
|
5234
|
+
if (!lifecycle) await recordSuppressedMessageIds(activeEntries, dispatchDedupeKey);
|
|
5235
|
+
const combinedText = activeEntries.map((entry) => resolveDebounceText(entry.event)).filter(Boolean).join("\n");
|
|
5452
5236
|
const mergedMentions = resolveFeishuDebounceMentions({
|
|
5453
|
-
entries:
|
|
5237
|
+
entries: activeEntries.map((entry) => entry.event),
|
|
5454
5238
|
botOpenId: getBotOpenId(accountId)
|
|
5455
5239
|
});
|
|
5456
5240
|
await dispatchFeishuMessage({
|
|
@@ -5893,7 +5677,7 @@ async function monitorWebhook(params) {
|
|
|
5893
5677
|
const encryptKey = account.encryptKey?.trim();
|
|
5894
5678
|
if (!encryptKey) throw new Error(`Feishu account "${accountId}" webhook mode requires encryptKey`);
|
|
5895
5679
|
const rawPath = account.config.webhookPath ?? "/feishu/events";
|
|
5896
|
-
if (normalizeFeishuWebhookPath(rawPath) !== rawPath) throw new Error(`Feishu account "${accountId}" webhookPath must be a
|
|
5680
|
+
if (normalizeFeishuWebhookPath(rawPath) !== rawPath) throw new Error(`Feishu account "${accountId}" webhookPath must be a normalized HTTP request path; run "openclaw doctor --fix" to repair it`);
|
|
5897
5681
|
const pathConflict = describeFeishuWebhookPathConflict(rawPath);
|
|
5898
5682
|
if (pathConflict && !legacyListener) throw new Error(`Feishu account "${accountId}" ${pathConflict}`);
|
|
5899
5683
|
let webhookTargets = webhookTargetsStore.tryGetRuntime();
|
|
@@ -6123,7 +5907,7 @@ async function resolveReactionSyntheticEvent(params) {
|
|
|
6123
5907
|
const senderUserId = event.user_id?.user_id?.trim();
|
|
6124
5908
|
const senderId = senderOpenId || senderUserId;
|
|
6125
5909
|
if (!emoji || !messageId || !senderId) return null;
|
|
6126
|
-
const { resolveFeishuAccount } = await import("./doctor-contract-
|
|
5910
|
+
const { resolveFeishuAccount } = await import("./doctor-contract-BNXcJcWR.mjs").then((n) => n.l);
|
|
6127
5911
|
const reactionNotifications = resolveFeishuAccount({
|
|
6128
5912
|
cfg,
|
|
6129
5913
|
accountId
|
|
@@ -6352,13 +6136,13 @@ async function monitorSingleAccount(params) {
|
|
|
6352
6136
|
};
|
|
6353
6137
|
try {
|
|
6354
6138
|
const eventDispatcher = createEventDispatcher(account);
|
|
6355
|
-
const durableIngress =
|
|
6139
|
+
const durableIngress = createFeishuDurableIngress({
|
|
6356
6140
|
accountId,
|
|
6357
6141
|
dispatcher: eventDispatcher,
|
|
6358
6142
|
...account.encryptKey ? { encryptKey: account.encryptKey } : {},
|
|
6359
6143
|
runtime: runtime ?? {}
|
|
6360
|
-
})
|
|
6361
|
-
const durableEventDispatcher =
|
|
6144
|
+
});
|
|
6145
|
+
const durableEventDispatcher = Object.assign(Object.create(eventDispatcher), { invoke: durableIngress.invoke });
|
|
6362
6146
|
const chatHistories = /* @__PURE__ */ new Map();
|
|
6363
6147
|
threadBindingManager = createFeishuThreadBindingManager({
|
|
6364
6148
|
accountId,
|
|
@@ -6375,11 +6159,11 @@ async function monitorSingleAccount(params) {
|
|
|
6375
6159
|
trackTask,
|
|
6376
6160
|
vcAutoJoin: account.config.vcAutoJoin === true,
|
|
6377
6161
|
abortSignal: accountAbortSignal,
|
|
6378
|
-
|
|
6162
|
+
resolveIngressLifecycle: durableIngress.resolveLifecycle,
|
|
6379
6163
|
...params.statusSink ? { statusSink: params.statusSink } : {}
|
|
6380
6164
|
});
|
|
6381
6165
|
try {
|
|
6382
|
-
durableIngress
|
|
6166
|
+
durableIngress.start();
|
|
6383
6167
|
if (connectionMode === "webhook") return await monitorWebhook({
|
|
6384
6168
|
gatewayPort: (0, gateway_config_runtime_exports.resolveGatewayPort)(cfg),
|
|
6385
6169
|
account,
|
|
@@ -6387,7 +6171,7 @@ async function monitorSingleAccount(params) {
|
|
|
6387
6171
|
runtime,
|
|
6388
6172
|
abortSignal,
|
|
6389
6173
|
eventDispatcher: durableEventDispatcher,
|
|
6390
|
-
|
|
6174
|
+
invokeWebhookEvent: durableIngress.invokeWebhook,
|
|
6391
6175
|
...params.statusSink ? { statusSink: params.statusSink } : {}
|
|
6392
6176
|
});
|
|
6393
6177
|
return await monitorWebSocket({
|
|
@@ -6396,13 +6180,13 @@ async function monitorSingleAccount(params) {
|
|
|
6396
6180
|
runtime,
|
|
6397
6181
|
abortSignal,
|
|
6398
6182
|
eventDispatcher: durableEventDispatcher,
|
|
6399
|
-
|
|
6183
|
+
setSocketTerminator: durableIngress.setSocketTerminator,
|
|
6400
6184
|
...params.statusSink ? { statusSink: params.statusSink } : {}
|
|
6401
6185
|
});
|
|
6402
6186
|
} finally {
|
|
6403
6187
|
accountStopped.abort(/* @__PURE__ */ new Error("Feishu account stopped"));
|
|
6404
6188
|
try {
|
|
6405
|
-
await durableIngress
|
|
6189
|
+
await durableIngress.stop();
|
|
6406
6190
|
} finally {
|
|
6407
6191
|
while (pendingTasks.size > 0) await Promise.allSettled(pendingTasks);
|
|
6408
6192
|
}
|