chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.

This commit is contained in:
cpojer
2026-02-01 10:03:47 +09:00
parent ad943bd8cf
commit f06dd8df06
1778 changed files with 2949 additions and 4242 deletions

View File

@@ -26,7 +26,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '22' node-version: "22"
- name: Regenerate extracted constants from openclaw - name: Regenerate extracted constants from openclaw
run: | run: |

View File

@@ -1,5 +1,8 @@
{ {
"$schema": "./node_modules/oxfmt/configuration_schema.json", "$schema": "./node_modules/oxfmt/configuration_schema.json",
"experimentalSortImports": {
"newlinesBetween": false,
},
"experimentalSortPackageJson": { "experimentalSortPackageJson": {
"sortScripts": true, "sortScripts": true,
}, },

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { bluebubblesPlugin } from "./src/channel.js"; import { bluebubblesPlugin } from "./src/channel.js";
import { handleBlueBubblesWebhookRequest } from "./src/monitor.js"; import { handleBlueBubblesWebhookRequest } from "./src/monitor.js";
import { setBlueBubblesRuntime } from "./src/runtime.js"; import { setBlueBubblesRuntime } from "./src/runtime.js";

View File

@@ -1,7 +1,6 @@
import { describe, expect, it, vi, beforeEach } from "vitest";
import { bluebubblesMessageActions } from "./actions.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { describe, expect, it, vi, beforeEach } from "vitest";
import { bluebubblesMessageActions } from "./actions.js";
vi.mock("./accounts.js", () => ({ vi.mock("./accounts.js", () => ({
resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => { resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => {

View File

@@ -10,12 +10,9 @@ import {
type ChannelMessageActionName, type ChannelMessageActionName,
type ChannelToolSend, type ChannelToolSend,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import type { BlueBubblesSendTarget } from "./types.js";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { resolveBlueBubblesMessageId } from "./monitor.js"; import { sendBlueBubblesAttachment } from "./attachments.js";
import { isMacOS26OrHigher } from "./probe.js";
import { sendBlueBubblesReaction } from "./reactions.js";
import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
import { import {
editBlueBubblesMessage, editBlueBubblesMessage,
unsendBlueBubblesMessage, unsendBlueBubblesMessage,
@@ -25,9 +22,11 @@ import {
removeBlueBubblesParticipant, removeBlueBubblesParticipant,
leaveBlueBubblesChat, leaveBlueBubblesChat,
} from "./chat.js"; } from "./chat.js";
import { sendBlueBubblesAttachment } from "./attachments.js"; import { resolveBlueBubblesMessageId } from "./monitor.js";
import { isMacOS26OrHigher } from "./probe.js";
import { sendBlueBubblesReaction } from "./reactions.js";
import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
import { normalizeBlueBubblesHandle, parseBlueBubblesTarget } from "./targets.js"; import { normalizeBlueBubblesHandle, parseBlueBubblesTarget } from "./targets.js";
import type { BlueBubblesSendTarget } from "./types.js";
const providerId = "bluebubbles"; const providerId = "bluebubbles";

View File

@@ -1,7 +1,6 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"; import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { downloadBlueBubblesAttachment, sendBlueBubblesAttachment } from "./attachments.js";
import type { BlueBubblesAttachment } from "./types.js"; import type { BlueBubblesAttachment } from "./types.js";
import { downloadBlueBubblesAttachment, sendBlueBubblesAttachment } from "./attachments.js";
vi.mock("./accounts.js", () => ({ vi.mock("./accounts.js", () => ({
resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => { resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => {

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import crypto from "node:crypto"; import crypto from "node:crypto";
import path from "node:path"; import path from "node:path";
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { resolveChatGuidForTarget } from "./send.js"; import { resolveChatGuidForTarget } from "./send.js";
import { parseBlueBubblesTarget, normalizeBlueBubblesHandle } from "./targets.js"; import { parseBlueBubblesTarget, normalizeBlueBubblesHandle } from "./targets.js";

View File

@@ -13,15 +13,18 @@ import {
resolveBlueBubblesGroupToolPolicy, resolveBlueBubblesGroupToolPolicy,
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { import {
listBlueBubblesAccountIds, listBlueBubblesAccountIds,
type ResolvedBlueBubblesAccount, type ResolvedBlueBubblesAccount,
resolveBlueBubblesAccount, resolveBlueBubblesAccount,
resolveDefaultBlueBubblesAccountId, resolveDefaultBlueBubblesAccountId,
} from "./accounts.js"; } from "./accounts.js";
import { bluebubblesMessageActions } from "./actions.js";
import { BlueBubblesConfigSchema } from "./config-schema.js"; import { BlueBubblesConfigSchema } from "./config-schema.js";
import { sendBlueBubblesMedia } from "./media-send.js";
import { resolveBlueBubblesMessageId } from "./monitor.js"; import { resolveBlueBubblesMessageId } from "./monitor.js";
import { monitorBlueBubblesProvider, resolveWebhookPathFromConfig } from "./monitor.js";
import { blueBubblesOnboardingAdapter } from "./onboarding.js";
import { probeBlueBubbles, type BlueBubblesProbe } from "./probe.js"; import { probeBlueBubbles, type BlueBubblesProbe } from "./probe.js";
import { sendMessageBlueBubbles } from "./send.js"; import { sendMessageBlueBubbles } from "./send.js";
import { import {
@@ -31,10 +34,6 @@ import {
normalizeBlueBubblesMessagingTarget, normalizeBlueBubblesMessagingTarget,
parseBlueBubblesTarget, parseBlueBubblesTarget,
} from "./targets.js"; } from "./targets.js";
import { bluebubblesMessageActions } from "./actions.js";
import { monitorBlueBubblesProvider, resolveWebhookPathFromConfig } from "./monitor.js";
import { blueBubblesOnboardingAdapter } from "./onboarding.js";
import { sendBlueBubblesMedia } from "./media-send.js";
const meta = { const meta = {
id: "bluebubbles", id: "bluebubbles",

View File

@@ -1,5 +1,4 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"; import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { markBlueBubblesChatRead, sendBlueBubblesTyping, setGroupIconBlueBubbles } from "./chat.js"; import { markBlueBubblesChatRead, sendBlueBubblesTyping, setGroupIconBlueBubbles } from "./chat.js";
vi.mock("./accounts.js", () => ({ vi.mock("./accounts.js", () => ({

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import crypto from "node:crypto"; import crypto from "node:crypto";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js"; import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js";
export type BlueBubblesChatOpts = { export type BlueBubblesChatOpts = {

View File

@@ -1,8 +1,6 @@
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { resolveChannelMediaMaxBytes, type OpenClawConfig } from "openclaw/plugin-sdk"; import { resolveChannelMediaMaxBytes, type OpenClawConfig } from "openclaw/plugin-sdk";
import { sendBlueBubblesAttachment } from "./attachments.js"; import { sendBlueBubblesAttachment } from "./attachments.js";
import { resolveBlueBubblesMessageId } from "./monitor.js"; import { resolveBlueBubblesMessageId } from "./monitor.js";
import { getBlueBubblesRuntime } from "./runtime.js"; import { getBlueBubblesRuntime } from "./runtime.js";

View File

@@ -1,9 +1,9 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import { EventEmitter } from "node:events";
import { removeAckReactionAfterReply, shouldAckReaction } from "openclaw/plugin-sdk";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk";
import { EventEmitter } from "node:events";
import { removeAckReactionAfterReply, shouldAckReaction } from "openclaw/plugin-sdk";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ResolvedBlueBubblesAccount } from "./accounts.js";
import { import {
handleBlueBubblesWebhookRequest, handleBlueBubblesWebhookRequest,
registerBlueBubblesWebhookTarget, registerBlueBubblesWebhookTarget,
@@ -11,7 +11,6 @@ import {
_resetBlueBubblesShortIdState, _resetBlueBubblesShortIdState,
} from "./monitor.js"; } from "./monitor.js";
import { setBlueBubblesRuntime } from "./runtime.js"; import { setBlueBubblesRuntime } from "./runtime.js";
import type { ResolvedBlueBubblesAccount } from "./accounts.js";
// Mock dependencies // Mock dependencies
vi.mock("./send.js", () => ({ vi.mock("./send.js", () => ({

View File

@@ -1,5 +1,4 @@
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { import {
logAckFailure, logAckFailure,
@@ -8,20 +7,20 @@ import {
resolveAckReaction, resolveAckReaction,
resolveControlCommandGate, resolveControlCommandGate,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js";
import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js"; import type { BlueBubblesAccountConfig, BlueBubblesAttachment } from "./types.js";
import { downloadBlueBubblesAttachment } from "./attachments.js"; import { downloadBlueBubblesAttachment } from "./attachments.js";
import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js";
import { sendBlueBubblesMedia } from "./media-send.js";
import { fetchBlueBubblesServerInfo } from "./probe.js";
import { normalizeBlueBubblesReactionInput, sendBlueBubblesReaction } from "./reactions.js";
import { getBlueBubblesRuntime } from "./runtime.js";
import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
import { import {
formatBlueBubblesChatTarget, formatBlueBubblesChatTarget,
isAllowedBlueBubblesSender, isAllowedBlueBubblesSender,
normalizeBlueBubblesHandle, normalizeBlueBubblesHandle,
} from "./targets.js"; } from "./targets.js";
import { sendBlueBubblesMedia } from "./media-send.js";
import type { BlueBubblesAccountConfig, BlueBubblesAttachment } from "./types.js";
import type { ResolvedBlueBubblesAccount } from "./accounts.js";
import { getBlueBubblesRuntime } from "./runtime.js";
import { normalizeBlueBubblesReactionInput, sendBlueBubblesReaction } from "./reactions.js";
import { fetchBlueBubblesServerInfo } from "./probe.js";
export type BlueBubblesRuntimeEnv = { export type BlueBubblesRuntimeEnv = {
log?: (message: string) => void; log?: (message: string) => void;

View File

@@ -17,8 +17,8 @@ import {
resolveBlueBubblesAccount, resolveBlueBubblesAccount,
resolveDefaultBlueBubblesAccountId, resolveDefaultBlueBubblesAccountId,
} from "./accounts.js"; } from "./accounts.js";
import { normalizeBlueBubblesServerUrl } from "./types.js";
import { parseBlueBubblesAllowTarget } from "./targets.js"; import { parseBlueBubblesAllowTarget } from "./targets.js";
import { normalizeBlueBubblesServerUrl } from "./types.js";
const channel = "bluebubbles" as const; const channel = "bluebubbles" as const;

View File

@@ -1,5 +1,4 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"; import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { sendBlueBubblesReaction } from "./reactions.js"; import { sendBlueBubblesReaction } from "./reactions.js";
vi.mock("./accounts.js", () => ({ vi.mock("./accounts.js", () => ({

View File

@@ -1,5 +1,5 @@
import { resolveBlueBubblesAccount } from "./accounts.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { resolveBlueBubblesAccount } from "./accounts.js";
import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js"; import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js";
export type BlueBubblesReactionOpts = { export type BlueBubblesReactionOpts = {

View File

@@ -1,7 +1,6 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"; import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { sendMessageBlueBubbles, resolveChatGuidForTarget } from "./send.js";
import type { BlueBubblesSendTarget } from "./types.js"; import type { BlueBubblesSendTarget } from "./types.js";
import { sendMessageBlueBubbles, resolveChatGuidForTarget } from "./send.js";
vi.mock("./accounts.js", () => ({ vi.mock("./accounts.js", () => ({
resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => { resolveBlueBubblesAccount: vi.fn(({ cfg, accountId }) => {

View File

@@ -1,12 +1,11 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import crypto from "node:crypto"; import crypto from "node:crypto";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { import {
extractHandleFromChatGuid, extractHandleFromChatGuid,
normalizeBlueBubblesHandle, normalizeBlueBubblesHandle,
parseBlueBubblesTarget, parseBlueBubblesTarget,
} from "./targets.js"; } from "./targets.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { import {
blueBubblesFetchWithTimeout, blueBubblesFetchWithTimeout,
buildBlueBubblesApiUrl, buildBlueBubblesApiUrl,

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {
looksLikeBlueBubblesTargetId, looksLikeBlueBubblesTargetId,
normalizeBlueBubblesMessagingTarget, normalizeBlueBubblesMessagingTarget,

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { createDiagnosticsOtelService } from "./src/service.js"; import { createDiagnosticsOtelService } from "./src/service.js";
const plugin = { const plugin = {

View File

@@ -103,8 +103,8 @@ vi.mock("openclaw/plugin-sdk", async () => {
}; };
}); });
import { createDiagnosticsOtelService } from "./service.js";
import { emitDiagnosticEvent } from "openclaw/plugin-sdk"; import { emitDiagnosticEvent } from "openclaw/plugin-sdk";
import { createDiagnosticsOtelService } from "./service.js";
describe("diagnostics-otel service", () => { describe("diagnostics-otel service", () => {
beforeEach(() => { beforeEach(() => {

View File

@@ -1,5 +1,6 @@
import { metrics, trace, SpanStatusCode } from "@opentelemetry/api";
import type { SeverityNumber } from "@opentelemetry/api-logs"; import type { SeverityNumber } from "@opentelemetry/api-logs";
import type { DiagnosticEventPayload, OpenClawPluginService } from "openclaw/plugin-sdk";
import { metrics, trace, SpanStatusCode } from "@opentelemetry/api";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http"; import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http"; import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
@@ -9,8 +10,6 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
import { NodeSDK } from "@opentelemetry/sdk-node"; import { NodeSDK } from "@opentelemetry/sdk-node";
import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base"; import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions"; import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
import type { DiagnosticEventPayload, OpenClawPluginService } from "openclaw/plugin-sdk";
import { onDiagnosticEvent, registerLogTransport } from "openclaw/plugin-sdk"; import { onDiagnosticEvent, registerLogTransport } from "openclaw/plugin-sdk";
const DEFAULT_SERVICE_NAME = "openclaw"; const DEFAULT_SERVICE_NAME = "openclaw";

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { discordPlugin } from "./src/channel.js"; import { discordPlugin } from "./src/channel.js";
import { setDiscordRuntime } from "./src/runtime.js"; import { setDiscordRuntime } from "./src/runtime.js";

View File

@@ -26,7 +26,6 @@ import {
type ChannelPlugin, type ChannelPlugin,
type ResolvedDiscordAccount, type ResolvedDiscordAccount,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { getDiscordRuntime } from "./runtime.js"; import { getDiscordRuntime } from "./runtime.js";
const meta = getChatChannelMeta("discord"); const meta = getChatChannelMeta("discord");

View File

@@ -1,5 +1,4 @@
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { loginGeminiCliOAuth } from "./oauth.js"; import { loginGeminiCliOAuth } from "./oauth.js";
const PROVIDER_ID = "google-gemini-cli"; const PROVIDER_ID = "google-gemini-cli";

View File

@@ -1,5 +1,5 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { join, parse } from "node:path"; import { join, parse } from "node:path";
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
// Mock fs module before importing the module under test // Mock fs module before importing the module under test
const mockExistsSync = vi.fn(); const mockExistsSync = vi.fn();

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { googlechatDock, googlechatPlugin } from "./src/channel.js"; import { googlechatDock, googlechatPlugin } from "./src/channel.js";
import { handleGoogleChatWebhookRequest } from "./src/monitor.js"; import { handleGoogleChatWebhookRequest } from "./src/monitor.js";
import { setGoogleChatRuntime } from "./src/runtime.js"; import { setGoogleChatRuntime } from "./src/runtime.js";

View File

@@ -1,6 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
import type { GoogleChatAccountConfig } from "./types.config.js"; import type { GoogleChatAccountConfig } from "./types.config.js";
export type GoogleChatCredentialSource = "file" | "inline" | "env" | "none"; export type GoogleChatCredentialSource = "file" | "inline" | "env" | "none";

View File

@@ -10,7 +10,6 @@ import {
readReactionParams, readReactionParams,
readStringParam, readStringParam,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { listEnabledGoogleChatAccounts, resolveGoogleChatAccount } from "./accounts.js"; import { listEnabledGoogleChatAccounts, resolveGoogleChatAccount } from "./accounts.js";
import { import {
createGoogleChatReaction, createGoogleChatReaction,

View File

@@ -1,5 +1,4 @@
import { afterEach, describe, expect, it, vi } from "vitest"; import { afterEach, describe, expect, it, vi } from "vitest";
import type { ResolvedGoogleChatAccount } from "./accounts.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js";
import { downloadGoogleChatMedia } from "./api.js"; import { downloadGoogleChatMedia } from "./api.js";

View File

@@ -1,8 +1,7 @@
import crypto from "node:crypto"; import crypto from "node:crypto";
import type { ResolvedGoogleChatAccount } from "./accounts.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js";
import { getGoogleChatAccessToken } from "./auth.js";
import type { GoogleChatReaction } from "./types.js"; import type { GoogleChatReaction } from "./types.js";
import { getGoogleChatAccessToken } from "./auth.js";
const CHAT_API_BASE = "https://chat.googleapis.com/v1"; const CHAT_API_BASE = "https://chat.googleapis.com/v1";
const CHAT_UPLOAD_BASE = "https://chat.googleapis.com/upload/v1"; const CHAT_UPLOAD_BASE = "https://chat.googleapis.com/upload/v1";

View File

@@ -1,5 +1,4 @@
import { GoogleAuth, OAuth2Client } from "google-auth-library"; import { GoogleAuth, OAuth2Client } from "google-auth-library";
import type { ResolvedGoogleChatAccount } from "./accounts.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js";
const CHAT_SCOPE = "https://www.googleapis.com/auth/chat.bot"; const CHAT_SCOPE = "https://www.googleapis.com/auth/chat.bot";

View File

@@ -18,7 +18,6 @@ import {
type OpenClawConfig, type OpenClawConfig,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { GoogleChatConfigSchema } from "openclaw/plugin-sdk"; import { GoogleChatConfigSchema } from "openclaw/plugin-sdk";
import { import {
listGoogleChatAccountIds, listGoogleChatAccountIds,
resolveDefaultGoogleChatAccountId, resolveDefaultGoogleChatAccountId,
@@ -27,9 +26,9 @@ import {
} from "./accounts.js"; } from "./accounts.js";
import { googlechatMessageActions } from "./actions.js"; import { googlechatMessageActions } from "./actions.js";
import { sendGoogleChatMessage, uploadGoogleChatAttachment, probeGoogleChat } from "./api.js"; import { sendGoogleChatMessage, uploadGoogleChatAttachment, probeGoogleChat } from "./api.js";
import { resolveGoogleChatWebhookPath, startGoogleChatMonitor } from "./monitor.js";
import { googlechatOnboardingAdapter } from "./onboarding.js"; import { googlechatOnboardingAdapter } from "./onboarding.js";
import { getGoogleChatRuntime } from "./runtime.js"; import { getGoogleChatRuntime } from "./runtime.js";
import { resolveGoogleChatWebhookPath, startGoogleChatMonitor } from "./monitor.js";
import { import {
isGoogleChatSpaceTarget, isGoogleChatSpaceTarget,
isGoogleChatUserTarget, isGoogleChatUserTarget,

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { isSenderAllowed } from "./monitor.js"; import { isSenderAllowed } from "./monitor.js";
describe("isSenderAllowed", () => { describe("isSenderAllowed", () => {

View File

@@ -1,8 +1,14 @@
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk"; import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk";
import type {
GoogleChatAnnotation,
GoogleChatAttachment,
GoogleChatEvent,
GoogleChatSpace,
GoogleChatMessage,
GoogleChatUser,
} from "./types.js";
import { type ResolvedGoogleChatAccount } from "./accounts.js"; import { type ResolvedGoogleChatAccount } from "./accounts.js";
import { import {
downloadGoogleChatMedia, downloadGoogleChatMedia,
@@ -12,14 +18,6 @@ import {
} from "./api.js"; } from "./api.js";
import { verifyGoogleChatRequest, type GoogleChatAudienceType } from "./auth.js"; import { verifyGoogleChatRequest, type GoogleChatAudienceType } from "./auth.js";
import { getGoogleChatRuntime } from "./runtime.js"; import { getGoogleChatRuntime } from "./runtime.js";
import type {
GoogleChatAnnotation,
GoogleChatAttachment,
GoogleChatEvent,
GoogleChatSpace,
GoogleChatMessage,
GoogleChatUser,
} from "./types.js";
export type GoogleChatRuntimeEnv = { export type GoogleChatRuntimeEnv = {
log?: (message: string) => void; log?: (message: string) => void;

View File

@@ -10,7 +10,6 @@ import {
normalizeAccountId, normalizeAccountId,
migrateBaseNameToDefaultAccount, migrateBaseNameToDefaultAccount,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { import {
listGoogleChatAccountIds, listGoogleChatAccountIds,
resolveDefaultGoogleChatAccountId, resolveDefaultGoogleChatAccountId,

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {
isGoogleChatSpaceTarget, isGoogleChatSpaceTarget,
isGoogleChatUserTarget, isGoogleChatUserTarget,

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { imessagePlugin } from "./src/channel.js"; import { imessagePlugin } from "./src/channel.js";
import { setIMessageRuntime } from "./src/runtime.js"; import { setIMessageRuntime } from "./src/runtime.js";

View File

@@ -22,7 +22,6 @@ import {
type ChannelPlugin, type ChannelPlugin,
type ResolvedIMessageAccount, type ResolvedIMessageAccount,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { getIMessageRuntime } from "./runtime.js"; import { getIMessageRuntime } from "./runtime.js";
const meta = getChatChannelMeta("imessage"); const meta = getChatChannelMeta("imessage");

View File

@@ -1,8 +1,7 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { linePlugin } from "./src/channel.js";
import { registerLineCardCommand } from "./src/card-command.js"; import { registerLineCardCommand } from "./src/card-command.js";
import { linePlugin } from "./src/channel.js";
import { setLineRuntime } from "./src/runtime.js"; import { setLineRuntime } from "./src/runtime.js";
const plugin = { const plugin = {

View File

@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { linePlugin } from "./channel.js"; import { linePlugin } from "./channel.js";
import { setLineRuntime } from "./runtime.js"; import { setLineRuntime } from "./runtime.js";

View File

@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk";
import { describe, expect, it, vi } from "vitest";
import { linePlugin } from "./channel.js"; import { linePlugin } from "./channel.js";
import { setLineRuntime } from "./runtime.js"; import { setLineRuntime } from "./runtime.js";

View File

@@ -10,7 +10,6 @@ import {
type LineChannelData, type LineChannelData,
type ResolvedLineAccount, type ResolvedLineAccount,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { getLineRuntime } from "./runtime.js"; import { getLineRuntime } from "./runtime.js";
// LINE channel metadata // LINE channel metadata

View File

@@ -1,5 +1,4 @@
import type { OpenClawPluginApi } from "../../src/plugins/types.js"; import type { OpenClawPluginApi } from "../../src/plugins/types.js";
import { createLlmTaskTool } from "./src/llm-task-tool.js"; import { createLlmTaskTool } from "./src/llm-task-tool.js";
export default function register(api: OpenClawPluginApi) { export default function register(api: OpenClawPluginApi) {

View File

@@ -1,15 +1,12 @@
import { Type } from "@sinclair/typebox";
import Ajv from "ajv";
import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import fs from "node:fs/promises";
import Ajv from "ajv";
import { Type } from "@sinclair/typebox";
// NOTE: This extension is intended to be bundled with OpenClaw. // NOTE: This extension is intended to be bundled with OpenClaw.
// When running from source (tests/dev), OpenClaw internals live under src/. // When running from source (tests/dev), OpenClaw internals live under src/.
// When running from a built install, internals live under dist/ (no src/ tree). // When running from a built install, internals live under dist/ (no src/ tree).
// So we resolve internal imports dynamically with src-first, dist-fallback. // So we resolve internal imports dynamically with src-first, dist-fallback.
import type { OpenClawPluginApi } from "../../../src/plugins/types.js"; import type { OpenClawPluginApi } from "../../../src/plugins/types.js";
type RunEmbeddedPiAgentFn = (params: Record<string, unknown>) => Promise<unknown>; type RunEmbeddedPiAgentFn = (params: Record<string, unknown>) => Promise<unknown>;

View File

@@ -1,5 +1,4 @@
import type { OpenClawPluginApi } from "../../src/plugins/types.js"; import type { OpenClawPluginApi } from "../../src/plugins/types.js";
import { createLobsterTool } from "./src/lobster-tool.js"; import { createLobsterTool } from "./src/lobster-tool.js";
export default function register(api: OpenClawPluginApi) { export default function register(api: OpenClawPluginApi) {

View File

@@ -1,9 +1,7 @@
import fs from "node:fs/promises"; import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { OpenClawPluginApi, OpenClawPluginToolContext } from "../../../src/plugins/types.js"; import type { OpenClawPluginApi, OpenClawPluginToolContext } from "../../../src/plugins/types.js";
import { createLobsterTool } from "./lobster-tool.js"; import { createLobsterTool } from "./lobster-tool.js";

View File

@@ -2,7 +2,6 @@ import { Type } from "@sinclair/typebox";
import { spawn } from "node:child_process"; import { spawn } from "node:child_process";
import fs from "node:fs"; import fs from "node:fs";
import path from "node:path"; import path from "node:path";
import type { OpenClawPluginApi } from "../../../src/plugins/types.js"; import type { OpenClawPluginApi } from "../../../src/plugins/types.js";
type LobsterEnvelope = type LobsterEnvelope =

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { matrixPlugin } from "./src/channel.js"; import { matrixPlugin } from "./src/channel.js";
import { setMatrixRuntime } from "./src/runtime.js"; import { setMatrixRuntime } from "./src/runtime.js";

View File

@@ -7,9 +7,9 @@ import {
type ChannelMessageActionName, type ChannelMessageActionName,
type ChannelToolSend, type ChannelToolSend,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import type { CoreConfig } from "./types.js";
import { resolveMatrixAccount } from "./matrix/accounts.js"; import { resolveMatrixAccount } from "./matrix/accounts.js";
import { handleMatrixAction } from "./tool-actions.js"; import { handleMatrixAction } from "./tool-actions.js";
import type { CoreConfig } from "./types.js";
export const matrixMessageActions: ChannelMessageActionAdapter = { export const matrixMessageActions: ChannelMessageActionAdapter = {
listActions: ({ cfg }) => { listActions: ({ cfg }) => {

View File

@@ -1,8 +1,6 @@
import { beforeEach, describe, expect, it } from "vitest";
import type { PluginRuntime } from "openclaw/plugin-sdk"; import type { PluginRuntime } from "openclaw/plugin-sdk";
import { beforeEach, describe, expect, it } from "vitest";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";
import { matrixPlugin } from "./channel.js"; import { matrixPlugin } from "./channel.js";
import { setMatrixRuntime } from "./runtime.js"; import { setMatrixRuntime } from "./runtime.js";

View File

@@ -9,14 +9,14 @@ import {
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
type ChannelPlugin, type ChannelPlugin,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import type { CoreConfig } from "./types.js";
import { matrixMessageActions } from "./actions.js"; import { matrixMessageActions } from "./actions.js";
import { MatrixConfigSchema } from "./config-schema.js"; import { MatrixConfigSchema } from "./config-schema.js";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
import { import {
resolveMatrixGroupRequireMention, resolveMatrixGroupRequireMention,
resolveMatrixGroupToolPolicy, resolveMatrixGroupToolPolicy,
} from "./group-mentions.js"; } from "./group-mentions.js";
import type { CoreConfig } from "./types.js";
import { import {
listMatrixAccountIds, listMatrixAccountIds,
resolveDefaultMatrixAccountId, resolveDefaultMatrixAccountId,
@@ -30,7 +30,6 @@ import { sendMessageMatrix } from "./matrix/send.js";
import { matrixOnboardingAdapter } from "./onboarding.js"; import { matrixOnboardingAdapter } from "./onboarding.js";
import { matrixOutbound } from "./outbound.js"; import { matrixOutbound } from "./outbound.js";
import { resolveMatrixTargets } from "./resolve-targets.js"; import { resolveMatrixTargets } from "./resolve-targets.js";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
const meta = { const meta = {
id: "matrix", id: "matrix",

View File

@@ -1,5 +1,4 @@
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk"; import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk";
import { resolveMatrixAuth } from "./matrix/client.js"; import { resolveMatrixAuth } from "./matrix/client.js";
type MatrixUserResult = { type MatrixUserResult = {

View File

@@ -1,7 +1,6 @@
import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk"; import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk";
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean { export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean {
const rawGroupId = params.groupId?.trim() ?? ""; const rawGroupId = params.groupId?.trim() ?? "";

View File

@@ -1,5 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import { resolveMatrixAccount } from "./accounts.js"; import { resolveMatrixAccount } from "./accounts.js";

View File

@@ -1,5 +1,6 @@
import { getMatrixRuntime } from "../../runtime.js";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import type { MatrixActionClient, MatrixActionClientOpts } from "./types.js";
import { getMatrixRuntime } from "../../runtime.js";
import { getActiveMatrixClient } from "../active-client.js"; import { getActiveMatrixClient } from "../active-client.js";
import { import {
createMatrixClient, createMatrixClient,
@@ -7,7 +8,6 @@ import {
resolveMatrixAuth, resolveMatrixAuth,
resolveSharedMatrixClient, resolveSharedMatrixClient,
} from "../client.js"; } from "../client.js";
import type { MatrixActionClient, MatrixActionClientOpts } from "./types.js";
export function ensureNodeRuntime() { export function ensureNodeRuntime() {
if (isBunRuntime()) { if (isBunRuntime()) {

View File

@@ -1,3 +1,6 @@
import { resolveMatrixRoomId, sendMessageMatrix } from "../send.js";
import { resolveActionClient } from "./client.js";
import { summarizeMatrixRawEvent } from "./summary.js";
import { import {
EventType, EventType,
MsgType, MsgType,
@@ -7,9 +10,6 @@ import {
type MatrixRawEvent, type MatrixRawEvent,
type RoomMessageEventContent, type RoomMessageEventContent,
} from "./types.js"; } from "./types.js";
import { resolveActionClient } from "./client.js";
import { summarizeMatrixRawEvent } from "./summary.js";
import { resolveMatrixRoomId, sendMessageMatrix } from "../send.js";
export async function sendMatrixMessage( export async function sendMatrixMessage(
to: string, to: string,

View File

@@ -1,12 +1,12 @@
import { resolveMatrixRoomId } from "../send.js";
import { resolveActionClient } from "./client.js";
import { fetchEventSummary, readPinnedEvents } from "./summary.js";
import { import {
EventType, EventType,
type MatrixActionClientOpts, type MatrixActionClientOpts,
type MatrixMessageSummary, type MatrixMessageSummary,
type RoomPinnedEventsEventContent, type RoomPinnedEventsEventContent,
} from "./types.js"; } from "./types.js";
import { resolveActionClient } from "./client.js";
import { fetchEventSummary, readPinnedEvents } from "./summary.js";
import { resolveMatrixRoomId } from "../send.js";
export async function pinMatrixMessage( export async function pinMatrixMessage(
roomId: string, roomId: string,

View File

@@ -1,3 +1,5 @@
import { resolveMatrixRoomId } from "../send.js";
import { resolveActionClient } from "./client.js";
import { import {
EventType, EventType,
RelationType, RelationType,
@@ -6,8 +8,6 @@ import {
type MatrixReactionSummary, type MatrixReactionSummary,
type ReactionEventContent, type ReactionEventContent,
} from "./types.js"; } from "./types.js";
import { resolveActionClient } from "./client.js";
import { resolveMatrixRoomId } from "../send.js";
export async function listMatrixReactions( export async function listMatrixReactions(
roomId: string, roomId: string,

View File

@@ -1,6 +1,6 @@
import { EventType, type MatrixActionClientOpts } from "./types.js";
import { resolveActionClient } from "./client.js";
import { resolveMatrixRoomId } from "../send.js"; import { resolveMatrixRoomId } from "../send.js";
import { resolveActionClient } from "./client.js";
import { EventType, type MatrixActionClientOpts } from "./types.js";
export async function getMatrixMemberInfo( export async function getMatrixMemberInfo(
userId: string, userId: string,

View File

@@ -1,5 +1,4 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { import {
EventType, EventType,
type MatrixMessageSummary, type MatrixMessageSummary,

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import { resolveMatrixConfig } from "./client.js"; import { resolveMatrixConfig } from "./client.js";

View File

@@ -1,9 +1,8 @@
import { MatrixClient } from "@vector-im/matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import type { MatrixAuth, MatrixResolvedConfig } from "./types.js";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { ensureMatrixSdkLoggingConfigured } from "./logging.js"; import { ensureMatrixSdkLoggingConfigured } from "./logging.js";
import type { MatrixAuth, MatrixResolvedConfig } from "./types.js";
function clean(value?: string): string { function clean(value?: string): string {
return value?.trim() ?? ""; return value?.trim() ?? "";

View File

@@ -1,13 +1,11 @@
import fs from "node:fs"; import type { IStorageProvider, ICryptoStorageProvider } from "@vector-im/matrix-bot-sdk";
import { import {
LogService, LogService,
MatrixClient, MatrixClient,
SimpleFsStorageProvider, SimpleFsStorageProvider,
RustSdkCryptoStorageProvider, RustSdkCryptoStorageProvider,
} from "@vector-im/matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import type { IStorageProvider, ICryptoStorageProvider } from "@vector-im/matrix-bot-sdk"; import fs from "node:fs";
import { ensureMatrixSdkLoggingConfigured } from "./logging.js"; import { ensureMatrixSdkLoggingConfigured } from "./logging.js";
import { import {
maybeMigrateLegacyStorage, maybeMigrateLegacyStorage,

View File

@@ -1,11 +1,10 @@
import { LogService } from "@vector-im/matrix-bot-sdk";
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { LogService } from "@vector-im/matrix-bot-sdk";
import type { CoreConfig } from "../types.js"; import type { CoreConfig } from "../types.js";
import { createMatrixClient } from "./create-client.js";
import { resolveMatrixAuth } from "./config.js";
import { DEFAULT_ACCOUNT_KEY } from "./storage.js";
import type { MatrixAuth } from "./types.js"; import type { MatrixAuth } from "./types.js";
import { resolveMatrixAuth } from "./config.js";
import { createMatrixClient } from "./create-client.js";
import { DEFAULT_ACCOUNT_KEY } from "./storage.js";
type SharedMatrixClientState = { type SharedMatrixClientState = {
client: MatrixClient; client: MatrixClient;

View File

@@ -2,9 +2,8 @@ import crypto from "node:crypto";
import fs from "node:fs"; import fs from "node:fs";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { getMatrixRuntime } from "../../runtime.js";
import type { MatrixStoragePaths } from "./types.js"; import type { MatrixStoragePaths } from "./types.js";
import { getMatrixRuntime } from "../../runtime.js";
export const DEFAULT_ACCOUNT_KEY = "default"; export const DEFAULT_ACCOUNT_KEY = "default";
const STORAGE_META_FILENAME = "storage-meta.json"; const STORAGE_META_FILENAME = "storage-meta.json";

View File

@@ -1,7 +1,6 @@
import fs from "node:fs"; import fs from "node:fs";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { getMatrixRuntime } from "../runtime.js"; import { getMatrixRuntime } from "../runtime.js";
export type MatrixStoredCredentials = { export type MatrixStoredCredentials = {

View File

@@ -1,9 +1,8 @@
import fs from "node:fs";
import path from "node:path";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import type { RuntimeEnv } from "openclaw/plugin-sdk"; import type { RuntimeEnv } from "openclaw/plugin-sdk";
import fs from "node:fs";
import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { getMatrixRuntime } from "../runtime.js"; import { getMatrixRuntime } from "../runtime.js";
const MATRIX_SDK_PACKAGE = "@vector-im/matrix-bot-sdk"; const MATRIX_SDK_PACKAGE = "@vector-im/matrix-bot-sdk";

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { markdownToMatrixHtml } from "./format.js"; import { markdownToMatrixHtml } from "./format.js";
describe("markdownToMatrixHtml", () => { describe("markdownToMatrixHtml", () => {

View File

@@ -1,7 +1,6 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { AutojoinRoomsMixin } from "@vector-im/matrix-bot-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk"; import type { RuntimeEnv } from "openclaw/plugin-sdk";
import { AutojoinRoomsMixin } from "@vector-im/matrix-bot-sdk";
import type { CoreConfig } from "../../types.js"; import type { CoreConfig } from "../../types.js";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";

View File

@@ -1,6 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk"; import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { MatrixAuth } from "../client.js"; import type { MatrixAuth } from "../client.js";
import type { MatrixRawEvent } from "./types.js"; import type { MatrixRawEvent } from "./types.js";
import { EventType } from "./types.js"; import { EventType } from "./types.js";

View File

@@ -1,5 +1,4 @@
import type { LocationMessageEventContent, MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { LocationMessageEventContent, MatrixClient } from "@vector-im/matrix-bot-sdk";
import { import {
createReplyPrefixContext, createReplyPrefixContext,
createTypingCallbacks, createTypingCallbacks,
@@ -10,6 +9,7 @@ import {
type RuntimeEnv, type RuntimeEnv,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import type { CoreConfig, ReplyToMode } from "../../types.js"; import type { CoreConfig, ReplyToMode } from "../../types.js";
import type { MatrixRawEvent, RoomMessageEventContent } from "./types.js";
import { import {
formatPollAsText, formatPollAsText,
isPollStartType, isPollStartType,
@@ -27,13 +27,12 @@ import {
resolveMatrixAllowListMatches, resolveMatrixAllowListMatches,
normalizeAllowListLower, normalizeAllowListLower,
} from "./allowlist.js"; } from "./allowlist.js";
import { resolveMatrixLocation, type MatrixLocationPayload } from "./location.js";
import { downloadMatrixMedia } from "./media.js"; import { downloadMatrixMedia } from "./media.js";
import { resolveMentions } from "./mentions.js"; import { resolveMentions } from "./mentions.js";
import { deliverMatrixReplies } from "./replies.js"; import { deliverMatrixReplies } from "./replies.js";
import { resolveMatrixRoomConfig } from "./rooms.js"; import { resolveMatrixRoomConfig } from "./rooms.js";
import { resolveMatrixThreadRootId, resolveMatrixThreadTarget } from "./threads.js"; import { resolveMatrixThreadRootId, resolveMatrixThreadTarget } from "./threads.js";
import { resolveMatrixLocation, type MatrixLocationPayload } from "./location.js";
import type { MatrixRawEvent, RoomMessageEventContent } from "./types.js";
import { EventType, RelationType } from "./types.js"; import { EventType, RelationType } from "./types.js";
export type MatrixMonitorHandlerParams = { export type MatrixMonitorHandlerParams = {

View File

@@ -1,7 +1,8 @@
import { format } from "node:util"; import { format } from "node:util";
import { mergeAllowlist, summarizeMapping, type RuntimeEnv } from "openclaw/plugin-sdk"; import { mergeAllowlist, summarizeMapping, type RuntimeEnv } from "openclaw/plugin-sdk";
import type { CoreConfig, ReplyToMode } from "../../types.js"; import type { CoreConfig, ReplyToMode } from "../../types.js";
import { resolveMatrixTargets } from "../../resolve-targets.js";
import { getMatrixRuntime } from "../../runtime.js";
import { setActiveMatrixClient } from "../active-client.js"; import { setActiveMatrixClient } from "../active-client.js";
import { import {
isBunRuntime, isBunRuntime,
@@ -14,8 +15,6 @@ import { createDirectRoomTracker } from "./direct.js";
import { registerMatrixMonitorEvents } from "./events.js"; import { registerMatrixMonitorEvents } from "./events.js";
import { createMatrixRoomMessageHandler } from "./handler.js"; import { createMatrixRoomMessageHandler } from "./handler.js";
import { createMatrixRoomInfoResolver } from "./room-info.js"; import { createMatrixRoomInfoResolver } from "./room-info.js";
import { resolveMatrixTargets } from "../../resolve-targets.js";
import { getMatrixRuntime } from "../../runtime.js";
export type MonitorMatrixOpts = { export type MonitorMatrixOpts = {
runtime?: RuntimeEnv; runtime?: RuntimeEnv;

View File

@@ -1,5 +1,4 @@
import type { LocationMessageEventContent } from "@vector-im/matrix-bot-sdk"; import type { LocationMessageEventContent } from "@vector-im/matrix-bot-sdk";
import { import {
formatLocationText, formatLocationText,
toLocationContext, toLocationContext,

View File

@@ -1,6 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { PluginRuntime } from "openclaw/plugin-sdk"; import type { PluginRuntime } from "openclaw/plugin-sdk";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { setMatrixRuntime } from "../../runtime.js"; import { setMatrixRuntime } from "../../runtime.js";
import { downloadMatrixMedia } from "./media.js"; import { downloadMatrixMedia } from "./media.js";

View File

@@ -1,5 +1,4 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
// Type for encrypted file info // Type for encrypted file info

View File

@@ -1,8 +1,7 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk"; import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk";
import { sendMessageMatrix } from "../send.js";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { sendMessageMatrix } from "../send.js";
export async function deliverMatrixReplies(params: { export async function deliverMatrixReplies(params: {
replies: ReplyPayload[]; replies: ReplyPayload[];

View File

@@ -1,5 +1,5 @@
import type { MatrixRoomConfig } from "../../types.js";
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "openclaw/plugin-sdk"; import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "openclaw/plugin-sdk";
import type { MatrixRoomConfig } from "../../types.js";
export type MatrixRoomConfigResolved = { export type MatrixRoomConfigResolved = {
allowed: boolean; allowed: boolean;

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { parsePollStartContent } from "./poll-types.js"; import { parsePollStartContent } from "./poll-types.js";
describe("parsePollStartContent", () => { describe("parsePollStartContent", () => {

View File

@@ -1,6 +1,5 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { PluginRuntime } from "openclaw/plugin-sdk"; import type { PluginRuntime } from "openclaw/plugin-sdk";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { setMatrixRuntime } from "../runtime.js"; import { setMatrixRuntime } from "../runtime.js";
vi.mock("@vector-im/matrix-bot-sdk", () => ({ vi.mock("@vector-im/matrix-bot-sdk", () => ({

View File

@@ -1,5 +1,4 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PollInput } from "openclaw/plugin-sdk"; import type { PollInput } from "openclaw/plugin-sdk";
import { getMatrixRuntime } from "../runtime.js"; import { getMatrixRuntime } from "../runtime.js";
import { buildPollStartContent, M_POLL_START } from "./poll-types.js"; import { buildPollStartContent, M_POLL_START } from "./poll-types.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { CoreConfig } from "../types.js";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { getActiveMatrixClient } from "../active-client.js"; import { getActiveMatrixClient } from "../active-client.js";
import { import {
@@ -8,7 +8,6 @@ import {
resolveMatrixAuth, resolveMatrixAuth,
resolveSharedMatrixClient, resolveSharedMatrixClient,
} from "../client.js"; } from "../client.js";
import type { CoreConfig } from "../types.js";
const getCore = () => getMatrixRuntime(); const getCore = () => getMatrixRuntime();

View File

@@ -1,5 +1,5 @@
import { markdownToMatrixHtml } from "../format.js";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { markdownToMatrixHtml } from "../format.js";
import { import {
MsgType, MsgType,
RelationType, RelationType,

View File

@@ -7,8 +7,8 @@ import type {
VideoFileInfo, VideoFileInfo,
} from "@vector-im/matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import { parseBuffer, type IFileInfo } from "music-metadata"; import { parseBuffer, type IFileInfo } from "music-metadata";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { applyMatrixFormatting } from "./formatting.js";
import { import {
type MatrixMediaContent, type MatrixMediaContent,
type MatrixMediaInfo, type MatrixMediaInfo,
@@ -16,7 +16,6 @@ import {
type MatrixRelation, type MatrixRelation,
type MediaKind, type MediaKind,
} from "./types.js"; } from "./types.js";
import { applyMatrixFormatting } from "./formatting.js";
const getCore = () => getMatrixRuntime(); const getCore = () => getMatrixRuntime();

View File

@@ -1,6 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { EventType } from "./types.js"; import { EventType } from "./types.js";
let resolveMatrixRoomId: typeof import("./targets.js").resolveMatrixRoomId; let resolveMatrixRoomId: typeof import("./targets.js").resolveMatrixRoomId;

View File

@@ -1,5 +1,4 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { EventType, type MatrixDirectAccountData } from "./types.js"; import { EventType, type MatrixDirectAccountData } from "./types.js";
function normalizeTarget(raw: string): string { function normalizeTarget(raw: string): string {

View File

@@ -6,11 +6,11 @@ import {
type ChannelOnboardingDmPolicy, type ChannelOnboardingDmPolicy,
type WizardPrompter, type WizardPrompter,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import type { CoreConfig, DmPolicy } from "./types.js";
import { listMatrixDirectoryGroupsLive } from "./directory-live.js"; import { listMatrixDirectoryGroupsLive } from "./directory-live.js";
import { listMatrixDirectoryPeersLive } from "./directory-live.js"; import { listMatrixDirectoryPeersLive } from "./directory-live.js";
import { resolveMatrixAccount } from "./matrix/accounts.js"; import { resolveMatrixAccount } from "./matrix/accounts.js";
import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js"; import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js";
import type { CoreConfig, DmPolicy } from "./types.js";
const channel = "matrix" as const; const channel = "matrix" as const;

View File

@@ -1,7 +1,6 @@
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk"; import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk";
import { getMatrixRuntime } from "./runtime.js";
import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js"; import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js";
import { getMatrixRuntime } from "./runtime.js";
export const matrixOutbound: ChannelOutboundAdapter = { export const matrixOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct", deliveryMode: "direct",

View File

@@ -4,7 +4,6 @@ import type {
ChannelResolveResult, ChannelResolveResult,
RuntimeEnv, RuntimeEnv,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js"; import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
function pickBestGroupMatch( function pickBestGroupMatch(

View File

@@ -1,5 +1,11 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core"; import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import {
createActionGate,
jsonResult,
readNumberParam,
readReactionParams,
readStringParam,
} from "openclaw/plugin-sdk";
import type { CoreConfig } from "./types.js"; import type { CoreConfig } from "./types.js";
import { import {
deleteMatrixMessage, deleteMatrixMessage,
@@ -15,13 +21,6 @@ import {
unpinMatrixMessage, unpinMatrixMessage,
} from "./matrix/actions.js"; } from "./matrix/actions.js";
import { reactMatrixMessage } from "./matrix/send.js"; import { reactMatrixMessage } from "./matrix/send.js";
import {
createActionGate,
jsonResult,
readNumberParam,
readReactionParams,
readStringParam,
} from "openclaw/plugin-sdk";
const messageActions = new Set(["sendMessage", "editMessage", "deleteMessage", "readMessages"]); const messageActions = new Set(["sendMessage", "editMessage", "deleteMessage", "readMessages"]);
const reactionActions = new Set(["react", "reactions"]); const reactionActions = new Set(["react", "reactions"]);

View File

@@ -1,6 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { mattermostPlugin } from "./src/channel.js"; import { mattermostPlugin } from "./src/channel.js";
import { setMattermostRuntime } from "./src/runtime.js"; import { setMattermostRuntime } from "./src/runtime.js";

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { mattermostPlugin } from "./channel.js"; import { mattermostPlugin } from "./channel.js";
describe("mattermostPlugin", () => { describe("mattermostPlugin", () => {

View File

@@ -9,11 +9,8 @@ import {
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
type ChannelPlugin, type ChannelPlugin,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { MattermostConfigSchema } from "./config-schema.js"; import { MattermostConfigSchema } from "./config-schema.js";
import { resolveMattermostGroupRequireMention } from "./group-mentions.js"; import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
import { looksLikeMattermostTargetId, normalizeMattermostMessagingTarget } from "./normalize.js";
import { mattermostOnboardingAdapter } from "./onboarding.js";
import { import {
listMattermostAccountIds, listMattermostAccountIds,
resolveDefaultMattermostAccountId, resolveDefaultMattermostAccountId,
@@ -24,6 +21,8 @@ import { normalizeMattermostBaseUrl } from "./mattermost/client.js";
import { monitorMattermostProvider } from "./mattermost/monitor.js"; import { monitorMattermostProvider } from "./mattermost/monitor.js";
import { probeMattermost } from "./mattermost/probe.js"; import { probeMattermost } from "./mattermost/probe.js";
import { sendMessageMattermost } from "./mattermost/send.js"; import { sendMessageMattermost } from "./mattermost/send.js";
import { looksLikeMattermostTargetId, normalizeMattermostMessagingTarget } from "./normalize.js";
import { mattermostOnboardingAdapter } from "./onboarding.js";
import { getMattermostRuntime } from "./runtime.js"; import { getMattermostRuntime } from "./runtime.js";
const meta = { const meta = {

View File

@@ -1,5 +1,3 @@
import { z } from "zod";
import { import {
BlockStreamingCoalesceSchema, BlockStreamingCoalesceSchema,
DmPolicySchema, DmPolicySchema,
@@ -7,6 +5,7 @@ import {
MarkdownConfigSchema, MarkdownConfigSchema,
requireOpenAllowFrom, requireOpenAllowFrom,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import { z } from "zod";
const MattermostAccountSchemaBase = z const MattermostAccountSchemaBase = z
.object({ .object({

View File

@@ -1,5 +1,4 @@
import type { ChannelGroupContext } from "openclaw/plugin-sdk"; import type { ChannelGroupContext } from "openclaw/plugin-sdk";
import { resolveMattermostAccount } from "./mattermost/accounts.js"; import { resolveMattermostAccount } from "./mattermost/accounts.js";
export function resolveMattermostGroupRequireMention( export function resolveMattermostGroupRequireMention(

View File

@@ -1,6 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
import type { MattermostAccountConfig, MattermostChatMode } from "../types.js"; import type { MattermostAccountConfig, MattermostChatMode } from "../types.js";
import { normalizeMattermostBaseUrl } from "./client.js"; import { normalizeMattermostBaseUrl } from "./client.js";

View File

@@ -1,8 +1,6 @@
import { Buffer } from "node:buffer";
import type WebSocket from "ws";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk";
import type WebSocket from "ws";
import { Buffer } from "node:buffer";
export type ResponsePrefixContext = { export type ResponsePrefixContext = {
model?: string; model?: string;

View File

@@ -1,5 +1,3 @@
import WebSocket from "ws";
import type { import type {
ChannelAccountSnapshot, ChannelAccountSnapshot,
OpenClawConfig, OpenClawConfig,
@@ -19,7 +17,7 @@ import {
resolveChannelMediaMaxBytes, resolveChannelMediaMaxBytes,
type HistoryEntry, type HistoryEntry,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk";
import WebSocket from "ws";
import { getMattermostRuntime } from "../runtime.js"; import { getMattermostRuntime } from "../runtime.js";
import { resolveMattermostAccount } from "./accounts.js"; import { resolveMattermostAccount } from "./accounts.js";
import { import {

View File

@@ -1,6 +1,5 @@
import type { ChannelOnboardingAdapter, OpenClawConfig, WizardPrompter } from "openclaw/plugin-sdk"; import type { ChannelOnboardingAdapter, OpenClawConfig, WizardPrompter } from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
import { import {
listMattermostAccountIds, listMattermostAccountIds,
resolveDefaultMattermostAccountId, resolveDefaultMattermostAccountId,

View File

@@ -8,10 +8,10 @@
* - Auto-capture filtering * - Auto-capture filtering
*/ */
import { describe, test, expect, beforeEach, afterEach } from "vitest";
import fs from "node:fs/promises"; import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os"; import os from "node:os";
import path from "node:path";
import { describe, test, expect, beforeEach, afterEach } from "vitest";
const OPENAI_API_KEY = process.env.OPENAI_API_KEY ?? "test-key"; const OPENAI_API_KEY = process.env.OPENAI_API_KEY ?? "test-key";
const HAS_OPENAI_KEY = Boolean(process.env.OPENAI_API_KEY); const HAS_OPENAI_KEY = Boolean(process.env.OPENAI_API_KEY);

Some files were not shown because too many files have changed in this diff Show More