@soimy/dingtalk 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +13 -24
  2. package/openclaw.plugin.json +695 -0
  3. package/package.json +12 -7
  4. package/src/ack-reaction-service.ts +1 -1
  5. package/src/auth.ts +1 -1
  6. package/src/card/card-action-handler.ts +1 -1
  7. package/src/card/card-stop-handler.ts +1 -1
  8. package/src/card/card-streaming-mode.ts +30 -0
  9. package/src/card/reasoning-answer-split.ts +162 -0
  10. package/src/card/reasoning-block-assembler.ts +157 -0
  11. package/src/card-callback-service.ts +1 -1
  12. package/src/card-draft-controller.ts +117 -6
  13. package/src/card-service.ts +112 -1
  14. package/src/channel.ts +131 -96
  15. package/src/command/card-stop-command.ts +4 -22
  16. package/src/command/inbound-command-dispatch-service.ts +464 -0
  17. package/src/config-schema.ts +62 -38
  18. package/src/config.ts +25 -3
  19. package/src/docs-service.ts +5 -5
  20. package/src/http-client.ts +20 -0
  21. package/src/inbound-handler.ts +475 -501
  22. package/src/logger-context.ts +16 -2
  23. package/src/media-utils.ts +166 -10
  24. package/src/message-utils.ts +33 -5
  25. package/src/{attachment-text-extractor.ts → messaging/attachment-text-extractor.ts} +1 -1
  26. package/src/{quoted-file-service.ts → messaging/quoted-file-service.ts} +14 -9
  27. package/src/onboarding.ts +29 -0
  28. package/src/plugin-sdk-channel-actions-augment.ts +11 -0
  29. package/src/reply-strategy-card.ts +294 -28
  30. package/src/reply-strategy-markdown.ts +124 -19
  31. package/src/reply-strategy.ts +22 -2
  32. package/src/send-service.ts +178 -7
  33. package/src/targeting/agent-routing.ts +55 -32
  34. package/src/{group-members-store.ts → targeting/group-members-store.ts} +1 -1
  35. package/src/types.ts +60 -4
  36. package/src/utils.ts +190 -0
package/src/config.ts CHANGED
@@ -26,12 +26,34 @@ function normalizeLearningConfig(
26
26
  learningNoteTtlMs: options.applyDefaults
27
27
  ? config.learningNoteTtlMs ?? DEFAULT_LEARNING_NOTE_TTL_MS
28
28
  : config.learningNoteTtlMs,
29
+ cardStreamingMode: options.applyDefaults
30
+ ? (config.cardStreamingMode ?? (config.cardRealTimeStream === true ? "all" : "off"))
31
+ : config.cardStreamingMode,
29
32
  };
30
33
  }
31
34
 
32
35
  function stripRemovedLegacyFields(config: DingTalkConfig): DingTalkConfig {
33
- const { verboseRealtimeStream: _verboseRealtimeStream, ...rest } =
34
- config as DingTalkConfig & { verboseRealtimeStream?: unknown };
36
+ const {
37
+ verboseRealtimeStream: _verboseRealtimeStream,
38
+ cardStreamReasoning: _cardStreamReasoning,
39
+ accounts,
40
+ ...rest
41
+ } = config as DingTalkConfig & {
42
+ verboseRealtimeStream?: unknown;
43
+ cardStreamReasoning?: unknown;
44
+ accounts?: Record<string, DingTalkConfig | undefined>;
45
+ };
46
+ const sanitizedAccounts = accounts
47
+ ? Object.fromEntries(
48
+ Object.entries(accounts).map(([accountId, accountConfig]) => [
49
+ accountId,
50
+ accountConfig ? stripRemovedLegacyFields(accountConfig) : accountConfig,
51
+ ]),
52
+ )
53
+ : undefined;
54
+ if (sanitizedAccounts) {
55
+ return { ...rest, accounts: sanitizedAccounts } as DingTalkConfig;
56
+ }
35
57
  return rest as DingTalkConfig;
36
58
  }
37
59
 
@@ -84,7 +106,7 @@ export function getConfig(cfg: OpenClawConfig, accountId?: string): DingTalkConf
84
106
  }
85
107
 
86
108
  if (dingtalkCfg.accounts && Object.keys(dingtalkCfg.accounts).length > 0) {
87
- return dingtalkCfg;
109
+ return stripRemovedLegacyFields(dingtalkCfg);
88
110
  }
89
111
 
90
112
  return stripRemovedLegacyFields(normalizeLearningConfig(dingtalkCfg, { applyDefaults: true }));
@@ -1,4 +1,4 @@
1
- import axios from "axios";
1
+ import axios, { DEFAULT_HTTP_TIMEOUT_MS } from "./http-client";
2
2
  import { getAccessToken } from "./auth";
3
3
  import { getLogger } from "./logger-context";
4
4
  import { getProxyBypassOption } from "./utils";
@@ -103,7 +103,7 @@ export async function createDoc(
103
103
  },
104
104
  {
105
105
  headers,
106
- timeout: 10_000,
106
+ timeout: DEFAULT_HTTP_TIMEOUT_MS,
107
107
  ...getProxyBypassOption(config),
108
108
  },
109
109
  );
@@ -141,7 +141,7 @@ export async function appendToDoc(
141
141
  },
142
142
  {
143
143
  headers,
144
- timeout: 10_000,
144
+ timeout: DEFAULT_HTTP_TIMEOUT_MS,
145
145
  ...getProxyBypassOption(config),
146
146
  },
147
147
  );
@@ -167,7 +167,7 @@ export async function searchDocs(
167
167
  },
168
168
  {
169
169
  headers,
170
- timeout: 10_000,
170
+ timeout: DEFAULT_HTTP_TIMEOUT_MS,
171
171
  ...getProxyBypassOption(config),
172
172
  },
173
173
  );
@@ -189,7 +189,7 @@ export async function listDocs(
189
189
  maxResults: 50,
190
190
  ...(parentId ? { parentDentryId: parentId } : {}),
191
191
  },
192
- timeout: 10_000,
192
+ timeout: DEFAULT_HTTP_TIMEOUT_MS,
193
193
  ...getProxyBypassOption(config),
194
194
  });
195
195
  return Array.isArray(resp.data?.items)
@@ -0,0 +1,20 @@
1
+ import axios from "axios";
2
+ import type { AxiosInstance } from "axios";
3
+
4
+ export const DEFAULT_HTTP_TIMEOUT_MS = 10_000;
5
+
6
+ type AxiosInstanceWithGuards = AxiosInstance & {
7
+ isAxiosError: typeof axios.isAxiosError;
8
+ };
9
+
10
+ // Centralize repo-level axios policy without mutating the global axios singleton
11
+ // that third-party dependencies may also share.
12
+ const httpClient = (
13
+ typeof axios?.create === "function"
14
+ ? axios.create({ timeout: DEFAULT_HTTP_TIMEOUT_MS })
15
+ : axios
16
+ ) as AxiosInstanceWithGuards;
17
+
18
+ httpClient.isAxiosError = axios.isAxiosError;
19
+
20
+ export default httpClient;