Skip to content

Commit 3cc83cb

Browse files
committed
Plugins: internalize msteams SDK imports
1 parent a41840f commit 3cc83cb

27 files changed

Lines changed: 31 additions & 32 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
- Never add `@ts-nocheck` and do not disable `no-explicit-any`; fix root causes and update Oxlint/Oxfmt config only when required.
115115
- Dynamic import guardrail: do not mix `await import("x")` and static `import ... from "x"` for the same module in production code paths. If you need lazy loading, create a dedicated `*.runtime.ts` boundary (that re-exports from `x`) and dynamically import that boundary from lazy callers only.
116116
- Dynamic import verification: after refactors that touch lazy-loading/module boundaries, run `pnpm build` and check for `[INEFFECTIVE_DYNAMIC_IMPORT]` warnings before submitting.
117+
- Extension SDK self-import guardrail: inside an extension package, do not import that same extension via `openclaw/plugin-sdk/<extension>` from production files. Route internal imports through a local barrel such as `./api.ts` or `./runtime-api.ts`, and keep the `plugin-sdk/<extension>` path as the external contract only.
117118
- Never share class behavior via prototype mutation (`applyPrototypeMixins`, `Object.defineProperty` on `.prototype`, or exporting `Class.prototype` for merges). Use explicit inheritance/composition (`A extends B extends C`) or helper composition so TypeScript can typecheck.
118119
- If this pattern is needed, stop and get explicit approval before shipping; default behavior is to split/refactor into an explicit class hierarchy and keep members strongly typed.
119120
- In tests, prefer per-instance stubs over prototype mutation (`SomeClass.prototype.method = ...`) unless a test explicitly documents why prototype-level patching is required.

extensions/msteams/runtime-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "openclaw/plugin-sdk/msteams";

extensions/msteams/src/attachments/graph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fetchWithSsrFGuard, type SsrFPolicy } from "openclaw/plugin-sdk/msteams";
1+
import { fetchWithSsrFGuard, type SsrFPolicy } from "../../runtime-api.js";
22
import { getMSTeamsRuntime } from "../runtime.js";
33
import { downloadMSTeamsAttachments } from "./download.js";
44
import { downloadAndStoreMSTeamsRemoteMedia } from "./remote-media.js";

extensions/msteams/src/attachments/payload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { buildMediaPayload } from "openclaw/plugin-sdk/msteams";
1+
import { buildMediaPayload } from "../../runtime-api.js";
22

33
export function buildMSTeamsMediaPayload(
44
mediaList: Array<{ path: string; contentType?: string }>,

extensions/msteams/src/attachments/remote-media.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SsrFPolicy } from "openclaw/plugin-sdk/msteams";
1+
import type { SsrFPolicy } from "../../runtime-api.js";
22
import { getMSTeamsRuntime } from "../runtime.js";
33
import { inferPlaceholder } from "./shared.js";
44
import type { MSTeamsInboundMedia } from "./types.js";

extensions/msteams/src/attachments/shared.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
isHttpsUrlAllowedByHostnameSuffixAllowlist,
55
isPrivateIpAddress,
66
normalizeHostnameSuffixAllowlist,
7-
} from "openclaw/plugin-sdk/msteams";
8-
import type { SsrFPolicy } from "openclaw/plugin-sdk/msteams";
7+
} from "../../runtime-api.js";
8+
import type { SsrFPolicy } from "../../runtime-api.js";
99
import type { MSTeamsAttachmentLike } from "./types.js";
1010

1111
type InlineImageCandidate =

extensions/msteams/src/channel.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import type {
66
ChannelMessageToolDiscovery,
77
} from "openclaw/plugin-sdk/channel-runtime";
88
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
9-
import type {
10-
ChannelMessageActionName,
11-
ChannelPlugin,
12-
OpenClawConfig,
13-
} from "openclaw/plugin-sdk/msteams";
9+
import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "../runtime-api.js";
1410
import {
1511
buildProbeChannelStatusSummary,
1612
buildRuntimeAccountStatusSnapshot,
@@ -19,7 +15,7 @@ import {
1915
DEFAULT_ACCOUNT_ID,
2016
MSTeamsConfigSchema,
2117
PAIRING_APPROVED_MESSAGE,
22-
} from "openclaw/plugin-sdk/msteams";
18+
} from "../runtime-api.js";
2319
import { resolveMSTeamsGroupToolPolicy } from "./policy.js";
2420
import type { ProbeMSTeamsResult } from "./probe.js";
2521
import {

extensions/msteams/src/directory-live.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/msteams";
1+
import type { ChannelDirectoryEntry } from "../runtime-api.js";
22
import { searchGraphUsers } from "./graph-users.js";
33
import {
44
type GraphChannel,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { withFileLock } from "openclaw/plugin-sdk/msteams";
1+
export { withFileLock } from "../runtime-api.js";

extensions/msteams/src/graph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
1+
import type { MSTeamsConfig } from "../runtime-api.js";
22
import { GRAPH_ROOT } from "./attachments/shared.js";
33
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
44
import { readAccessToken } from "./token-response.js";

0 commit comments

Comments
 (0)