Skip to content

Commit 754acc4

Browse files
committed
perf: reduce telegram test import drag
1 parent d268c85 commit 754acc4

8 files changed

Lines changed: 16 additions & 9 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1d2767b688414ac41305e88c830858c00947e2d7c713f1a25d86f38cd577620e plugin-sdk-api-baseline.json
2-
e5167477ab6aa2e67bd4361048cf5f6f8fd1cb7ee570544c634d14417f890674 plugin-sdk-api-baseline.jsonl
1+
793ed905cb0ba93b9a2f8c2c85c3cfb4d194dd9263353e74952bf9e382b03dc2 plugin-sdk-api-baseline.json
2+
032e7fd6f48344c9b3b98fd3e877e6d30cab92ed9a39dd309796cf1f0220820f plugin-sdk-api-baseline.jsonl

docs/plugins/sdk-subpaths.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ For the plugin authoring guide, see [Plugin SDK overview](/plugins/sdk-overview)
121121
| `plugin-sdk/approval-reply-runtime` | Exec/plugin approval reply payload helpers |
122122
| `plugin-sdk/command-auth-native` | Native command auth + native session-target helpers |
123123
| `plugin-sdk/command-detection` | Shared command detection helpers |
124+
| `plugin-sdk/command-primitives-runtime` | Lightweight command text predicates for hot channel paths |
124125
| `plugin-sdk/command-surface` | Command-body normalization and command-surface helpers |
125126
| `plugin-sdk/allow-from` | `formatAllowFromLowercase` |
126127
| `plugin-sdk/channel-secret-runtime` | Narrow secret-contract collection helpers for channel/plugin secret surfaces |

extensions/telegram/src/bot-message-dispatch.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
resolveChannelStreamingBlockEnabled,
1111
resolveChannelStreamingPreviewToolProgress,
1212
} from "openclaw/plugin-sdk/channel-streaming";
13+
import { isAbortRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
1314
import type {
1415
OpenClawConfig,
1516
ReplyToMode,
@@ -22,15 +23,15 @@ import {
2223
} from "openclaw/plugin-sdk/outbound-runtime";
2324
import { clearHistoryEntriesIfEnabled } from "openclaw/plugin-sdk/reply-history";
2425
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
25-
import { isAbortRequestText, type ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
26+
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-payload";
2627
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
2728
import {
2829
createSubsystemLogger,
2930
danger,
3031
logVerbose,
3132
sleepWithAbort,
3233
} from "openclaw/plugin-sdk/runtime-env";
33-
import { defaultTelegramBotDeps, type TelegramBotDeps } from "./bot-deps.js";
34+
import type { TelegramBotDeps } from "./bot-deps.js";
3435
import type { TelegramMessageContext } from "./bot-message-context.js";
3536
import {
3637
findModelInCatalog,
@@ -215,9 +216,11 @@ export const dispatchTelegramMessage = async ({
215216
streamMode,
216217
textLimit,
217218
telegramCfg,
218-
telegramDeps = defaultTelegramBotDeps,
219+
telegramDeps: injectedTelegramDeps,
219220
opts,
220221
}: DispatchTelegramMessageParams) => {
222+
const telegramDeps =
223+
injectedTelegramDeps ?? (await import("./bot-deps.js")).defaultTelegramBotDeps;
221224
const {
222225
ctxPayload,
223226
msg,

extensions/telegram/src/target-writeback.test.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

extensions/telegram/src/targets.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,4 @@ describe("telegram target normalization", () => {
273273
});
274274
});
275275

276-
installMaybePersistResolvedTelegramTargetTests();
276+
installMaybePersistResolvedTelegramTargetTests({ includeGatewayScopeCases: true });

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@
525525
"types": "./dist/plugin-sdk/command-gating.d.ts",
526526
"default": "./dist/plugin-sdk/command-gating.js"
527527
},
528+
"./plugin-sdk/command-primitives-runtime": {
529+
"types": "./dist/plugin-sdk/command-primitives-runtime.d.ts",
530+
"default": "./dist/plugin-sdk/command-primitives-runtime.js"
531+
},
528532
"./plugin-sdk/command-status": {
529533
"types": "./dist/plugin-sdk/command-status.d.ts",
530534
"default": "./dist/plugin-sdk/command-status.js"

scripts/lib/plugin-sdk-entrypoints.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"command-auth",
118118
"command-auth-native",
119119
"command-gating",
120+
"command-primitives-runtime",
120121
"command-status",
121122
"command-status-runtime",
122123
"command-detection",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { isAbortRequestText } from "../auto-reply/reply/abort-primitives.js";

0 commit comments

Comments
 (0)