@openclaw/feishu 2026.9.8 → 2026.10.1-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-DV4hM2Uf.mjs → channel-CX62T71S.mjs} +146 -245
- package/dist/.setup/{channel.runtime-CXQcH5zZ.mjs → channel.runtime-COiaq-Rv.mjs} +6 -12
- package/dist/.setup/{chat-D8MlFAZi.mjs → chat-BdyvImsY.mjs} +6 -9
- package/dist/.setup/{client-BYG-_IZl.mjs → client-BsBVWJzN.mjs} +1 -1
- package/dist/.setup/{doctor-contract-3XC0vbIw.mjs → doctor-contract-B1B9ogdd.mjs} +212 -27
- package/dist/.setup/{monitor-D_rsHBZ6.mjs → monitor-7DvwUs4Y.mjs} +5 -6
- package/dist/.setup/{monitor.account-DvvY7i6k.mjs → monitor.account-7xVu7XWY.mjs} +190 -393
- package/dist/.setup/{probe-_ViqSi0j.mjs → probe-B9o7iey6.mjs} +13 -39
- package/dist/.setup/{reply-delivery-result-COAjaukc.mjs → reply-delivery-result-Bt-BWBEA.mjs} +151 -297
- package/dist/.setup/{setup-api-C4S5I3ac.mjs → setup-api-DmzX9S01.mjs} +1 -1
- package/dist/.setup/{subagent-hooks-BaFoMu8W.mjs → subagent-hooks-CUXg0pC-.mjs} +5 -11
- package/dist/.setup/{thread-bindings-EdLXPXzw.mjs → thread-bindings-jW2x5VuN.mjs} +23 -41
- package/dist/api.js +234 -297
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +2 -2
- package/dist/session-binding-contract-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 +95 -0
- package/node_modules/@openclaw/fs-safe/README.md +70 -379
- package/node_modules/@openclaw/fs-safe/dist/absolute-path.js +35 -51
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-input.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +9 -10
- package/node_modules/@openclaw/fs-safe/dist/archive.js +2 -5
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.d.ts +51 -0
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +242 -0
- package/node_modules/@openclaw/fs-safe/dist/config.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/config.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/create.js +12 -5
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.d.ts +11 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +4 -7
- package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.d.ts +55 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +262 -0
- package/node_modules/@openclaw/fs-safe/dist/exclusive-create.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/exclusive-create.js +22 -0
- package/node_modules/@openclaw/fs-safe/dist/file-cleanup.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/file-cleanup.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/file-identity.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-io.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.js +9 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root.js +4 -6
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-stale-admission.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +8 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-boundary.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.js +20 -18
- package/node_modules/@openclaw/fs-safe/dist/file-store.js +4 -10
- package/node_modules/@openclaw/fs-safe/dist/fs.d.ts +2 -10
- package/node_modules/@openclaw/fs-safe/dist/fs.js +2 -10
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +3 -4
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +6 -18
- package/node_modules/@openclaw/fs-safe/dist/guest-dispatch-python.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +0 -2
- package/node_modules/@openclaw/fs-safe/dist/guest.js +3 -9
- package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/index.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-directory.js +1 -5
- package/node_modules/@openclaw/fs-safe/dist/json.js +19 -37
- package/node_modules/@openclaw/fs-safe/dist/move-path.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/mutation-authority.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/mutation-authority.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +47 -2
- package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +1 -9
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +6 -40
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +5 -2
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +11 -316
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.d.ts +7 -7
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.js +28 -175
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +15 -0
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +418 -0
- package/node_modules/@openclaw/fs-safe/dist/native-rename-outcome.js +9 -4
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +17 -13
- package/node_modules/@openclaw/fs-safe/dist/native-staged-symlink.js +6 -24
- package/node_modules/@openclaw/fs-safe/dist/native.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/path-case.js +10 -9
- package/node_modules/@openclaw/fs-safe/dist/path-scope-lexical.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/path-segment-route.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/path-segment-route.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/path.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/permissions-windows.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-admission.js +1 -3
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +9 -10
- package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +4 -3
- package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.d.ts +3 -4
- package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.js +18 -32
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.d.ts +5 -17
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +92 -230
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.d.ts +4 -15
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.js +22 -63
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.d.ts +9 -34
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +78 -83
- package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.d.ts +18 -20
- package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.js +64 -98
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.d.ts +16 -33
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.js +61 -200
- package/node_modules/@openclaw/fs-safe/dist/replace-file-types.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/replace-file.js +76 -216
- package/node_modules/@openclaw/fs-safe/dist/root-boundary.js +14 -24
- package/node_modules/@openclaw/fs-safe/dist/root-context.d.ts +1 -4
- package/node_modules/@openclaw/fs-safe/dist/root-context.js +4 -19
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +52 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +350 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +35 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +2 -27
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +31 -28
- package/node_modules/@openclaw/fs-safe/dist/root-directory.js +1 -4
- package/node_modules/@openclaw/fs-safe/dist/root-errors.js +34 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.js +9 -21
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +105 -37
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.d.ts +7 -2
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +67 -38
- package/node_modules/@openclaw/fs-safe/dist/root-observed-path.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-observed-path.js +0 -2
- package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +2 -3
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-path-stat.js +68 -85
- package/node_modules/@openclaw/fs-safe/dist/root-path.js +6 -1
- package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-paths.js +4 -9
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +311 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove.d.ts +11 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-walk.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +1 -3
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.d.ts +3 -3
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +8 -10
- package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.js +0 -4
- package/node_modules/@openclaw/fs-safe/dist/secret-file.js +12 -9
- package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.d.ts +0 -2
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-temp.js +7 -4
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +13 -6
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.d.ts +0 -3
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +5 -23
- package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.js +11 -6
- package/node_modules/@openclaw/fs-safe/dist/temp-cleanup.js +1 -8
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +2 -9
- package/node_modules/@openclaw/fs-safe/dist/text-atomic.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/trash.js +6 -2
- package/node_modules/@openclaw/fs-safe/dist/walk.js +100 -46
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.d.ts +7 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.js +235 -19
- package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +21 -2
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +21 -3
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +111 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.js +27 -4
- package/node_modules/@openclaw/fs-safe/dist/watch-stream.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/watch.js +131 -40
- package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.js +24 -6
- package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.js +51 -0
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +4 -0
- package/node_modules/@openclaw/fs-safe/docs/atomic.md +4 -1
- package/node_modules/@openclaw/fs-safe/docs/config.md +6 -14
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +4 -14
- package/node_modules/@openclaw/fs-safe/docs/durability.md +6 -29
- package/node_modules/@openclaw/fs-safe/docs/entry-publication.md +146 -0
- package/node_modules/@openclaw/fs-safe/docs/errors.md +16 -0
- package/node_modules/@openclaw/fs-safe/docs/file-store.md +28 -5
- package/node_modules/@openclaw/fs-safe/docs/index.md +2 -31
- package/node_modules/@openclaw/fs-safe/docs/install.md +10 -31
- package/node_modules/@openclaw/fs-safe/docs/json.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/local-roots.md +0 -1
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +12 -12
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +35 -96
- package/node_modules/@openclaw/fs-safe/docs/native.md +22 -20
- package/node_modules/@openclaw/fs-safe/docs/path.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/public-api.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/reading.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/root.md +26 -184
- package/node_modules/@openclaw/fs-safe/docs/secret-file.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +115 -3
- package/node_modules/@openclaw/fs-safe/docs/store.md +2 -2
- package/node_modules/@openclaw/fs-safe/docs/temp.md +29 -65
- package/node_modules/@openclaw/fs-safe/docs/testing.md +90 -58
- package/node_modules/@openclaw/fs-safe/docs/types.md +3 -16
- package/node_modules/@openclaw/fs-safe/docs/walk.md +33 -5
- package/node_modules/@openclaw/fs-safe/docs/watch.md +96 -14
- package/node_modules/@openclaw/fs-safe/docs/writing.md +172 -16
- package/node_modules/@openclaw/fs-safe/package.json +10 -10
- 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/package.json +5 -5
- package/skills/feishu-wiki/SKILL.md +1 -1
- package/dist/.setup/accounts-wRqItHug.mjs +0 -206
- package/node_modules/@openclaw/fs-safe/dist/watch-alias.d.ts +0 -6
- package/node_modules/@openclaw/fs-safe/dist/watch-alias.js +0 -88
- package/node_modules/@openclaw/fs-safe/docs/mutation-policy-proof.md +0 -69
- package/node_modules/@openclaw/fs-safe/docs/private-file-store.md +0 -68
- package/node_modules/@openclaw/fs-safe/docs/test-hooks.md +0 -110
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-
|
|
1
|
+
import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-CX62T71S.mjs";
|
|
2
2
|
import "../setup-api.js";
|
|
3
3
|
export { feishuPlugin, feishuSetupAdapter, feishuSetupWizard };
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as __exportAll } from "./doctor-contract-B1B9ogdd.mjs";
|
|
2
2
|
import { d as stripFeishuProviderPrefix, l as normalizeFeishuTarget, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-C1ofUfU8.mjs";
|
|
3
|
-
import { n as getFeishuThreadBindingManager } from "./thread-bindings-
|
|
3
|
+
import { n as getFeishuThreadBindingManager } from "./thread-bindings-jW2x5VuN.mjs";
|
|
4
4
|
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/feishu/src/subagent-hooks.ts
|
|
6
6
|
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
handleFeishuSubagentDeliveryTarget: () => handleFeishuSubagentDeliveryTarget,
|
|
8
8
|
handleFeishuSubagentEnded: () => handleFeishuSubagentEnded
|
|
9
9
|
});
|
|
10
|
-
function resolveFeishuRequesterConversation(params) {
|
|
11
|
-
const manager = getFeishuThreadBindingManager(params.accountId);
|
|
12
|
-
if (!manager) return null;
|
|
10
|
+
function resolveFeishuRequesterConversation(manager, params) {
|
|
13
11
|
const rawTo = params.to?.trim();
|
|
14
12
|
const withoutProviderPrefix = rawTo ? stripFeishuProviderPrefix(rawTo) : "";
|
|
15
13
|
const normalizedTarget = rawTo ? normalizeFeishuTarget(rawTo) : null;
|
|
@@ -95,8 +93,7 @@ function resolveMatchingChildBinding(params) {
|
|
|
95
93
|
if (!manager) return null;
|
|
96
94
|
const childBindings = manager.listBySessionKey(params.childSessionKey.trim());
|
|
97
95
|
if (childBindings.length === 0) return null;
|
|
98
|
-
const requesterConversation = resolveFeishuRequesterConversation({
|
|
99
|
-
accountId: manager.accountId,
|
|
96
|
+
const requesterConversation = resolveFeishuRequesterConversation(manager, {
|
|
100
97
|
to: params.requesterOrigin?.to,
|
|
101
98
|
threadId: params.requesterOrigin?.threadId,
|
|
102
99
|
requesterSessionKey: params.requesterSessionKey
|
|
@@ -114,10 +111,7 @@ function handleFeishuSubagentDeliveryTarget(event) {
|
|
|
114
111
|
accountId: event.requesterOrigin?.accountId,
|
|
115
112
|
childSessionKey: event.childSessionKey,
|
|
116
113
|
requesterSessionKey: event.requesterSessionKey,
|
|
117
|
-
requesterOrigin:
|
|
118
|
-
to: event.requesterOrigin?.to,
|
|
119
|
-
threadId: event.requesterOrigin?.threadId
|
|
120
|
-
}
|
|
114
|
+
requesterOrigin: event.requesterOrigin
|
|
121
115
|
});
|
|
122
116
|
if (!binding) return;
|
|
123
117
|
return { origin: resolveFeishuDeliveryOrigin(binding) };
|
|
@@ -4,40 +4,27 @@ import { isFutureDateTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
6
6
|
import { isPluginOwnedSessionBindingRecord } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
7
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
7
8
|
//#region extensions/feishu/src/thread-bindings.ts
|
|
8
9
|
const FEISHU_THREAD_BINDINGS_STATE_KEY = Symbol.for("openclaw.feishuThreadBindingsState");
|
|
9
10
|
let state;
|
|
10
11
|
function getState() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
bindingsByAccountConversation: /* @__PURE__ */ new Map()
|
|
16
|
-
};
|
|
17
|
-
globalStore[FEISHU_THREAD_BINDINGS_STATE_KEY] = state;
|
|
18
|
-
}
|
|
19
|
-
return state;
|
|
12
|
+
return state ??= resolveGlobalSingleton(FEISHU_THREAD_BINDINGS_STATE_KEY, () => ({
|
|
13
|
+
managersByAccountId: /* @__PURE__ */ new Map(),
|
|
14
|
+
bindingsByAccountConversation: /* @__PURE__ */ new Map()
|
|
15
|
+
}));
|
|
20
16
|
}
|
|
21
17
|
function resolveBindingKey(params) {
|
|
22
18
|
return `${params.accountId}:${params.conversationId}`;
|
|
23
19
|
}
|
|
24
|
-
function toSessionBindingTargetKind(raw) {
|
|
25
|
-
return raw === "subagent" ? "subagent" : "session";
|
|
26
|
-
}
|
|
27
|
-
function toFeishuTargetKind(raw) {
|
|
28
|
-
return raw === "subagent" ? "subagent" : "acp";
|
|
29
|
-
}
|
|
30
20
|
function toSessionBindingRecord(record, defaults) {
|
|
31
21
|
const idleExpiresAt = defaults.idleTimeoutMs > 0 ? record.lastActivityAt + defaults.idleTimeoutMs : void 0;
|
|
32
22
|
const maxAgeExpiresAt = defaults.maxAgeMs > 0 ? record.boundAt + defaults.maxAgeMs : void 0;
|
|
33
23
|
const expiresAt = idleExpiresAt != null && maxAgeExpiresAt != null ? Math.min(idleExpiresAt, maxAgeExpiresAt) : idleExpiresAt ?? maxAgeExpiresAt;
|
|
34
24
|
return {
|
|
35
|
-
bindingId: resolveBindingKey(
|
|
36
|
-
accountId: record.accountId,
|
|
37
|
-
conversationId: record.conversationId
|
|
38
|
-
}),
|
|
25
|
+
bindingId: resolveBindingKey(record),
|
|
39
26
|
targetSessionKey: record.targetSessionKey,
|
|
40
|
-
targetKind:
|
|
27
|
+
targetKind: record.targetKind === "subagent" ? "subagent" : "session",
|
|
41
28
|
conversation: {
|
|
42
29
|
channel: "feishu",
|
|
43
30
|
accountId: record.accountId,
|
|
@@ -62,7 +49,8 @@ function toSessionBindingRecord(record, defaults) {
|
|
|
62
49
|
}
|
|
63
50
|
function createFeishuThreadBindingManager(params) {
|
|
64
51
|
const accountId = normalizeAccountId(params.accountId);
|
|
65
|
-
const
|
|
52
|
+
const { managersByAccountId, bindingsByAccountConversation } = getState();
|
|
53
|
+
const existing = managersByAccountId.get(accountId);
|
|
66
54
|
if (existing) return existing;
|
|
67
55
|
const bindingTimeouts = {
|
|
68
56
|
idleTimeoutMs: resolveThreadBindingIdleTimeoutMsForChannel({
|
|
@@ -80,27 +68,27 @@ function createFeishuThreadBindingManager(params) {
|
|
|
80
68
|
if (!record) return;
|
|
81
69
|
const { expiresAt } = toSessionBindingRecord(record, bindingTimeouts);
|
|
82
70
|
if (expiresAt === void 0 || isFutureDateTimestampMs(expiresAt, { nowMs: now })) return record;
|
|
83
|
-
|
|
71
|
+
bindingsByAccountConversation.delete(resolveBindingKey({
|
|
84
72
|
accountId,
|
|
85
73
|
conversationId: record.conversationId
|
|
86
74
|
}));
|
|
87
75
|
};
|
|
88
76
|
const manager = {
|
|
89
77
|
accountId,
|
|
90
|
-
getByConversationId: (conversationId) => resolveActiveBinding(
|
|
78
|
+
getByConversationId: (conversationId) => resolveActiveBinding(bindingsByAccountConversation.get(resolveBindingKey({
|
|
91
79
|
accountId,
|
|
92
80
|
conversationId
|
|
93
81
|
}))),
|
|
94
82
|
listBySessionKey: (targetSessionKey) => {
|
|
95
83
|
const now = Date.now();
|
|
96
|
-
return [...
|
|
84
|
+
return [...bindingsByAccountConversation.values()].filter((record) => record.accountId === accountId && record.targetSessionKey === targetSessionKey && resolveActiveBinding(record, now) !== void 0);
|
|
97
85
|
},
|
|
98
86
|
bindConversation: ({ conversationId, parentConversationId, targetKind, targetSessionKey, metadata }) => {
|
|
99
87
|
const normalizedConversationId = conversationId.trim();
|
|
100
88
|
const normalizedTargetSessionKey = targetSessionKey.trim();
|
|
101
89
|
if (!normalizedConversationId || !normalizedTargetSessionKey) return null;
|
|
102
90
|
const existingLocal = manager.getByConversationId(normalizedConversationId);
|
|
103
|
-
const storedTargetKind =
|
|
91
|
+
const storedTargetKind = targetKind === "subagent" ? "subagent" : "acp";
|
|
104
92
|
const previous = existingLocal?.targetSessionKey === normalizedTargetSessionKey && existingLocal.targetKind === storedTargetKind ? existingLocal : void 0;
|
|
105
93
|
const targetMetadata = {
|
|
106
94
|
...previous?.metadata,
|
|
@@ -125,10 +113,7 @@ function createFeishuThreadBindingManager(params) {
|
|
|
125
113
|
lastActivityAt: now,
|
|
126
114
|
metadata: targetMetadata
|
|
127
115
|
};
|
|
128
|
-
|
|
129
|
-
accountId,
|
|
130
|
-
conversationId: normalizedConversationId
|
|
131
|
-
}), record);
|
|
116
|
+
bindingsByAccountConversation.set(resolveBindingKey(record), record);
|
|
132
117
|
return record;
|
|
133
118
|
},
|
|
134
119
|
touchConversation: (conversationId, at = Date.now()) => {
|
|
@@ -142,7 +127,7 @@ function createFeishuThreadBindingManager(params) {
|
|
|
142
127
|
...existingRecord,
|
|
143
128
|
lastActivityAt: at
|
|
144
129
|
};
|
|
145
|
-
|
|
130
|
+
bindingsByAccountConversation.set(key, updated);
|
|
146
131
|
return updated;
|
|
147
132
|
},
|
|
148
133
|
unbindConversation: (conversationId) => {
|
|
@@ -150,27 +135,24 @@ function createFeishuThreadBindingManager(params) {
|
|
|
150
135
|
accountId,
|
|
151
136
|
conversationId
|
|
152
137
|
});
|
|
153
|
-
const existingRecord =
|
|
138
|
+
const existingRecord = bindingsByAccountConversation.get(key);
|
|
154
139
|
if (!existingRecord) return null;
|
|
155
|
-
|
|
140
|
+
bindingsByAccountConversation.delete(key);
|
|
156
141
|
return existingRecord;
|
|
157
142
|
},
|
|
158
143
|
unbindBySessionKey: (targetSessionKey) => {
|
|
159
144
|
const removed = [];
|
|
160
|
-
for (const record of
|
|
145
|
+
for (const record of bindingsByAccountConversation.values()) {
|
|
161
146
|
if (record.accountId !== accountId || record.targetSessionKey !== targetSessionKey) continue;
|
|
162
|
-
|
|
163
|
-
accountId,
|
|
164
|
-
conversationId: record.conversationId
|
|
165
|
-
}));
|
|
147
|
+
bindingsByAccountConversation.delete(resolveBindingKey(record));
|
|
166
148
|
removed.push(record);
|
|
167
149
|
}
|
|
168
150
|
return removed;
|
|
169
151
|
},
|
|
170
152
|
stop: () => {
|
|
171
|
-
if (
|
|
172
|
-
for (const key of
|
|
173
|
-
|
|
153
|
+
if (managersByAccountId.get(accountId) === manager) {
|
|
154
|
+
for (const key of bindingsByAccountConversation.keys()) if (key.startsWith(`${accountId}:`)) bindingsByAccountConversation.delete(key);
|
|
155
|
+
managersByAccountId.delete(accountId);
|
|
174
156
|
}
|
|
175
157
|
unregisterSessionBindingAdapter({
|
|
176
158
|
channel: "feishu",
|
|
@@ -219,7 +201,7 @@ function createFeishuThreadBindingManager(params) {
|
|
|
219
201
|
}
|
|
220
202
|
};
|
|
221
203
|
registerSessionBindingAdapter(sessionBindingAdapter);
|
|
222
|
-
|
|
204
|
+
managersByAccountId.set(accountId, manager);
|
|
223
205
|
return manager;
|
|
224
206
|
}
|
|
225
207
|
function getFeishuThreadBindingManager(accountId) {
|