Harden line internal imports and test typings

This commit is contained in:
sunke 2026-03-21 10:13:37 +08:00
parent 2e603e15b6
commit 6430c54f6f
6 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import type { LineChannelData, OpenClawPluginApi, ReplyPayload } from "../api.js";
import type { LineChannelData, OpenClawPluginApi, ReplyPayload } from "../runtime-api.js";
import {
createActionCard,
createImageCard,
@ -7,7 +7,7 @@ import {
createReceiptCard,
type CardAction,
type ListItem,
} from "../api.js";
} from "../runtime-api.js";
const CARD_USAGE = `Usage: /card <type> "title" "body" [options]

View File

@ -3,7 +3,7 @@ import {
LineConfigSchema,
type ChannelPlugin,
type ResolvedLineAccount,
} from "../api.js";
} from "../runtime-api.js";
import { lineConfigAdapter } from "./config-adapter.js";
import { lineSetupAdapter } from "./setup-core.js";
import { lineSetupWizard } from "./setup-surface.js";

View File

@ -22,7 +22,7 @@ import {
type LineChannelData,
type OpenClawConfig,
type ResolvedLineAccount,
} from "../api.js";
} from "../runtime-api.js";
import { lineConfigAdapter } from "./config-adapter.js";
import { resolveLineGroupRequireMention } from "./group-policy.js";
import { getLineRuntime } from "./runtime.js";

View File

@ -1,3 +1,3 @@
import { buildChannelConfigSchema, LineConfigSchema } from "../api.js";
import { buildChannelConfigSchema, LineConfigSchema } from "../runtime-api.js";
export const LineChannelConfigSchema = buildChannelConfigSchema(LineConfigSchema);

View File

@ -1,5 +1,5 @@
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
import type { PluginRuntime } from "../api.js";
import type { PluginRuntime } from "../runtime-api.js";
const { setRuntime: setLineRuntime, getRuntime: getLineRuntime } =
createPluginRuntimeStore<PluginRuntime>("LINE runtime not initialized - plugin not registered");

View File

@ -120,7 +120,7 @@ describe("resolveGraphChatId", () => {
it("resolves personal DM chat ID via Graph API using user AAD object ID", async () => {
const fetchFn = vi.fn(
async () =>
async (_url: string | Request | URL, _init?: RequestInit) =>
new Response(JSON.stringify({ value: [{ id: "19:dm-chat-id@unq.gbl.spaces" }] }), {
status: 200,
headers: { "content-type": "application/json" },
@ -141,8 +141,7 @@ describe("resolveGraphChatId", () => {
}),
);
// Should filter by user AAD object ID
const firstCall = fetchFn.mock.calls[0] as unknown[] | undefined;
const callUrl = firstCall?.[0];
const [callUrl] = fetchFn.mock.calls[0] ?? [];
expect(callUrl).toContain("user-aad-object-id-123");
expect(result).toBe("19:dm-chat-id@unq.gbl.spaces");
});