@jeik/dingtalk-connector 0.8.38 → 0.8.40
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/CHANGELOG.md +7 -1
- package/dist/{channel-BbpJFyga.mjs → channel-Dvvp_ILl.mjs} +5 -5
- package/dist/{connection-C7-3gzQW.mjs → connection-Bh3U9I4x.mjs} +1 -1
- package/dist/{dws-delivery-context-BsTrxK68.mjs → dws-delivery-context-Db1X5jNl.mjs} +1 -1
- package/dist/entry-bundled.mjs +1 -1
- package/dist/{gateway-methods-lTdxcCpO.mjs → gateway-methods-8vkUpQ7L.mjs} +5 -5
- package/dist/gateway-methods-Du_-e-6R.mjs +2 -0
- package/dist/index.mjs +2 -2
- package/dist/{media-3G_kHjld.mjs → media-0v9wuQ_w.mjs} +8 -8
- package/dist/{media-o_kBcTXb.mjs → media-D7-wqWrP.mjs} +1 -1
- package/dist/{message-handler-DNgfzwqR.mjs → message-handler-I4yIL7tb.mjs} +11 -11
- package/dist/{messaging-DvW-2HJJ.mjs → messaging-DV1FRpgD.mjs} +6 -6
- package/dist/{session-DsDDfhMw.mjs → session-CLaaCx85.mjs} +21 -9
- package/dist/{utils-DXwaa6O-.mjs → utils-CIfI_3Jh.mjs} +0 -1
- package/dist/{utils-CNXrWqt1.mjs → utils-DhRpzVq1.mjs} +2 -2
- package/dist/{utils-legacy-D9TCnrMR.mjs → utils-legacy-CGEa8tg2.mjs} +0 -1
- package/dist/utils-legacy-DXaPDz_L.mjs +3 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/utils/session.ts +23 -11
- package/dist/gateway-methods-DBRRhEk5.mjs +0 -2
- package/dist/utils-legacy-vhmn24_Z.mjs +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.8.
|
|
8
|
+
## [0.8.40] - 2026-09-02
|
|
9
|
+
|
|
10
|
+
### Fixes
|
|
11
|
+
|
|
12
|
+
- **修复插件导入 SyntaxError (Cannot use 'import.meta' outside a module)** — 移除 `src/utils/session.ts` 中顶层 `await import`(Top-Level Await)。Top-Level Await 会导致 Node 的 `require(esm)` 抛出 `ERR_REQUIRE_ASYNC_MODULE` 并使 OpenClaw 的 CJS/jiti 加载回退链中报错。改为懒加载 `createRequire` 检测 SDK 中止命令,插件完全支持同步 `require` 加载。
|
|
13
|
+
|
|
14
|
+
## [0.8.39] - 2026-09-02
|
|
9
15
|
|
|
10
16
|
### Features & Fixes
|
|
11
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as __exportAll } from "./media-
|
|
1
|
+
import { b as __exportAll } from "./media-0v9wuQ_w.mjs";
|
|
2
2
|
import { a as resolveDingtalkAccount, c as addWildcardAllowFrom, d as hasConfiguredSecretInput, f as normalizeAccountId, l as createDefaultChannelRuntimeState, m as resolveDefaultGroupPolicy, o as resolveDingtalkCredentials, p as resolveAllowlistProviderRuntimeGroupPolicy, r as resolveDefaultDingtalkAccountId, s as DEFAULT_ACCOUNT_ID, t as listDingtalkAccountIds, u as formatDocsLink } from "./accounts-BAzdqkAV.mjs";
|
|
3
3
|
import { t as createLogger } from "./logger-CnBTcwyq.mjs";
|
|
4
4
|
import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
|
|
5
|
-
import "./utils-
|
|
6
|
-
import { S as finalClean, f as getActiveCardForConversation, n as sendMediaToDingTalk, o as sendTextToDingTalk } from "./messaging-
|
|
5
|
+
import "./utils-CIfI_3Jh.mjs";
|
|
6
|
+
import { S as finalClean, f as getActiveCardForConversation, n as sendMediaToDingTalk, o as sendTextToDingTalk } from "./messaging-DV1FRpgD.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z, z as z$1 } from "zod";
|
|
9
9
|
//#region src/secret-input.ts
|
|
@@ -970,8 +970,8 @@ async function monitorDingtalkProvider(opts = {}) {
|
|
|
970
970
|
const log = createLogger(cfg.channels?.["dingtalk-connector"]?.debug ?? false);
|
|
971
971
|
const [accountsModule, monitorAccountModule, monitorSingleModule] = await Promise.all([
|
|
972
972
|
import("./accounts-BQptOmgB.mjs"),
|
|
973
|
-
import("./message-handler-
|
|
974
|
-
import("./connection-
|
|
973
|
+
import("./message-handler-I4yIL7tb.mjs"),
|
|
974
|
+
import("./connection-Bh3U9I4x.mjs")
|
|
975
975
|
]);
|
|
976
976
|
const { resolveDingtalkAccount, listEnabledDingtalkAccounts } = accountsModule;
|
|
977
977
|
const { handleDingTalkMessage } = monitorAccountModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as checkAndMarkDingtalkMessage } from "./utils-legacy-
|
|
1
|
+
import { i as checkAndMarkDingtalkMessage } from "./utils-legacy-CGEa8tg2.mjs";
|
|
2
2
|
import { n as onBackgroundWorkCountChange, t as getActiveBackgroundWorkCount } from "./background-work-874-aK4-.mjs";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
//#region src/core/connection.ts
|
package/dist/entry-bundled.mjs
CHANGED
|
@@ -23,7 +23,7 @@ var entry_bundled_default = defineBundledChannelEntry({
|
|
|
23
23
|
exportName: "setDingtalkRuntime"
|
|
24
24
|
},
|
|
25
25
|
async registerFull(api) {
|
|
26
|
-
const { registerGatewayMethods } = await import("./gateway-methods-
|
|
26
|
+
const { registerGatewayMethods } = await import("./gateway-methods-Du_-e-6R.mjs");
|
|
27
27
|
registerGatewayMethods(api);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as resolveDingtalkAccount, t as listDingtalkAccountIds } from "./accounts-BAzdqkAV.mjs";
|
|
2
2
|
import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
|
|
3
|
-
import { r as getAccessToken, t as DINGTALK_API } from "./utils-
|
|
4
|
-
import { c as prepareMultiBotMentions, d as finishAICard, i as sendProactive, s as buildBotMentionTable } from "./messaging-
|
|
5
|
-
import { d as getUnionId, h as recallEmotionReply } from "./utils-legacy-
|
|
3
|
+
import { r as getAccessToken, t as DINGTALK_API } from "./utils-CIfI_3Jh.mjs";
|
|
4
|
+
import { c as prepareMultiBotMentions, d as finishAICard, i as sendProactive, s as buildBotMentionTable } from "./messaging-DV1FRpgD.mjs";
|
|
5
|
+
import { d as getUnionId, h as recallEmotionReply } from "./utils-legacy-CGEa8tg2.mjs";
|
|
6
6
|
//#region src/docs.ts
|
|
7
7
|
var DingtalkDocsClient = class {
|
|
8
8
|
config;
|
|
@@ -592,7 +592,7 @@ function registerGatewayMethods(api) {
|
|
|
592
592
|
});
|
|
593
593
|
const results = {};
|
|
594
594
|
if (cardInstanceId) try {
|
|
595
|
-
const { getAccessToken } = await import("./utils-legacy-
|
|
595
|
+
const { getAccessToken } = await import("./utils-legacy-DXaPDz_L.mjs");
|
|
596
596
|
const token = await getAccessToken(account.config);
|
|
597
597
|
await finishAICard({
|
|
598
598
|
cardInstanceId: String(cardInstanceId),
|
|
@@ -752,7 +752,7 @@ function registerGatewayMethods(api) {
|
|
|
752
752
|
try {
|
|
753
753
|
const account = resolveDingtalkAccount({ cfg });
|
|
754
754
|
if (!account.config?.clientId || !account.config?.clientSecret) return respond(false, { error: "Not configured" });
|
|
755
|
-
const { getAccessToken } = await import("./utils-legacy-
|
|
755
|
+
const { getAccessToken } = await import("./utils-legacy-DXaPDz_L.mjs");
|
|
756
756
|
await getAccessToken(account.config);
|
|
757
757
|
respond(true, {
|
|
758
758
|
ok: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as dingtalkPlugin, r as initDingtalkPluginConfigSchema } from "./channel-
|
|
1
|
+
import { n as dingtalkPlugin, r as initDingtalkPluginConfigSchema } from "./channel-Dvvp_ILl.mjs";
|
|
2
2
|
import { n as setDingtalkRuntime } from "./runtime-DDMzayvA.mjs";
|
|
3
|
-
import { t as registerGatewayMethods } from "./gateway-methods-
|
|
3
|
+
import { t as registerGatewayMethods } from "./gateway-methods-8vkUpQ7L.mjs";
|
|
4
4
|
//#region index.ts
|
|
5
5
|
/**
|
|
6
6
|
* 检测同一 plugin id 在多个路径被加载的情况。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as isDingtalkDebug } from "./logger-CnBTcwyq.mjs";
|
|
2
2
|
import { n as dingtalkOapiHttp, t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
|
|
3
|
-
import { n as DINGTALK_OAPI } from "./utils-
|
|
3
|
+
import { n as DINGTALK_OAPI } from "./utils-CIfI_3Jh.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
import * as os from "os";
|
|
@@ -667,7 +667,7 @@ async function extractAudioDuration(filePath, log) {
|
|
|
667
667
|
*/
|
|
668
668
|
async function sendVideoMessage(config, sessionWebhook, fileName, mediaId, log, metadata) {
|
|
669
669
|
try {
|
|
670
|
-
const token = await (await import("./utils-
|
|
670
|
+
const token = await (await import("./utils-DhRpzVq1.mjs")).getAccessToken(config);
|
|
671
671
|
const videoMessage = {
|
|
672
672
|
msgtype: "video",
|
|
673
673
|
video: {
|
|
@@ -695,8 +695,8 @@ async function sendVideoMessage(config, sessionWebhook, fileName, mediaId, log,
|
|
|
695
695
|
*/
|
|
696
696
|
async function sendVideoProactive(config, target, videoMediaId, picMediaId, metadata, log) {
|
|
697
697
|
try {
|
|
698
|
-
const token = await (await import("./utils-
|
|
699
|
-
const { DINGTALK_API } = await import("./utils-
|
|
698
|
+
const token = await (await import("./utils-DhRpzVq1.mjs")).getAccessToken(config);
|
|
699
|
+
const { DINGTALK_API } = await import("./utils-DhRpzVq1.mjs");
|
|
700
700
|
const msgParam = {
|
|
701
701
|
duration: metadata?.duration.toString() || "60000",
|
|
702
702
|
videoMediaId,
|
|
@@ -741,8 +741,8 @@ async function sendVideoProactive(config, target, videoMediaId, picMediaId, meta
|
|
|
741
741
|
*/
|
|
742
742
|
async function sendAudioProactive(config, target, fileName, mediaId, log, durationMs) {
|
|
743
743
|
try {
|
|
744
|
-
const token = await (await import("./utils-
|
|
745
|
-
const { DINGTALK_API } = await import("./utils-
|
|
744
|
+
const token = await (await import("./utils-DhRpzVq1.mjs")).getAccessToken(config);
|
|
745
|
+
const { DINGTALK_API } = await import("./utils-DhRpzVq1.mjs");
|
|
746
746
|
const msgParam = {
|
|
747
747
|
mediaId,
|
|
748
748
|
duration: durationMs && durationMs > 0 ? durationMs.toString() : "60000"
|
|
@@ -779,8 +779,8 @@ async function sendAudioProactive(config, target, fileName, mediaId, log, durati
|
|
|
779
779
|
*/
|
|
780
780
|
async function sendFileProactive(config, target, fileInfo, mediaId, log) {
|
|
781
781
|
try {
|
|
782
|
-
const token = await (await import("./utils-
|
|
783
|
-
const { DINGTALK_API } = await import("./utils-
|
|
782
|
+
const token = await (await import("./utils-DhRpzVq1.mjs")).getAccessToken(config);
|
|
783
|
+
const { DINGTALK_API } = await import("./utils-DhRpzVq1.mjs");
|
|
784
784
|
const resolvedFileName = fileInfo.fileName || path.basename(fileInfo.path);
|
|
785
785
|
const msgParam = {
|
|
786
786
|
mediaId,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as toLocalPath, d as processLocalImages, f as processRawMediaPaths, h as sendFileProactive, o as hasResidualLocalMdImagesOutsideCode, p as processVideoMarkers } from "./media-
|
|
1
|
+
import { _ as toLocalPath, d as processLocalImages, f as processRawMediaPaths, h as sendFileProactive, o as hasResidualLocalMdImagesOutsideCode, p as processVideoMarkers } from "./media-0v9wuQ_w.mjs";
|
|
2
2
|
export { hasResidualLocalMdImagesOutsideCode, processLocalImages, processRawMediaPaths, processVideoMarkers, sendFileProactive, toLocalPath };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as resolveDingtalkAccount } from "./accounts-BAzdqkAV.mjs";
|
|
2
|
-
import { t as CHANNEL_ID } from "./channel-
|
|
2
|
+
import { t as CHANNEL_ID } from "./channel-Dvvp_ILl.mjs";
|
|
3
3
|
import { n as createLoggerFromConfig, r as isDingtalkDebug } from "./logger-CnBTcwyq.mjs";
|
|
4
4
|
import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
|
|
5
|
-
import { i as getOapiAccessToken } from "./utils-
|
|
6
|
-
import { S as finalClean, _ as FINAL_TAG, a as sendTextMessage, b as estimateTokens, d as finishAICard, g as unregisterActiveCard, h as streamAICard, i as sendProactive, m as registerActiveCard, p as isQpsLimitError, r as sendMessage, t as sendMarkdownMessage, u as createAICardForTarget, v as PROCESS_TAG, x as extractFinal, y as displayClean } from "./messaging-
|
|
7
|
-
import { n as isAbortCommand, o as QUEUE_BUSY_ACK_PHRASES, r as normalizeSlashCommand, t as buildSessionContext } from "./session-
|
|
5
|
+
import { i as getOapiAccessToken } from "./utils-CIfI_3Jh.mjs";
|
|
6
|
+
import { S as finalClean, _ as FINAL_TAG, a as sendTextMessage, b as estimateTokens, d as finishAICard, g as unregisterActiveCard, h as streamAICard, i as sendProactive, m as registerActiveCard, p as isQpsLimitError, r as sendMessage, t as sendMarkdownMessage, u as createAICardForTarget, v as PROCESS_TAG, x as extractFinal, y as displayClean } from "./messaging-DV1FRpgD.mjs";
|
|
7
|
+
import { n as isAbortCommand, o as QUEUE_BUSY_ACK_PHRASES, r as normalizeSlashCommand, t as buildSessionContext } from "./session-CLaaCx85.mjs";
|
|
8
8
|
import { t as getDingtalkRuntime } from "./runtime-DDMzayvA.mjs";
|
|
9
|
-
import { c as formatSenderRoles, f as getUserProfile, h as recallEmotionReply, l as getAccessToken, o as formatHiredDateShanghai, r as addEmotionReply, s as formatSenderDisplayLabel, t as DINGTALK_API, u as getOapiAccessToken$1 } from "./utils-legacy-
|
|
9
|
+
import { c as formatSenderRoles, f as getUserProfile, h as recallEmotionReply, l as getAccessToken, o as formatHiredDateShanghai, r as addEmotionReply, s as formatSenderDisplayLabel, t as DINGTALK_API, u as getOapiAccessToken$1 } from "./utils-legacy-CGEa8tg2.mjs";
|
|
10
10
|
import { r as trackBackgroundWork } from "./background-work-874-aK4-.mjs";
|
|
11
11
|
import "./chunk-upload-z185bTqH.mjs";
|
|
12
12
|
import { a as toLocalPath, i as VIDEO_MARKER_PATTERN, o as uploadMediaToDingTalk, r as FILE_MARKER_PATTERN, t as AUDIO_MARKER_PATTERN } from "./common-1-GDZ2h3.mjs";
|
|
@@ -64,7 +64,7 @@ function resolveAgentWorkspaceDir(cfg, agentId) {
|
|
|
64
64
|
* 直接复用 media.ts 权威实现,避免 reply 路径与 message 路径两套逻辑分叉。
|
|
65
65
|
*/
|
|
66
66
|
async function processLocalImages(content, oapiToken, log) {
|
|
67
|
-
const { processLocalImages: impl } = await import("./media-
|
|
67
|
+
const { processLocalImages: impl } = await import("./media-D7-wqWrP.mjs");
|
|
68
68
|
return impl(content, oapiToken, log);
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
@@ -615,13 +615,13 @@ function createDingtalkReplyDispatcher(params) {
|
|
|
615
615
|
finalText = await processLocalImages(finalText, oapiToken, log);
|
|
616
616
|
if (beforeImg !== finalText) log.info(`[DingTalk][LocalImage] closeStreaming 图片已处理 | ${beforeImg.length}→${finalText.length}`);
|
|
617
617
|
try {
|
|
618
|
-
const { hasResidualLocalMdImagesOutsideCode } = await import("./media-
|
|
618
|
+
const { hasResidualLocalMdImagesOutsideCode } = await import("./media-D7-wqWrP.mjs");
|
|
619
619
|
if (hasResidualLocalMdImagesOutsideCode(finalText)) log.warn(`[DingTalk][LocalImage] closeStreaming 定稿后仍有代码块外的本地 MD 图未上传,钉钉可能灰图`);
|
|
620
620
|
} catch {}
|
|
621
621
|
finalText = await processVideoMarkers(finalText, "", account.config, oapiToken, log, true, target);
|
|
622
622
|
finalText = await processAudioMarkers(finalText, "", account.config, oapiToken, log, true, target);
|
|
623
623
|
finalText = await uploadAndReplaceFileMarkers(finalText, "", account.config, oapiToken, log, true, target);
|
|
624
|
-
const { processRawMediaPaths } = await import("./media-
|
|
624
|
+
const { processRawMediaPaths } = await import("./media-D7-wqWrP.mjs");
|
|
625
625
|
finalText = await processRawMediaPaths(finalText, account.config, oapiToken, log, target);
|
|
626
626
|
log.info(`[DingTalk][closeStreaming] processRawMediaPaths 处理完成`);
|
|
627
627
|
} else log.warn(`[DingTalk][closeStreaming] oapiToken 为空,跳过媒体处理`);
|
|
@@ -850,7 +850,7 @@ function createDingtalkReplyDispatcher(params) {
|
|
|
850
850
|
const oapiToken = await getOapiAccessToken(account.config);
|
|
851
851
|
if (oapiToken) {
|
|
852
852
|
log.info(`[DingTalk][deliver] 检测到 final 响应,准备处理裸露文件路径`);
|
|
853
|
-
const { processRawMediaPaths } = await import("./media-
|
|
853
|
+
const { processRawMediaPaths } = await import("./media-D7-wqWrP.mjs");
|
|
854
854
|
text = await processRawMediaPaths(text, account.config, oapiToken, log, target);
|
|
855
855
|
log.info(`[DingTalk][deliver] 裸露文件路径处理完成`);
|
|
856
856
|
}
|
|
@@ -1037,7 +1037,7 @@ function createDingtalkReplyDispatcher(params) {
|
|
|
1037
1037
|
payload.output,
|
|
1038
1038
|
commandText
|
|
1039
1039
|
].filter(Boolean).join("\n") || "";
|
|
1040
|
-
if (/\bdws\b/i.test(fullCmd)) import("./dws-delivery-context-
|
|
1040
|
+
if (/\bdws\b/i.test(fullCmd)) import("./dws-delivery-context-Db1X5jNl.mjs").then(({ maybeInjectDwsOutboundContext }) => maybeInjectDwsOutboundContext({
|
|
1041
1041
|
cfg,
|
|
1042
1042
|
accountConfig: account.config,
|
|
1043
1043
|
agentId,
|
|
@@ -2356,7 +2356,7 @@ async function handleDingTalkMessageInternal(params) {
|
|
|
2356
2356
|
finalText = await processVideoMarkers(finalText, "", config, oapiToken, log, true, mediaTarget);
|
|
2357
2357
|
finalText = await processAudioMarkers(finalText, "", config, oapiToken, log, true, mediaTarget);
|
|
2358
2358
|
finalText = await uploadAndReplaceFileMarkers(finalText, "", config, oapiToken, log, true, mediaTarget);
|
|
2359
|
-
const { processRawMediaPaths } = await import("./media-
|
|
2359
|
+
const { processRawMediaPaths } = await import("./media-D7-wqWrP.mjs");
|
|
2360
2360
|
finalText = await processRawMediaPaths(finalText, config, oapiToken, log, mediaTarget);
|
|
2361
2361
|
}
|
|
2362
2362
|
const textToSend = finalText.trim() || "✅ 任务执行完成(无文本输出)";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as logMediaIdTrace, d as processLocalImages, u as processImagesForOutbound, y as uploadMediaToDingTalk } from "./media-
|
|
1
|
+
import { c as logMediaIdTrace, d as processLocalImages, u as processImagesForOutbound, y as uploadMediaToDingTalk } from "./media-0v9wuQ_w.mjs";
|
|
2
2
|
import { n as createLoggerFromConfig, r as isDingtalkDebug } from "./logger-CnBTcwyq.mjs";
|
|
3
3
|
import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
|
|
4
|
-
import { i as getOapiAccessToken, r as getAccessToken, t as DINGTALK_API } from "./utils-
|
|
5
|
-
import { i as MEDIA_MSG_TYPES } from "./session-
|
|
4
|
+
import { i as getOapiAccessToken, r as getAccessToken, t as DINGTALK_API } from "./utils-CIfI_3Jh.mjs";
|
|
5
|
+
import { i as MEDIA_MSG_TYPES } from "./session-CLaaCx85.mjs";
|
|
6
6
|
//#region src/services/reply-markers.ts
|
|
7
7
|
const PROCESS_TAG = "[-process-]";
|
|
8
8
|
const FINAL_TAG = "[-final-]";
|
|
@@ -876,7 +876,7 @@ async function resolveMediaSourceToLocalFile(mediaUrl, mediaLocalRoots, log) {
|
|
|
876
876
|
cleanup: tmp
|
|
877
877
|
};
|
|
878
878
|
}
|
|
879
|
-
const { toLocalPath } = await import("./media-
|
|
879
|
+
const { toLocalPath } = await import("./media-D7-wqWrP.mjs");
|
|
880
880
|
const _fs = await import("fs");
|
|
881
881
|
const _path = await import("path");
|
|
882
882
|
let resolved = toLocalPath(mediaUrl);
|
|
@@ -1143,7 +1143,7 @@ async function sendMediaToDingTalk(params) {
|
|
|
1143
1143
|
const fileName = mediaUrl.split("/").filter(Boolean).pop()?.split("?")[0] || "file";
|
|
1144
1144
|
if (mediaType === "video") {
|
|
1145
1145
|
const videoMarker = `[DINGTALK_VIDEO]{"path":"${resolvedMediaUrl}"}[/DINGTALK_VIDEO]`;
|
|
1146
|
-
const { processVideoMarkers } = await import("./media-
|
|
1146
|
+
const { processVideoMarkers } = await import("./media-D7-wqWrP.mjs");
|
|
1147
1147
|
await processVideoMarkers(videoMarker, "", config, oapiToken, console, true, targetParam);
|
|
1148
1148
|
return {
|
|
1149
1149
|
ok: true,
|
|
@@ -1162,7 +1162,7 @@ async function sendMediaToDingTalk(params) {
|
|
|
1162
1162
|
fileName,
|
|
1163
1163
|
fileType: ext && ext.length < 12 ? ext : "file"
|
|
1164
1164
|
};
|
|
1165
|
-
const { sendFileProactive } = await import("./media-
|
|
1165
|
+
const { sendFileProactive } = await import("./media-D7-wqWrP.mjs");
|
|
1166
1166
|
await sendFileProactive(config, targetParam, fileInfo, uploadResult.mediaId, log);
|
|
1167
1167
|
return {
|
|
1168
1168
|
ok: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
//#region src/utils/constants.ts
|
|
2
3
|
/**
|
|
3
4
|
* 常量定义模块
|
|
@@ -116,14 +117,24 @@ function buildSessionContext(params) {
|
|
|
116
117
|
groupSubject
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
|
-
/**
|
|
120
|
-
* 尝试动态加载 SDK 中的 isAbortRequestText
|
|
121
|
-
*/
|
|
122
120
|
let sdkIsAbortRequestText = null;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
|
|
121
|
+
let sdkLoadAttempted = false;
|
|
122
|
+
function getSdkAbortDetector() {
|
|
123
|
+
if (!sdkLoadAttempted) {
|
|
124
|
+
sdkLoadAttempted = true;
|
|
125
|
+
try {
|
|
126
|
+
const req = createRequire(import.meta.url);
|
|
127
|
+
for (const pkg of ["openclaw", "jeikclaw"]) try {
|
|
128
|
+
const mod = req(`${pkg}/plugin-sdk/command-primitives-runtime`);
|
|
129
|
+
if (typeof mod?.isAbortRequestText === "function") {
|
|
130
|
+
sdkIsAbortRequestText = mod.isAbortRequestText;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
} catch {}
|
|
134
|
+
} catch {}
|
|
135
|
+
}
|
|
136
|
+
return sdkIsAbortRequestText;
|
|
137
|
+
}
|
|
127
138
|
/**
|
|
128
139
|
* 检查消息是否是中止/停止任务命令
|
|
129
140
|
* 支持 /stop, stop, 停止, 暂停 等,以及群聊中带 @机器人 /stop 的情况
|
|
@@ -132,13 +143,14 @@ function isAbortCommand(text) {
|
|
|
132
143
|
if (!text) return false;
|
|
133
144
|
const trimmed = text.trim();
|
|
134
145
|
if (!trimmed) return false;
|
|
146
|
+
const detector = getSdkAbortDetector();
|
|
135
147
|
try {
|
|
136
|
-
if (
|
|
148
|
+
if (detector?.(trimmed)) return true;
|
|
137
149
|
} catch {}
|
|
138
150
|
const stripped = trimmed.replace(/@[^\s]+/g, "").trim();
|
|
139
151
|
if (stripped) {
|
|
140
152
|
try {
|
|
141
|
-
if (
|
|
153
|
+
if (detector?.(stripped)) return true;
|
|
142
154
|
} catch {}
|
|
143
155
|
const lower = stripped.toLowerCase().replace(/^[!/]/, "");
|
|
144
156
|
if (STOP_COMMANDS.some((cmd) => cmd.toLowerCase().replace(/^[!/]/, "") === lower)) return true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./logger-CnBTcwyq.mjs";
|
|
2
|
-
import { r as getAccessToken, t as DINGTALK_API } from "./utils-
|
|
3
|
-
import "./session-
|
|
2
|
+
import { r as getAccessToken, t as DINGTALK_API } from "./utils-CIfI_3Jh.mjs";
|
|
3
|
+
import "./session-CLaaCx85.mjs";
|
|
4
4
|
export { DINGTALK_API, getAccessToken };
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/utils/session.ts
CHANGED
|
@@ -134,17 +134,28 @@ export function buildSessionContext(params: {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*/
|
|
137
|
+
import { createRequire } from 'node:module';
|
|
138
|
+
|
|
140
139
|
let sdkIsAbortRequestText: ((text?: string, options?: any) => boolean) | null = null;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
let sdkLoadAttempted = false;
|
|
141
|
+
|
|
142
|
+
function getSdkAbortDetector(): ((text?: string, options?: any) => boolean) | null {
|
|
143
|
+
if (!sdkLoadAttempted) {
|
|
144
|
+
sdkLoadAttempted = true;
|
|
145
|
+
try {
|
|
146
|
+
const req = createRequire(import.meta.url);
|
|
147
|
+
for (const pkg of ['openclaw', 'jeikclaw']) {
|
|
148
|
+
try {
|
|
149
|
+
const mod = req(`${pkg}/plugin-sdk/command-primitives-runtime`);
|
|
150
|
+
if (typeof mod?.isAbortRequestText === 'function') {
|
|
151
|
+
sdkIsAbortRequestText = mod.isAbortRequestText;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
} catch {}
|
|
155
|
+
}
|
|
156
|
+
} catch {}
|
|
145
157
|
}
|
|
146
|
-
|
|
147
|
-
// 忽略加载异常,走内联 fallback
|
|
158
|
+
return sdkIsAbortRequestText;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
/**
|
|
@@ -157,15 +168,16 @@ export function isAbortCommand(text?: string): boolean {
|
|
|
157
168
|
if (!trimmed) return false;
|
|
158
169
|
|
|
159
170
|
// 1. SDK 原生判断
|
|
171
|
+
const detector = getSdkAbortDetector();
|
|
160
172
|
try {
|
|
161
|
-
if (
|
|
173
|
+
if (detector?.(trimmed)) return true;
|
|
162
174
|
} catch {}
|
|
163
175
|
|
|
164
176
|
// 2. 去除 @ 提及前缀后判断(针对群聊中 @机器人 /stop 的情况)
|
|
165
177
|
const stripped = trimmed.replace(/@[^\s]+/g, "").trim();
|
|
166
178
|
if (stripped) {
|
|
167
179
|
try {
|
|
168
|
-
if (
|
|
180
|
+
if (detector?.(stripped)) return true;
|
|
169
181
|
} catch {}
|
|
170
182
|
|
|
171
183
|
const lower = stripped.toLowerCase().replace(/^[!/]/, "");
|