mirror of https://github.com/openclaw/openclaw.git
Plugins: internalize mattermost and tlon SDK imports
This commit is contained in:
parent
d073ec42cd
commit
d3fc6c0cc7
|
|
@ -0,0 +1 @@
|
|||
export * from "openclaw/plugin-sdk/mattermost";
|
||||
|
|
@ -17,7 +17,7 @@ import {
|
|||
type ChannelMessageActionAdapter,
|
||||
type ChannelMessageActionName,
|
||||
type ChannelPlugin,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
|
||||
import { MattermostConfigSchema } from "./config-schema.js";
|
||||
import { resolveMattermostGroupRequireMention } from "./group-mentions.js";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
GroupPolicySchema,
|
||||
MarkdownConfigSchema,
|
||||
requireOpenAllowFrom,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
import { z } from "zod";
|
||||
import { requireChannelOpenAllowFrom } from "../../shared/config-schema-helpers.js";
|
||||
import { buildSecretInputSchema } from "./secret-input.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
||||
import type { ChannelGroupContext } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { ChannelGroupContext } from "./runtime-api.js";
|
||||
import { resolveMattermostAccount } from "./mattermost/accounts.js";
|
||||
|
||||
export function resolveMattermostGroupRequireMention(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
||||
import { createAccountListHelpers, type OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||
import { createAccountListHelpers, type OpenClawConfig } from "../runtime-api.js";
|
||||
import { normalizeResolvedSecretInputString, normalizeSecretInputString } from "../secret-input.js";
|
||||
import type {
|
||||
MattermostAccountConfig,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type {
|
|||
ChannelDirectoryEntry,
|
||||
OpenClawConfig,
|
||||
RuntimeEnv,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import { listMattermostAccountIds, resolveMattermostAccount } from "./accounts.js";
|
||||
import {
|
||||
createMattermostClient,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
isTrustedProxyAddress,
|
||||
resolveClientIp,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import { getMattermostRuntime } from "../runtime.js";
|
||||
import { updateMattermostPost, type MattermostClient, type MattermostPost } from "./client.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
resolveStoredModelOverride,
|
||||
type ModelsProviderData,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import type { MattermostInteractiveButtonInput } from "./interactions.js";
|
||||
|
||||
const MATTERMOST_MODEL_PICKER_CONTEXT_KEY = "oc_model_picker";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { OpenClawConfig } from "../runtime-api.js";
|
||||
import {
|
||||
evaluateSenderGroupAccessForPolicy,
|
||||
isDangerousNameMatchingEnabled,
|
||||
resolveAllowlistMatchSimple,
|
||||
resolveControlCommandGate,
|
||||
resolveEffectiveAllowFromLists,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import type { ResolvedMattermostAccount } from "./accounts.js";
|
||||
import type { MattermostChannel } from "./client.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import {
|
|||
formatInboundFromLabel as formatInboundFromLabelShared,
|
||||
resolveThreadSessionKeys as resolveThreadSessionKeysShared,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
export { createDedupeCache, rawDataToString } from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
export { createDedupeCache, rawDataToString } from "../runtime-api.js";
|
||||
|
||||
export type ResponsePrefixContext = {
|
||||
model?: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ChannelAccountSnapshot, RuntimeEnv } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { ChannelAccountSnapshot, RuntimeEnv } from "../runtime-api.js";
|
||||
import WebSocket from "ws";
|
||||
import type { MattermostPost } from "./client.js";
|
||||
import { rawDataToString } from "./monitor-helpers.js";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type {
|
|||
OpenClawConfig,
|
||||
ReplyPayload,
|
||||
RuntimeEnv,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import {
|
||||
buildAgentMediaPayload,
|
||||
buildModelsProviderData,
|
||||
|
|
@ -30,7 +30,7 @@ import {
|
|||
warnMissingProviderGroupPolicyFallbackOnce,
|
||||
listSkillCommandsForAgents,
|
||||
type HistoryEntry,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import { getMattermostRuntime } from "../runtime.js";
|
||||
import { resolveMattermostAccount, resolveMattermostReplyToMode } from "./accounts.js";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BaseProbeResult } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { BaseProbeResult } from "../runtime-api.js";
|
||||
import { normalizeMattermostBaseUrl, readMattermostError, type MattermostUser } from "./client.js";
|
||||
|
||||
export type MattermostProbe = BaseProbeResult & {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { OpenClawConfig } from "../runtime-api.js";
|
||||
import { resolveMattermostAccount } from "./accounts.js";
|
||||
import { createMattermostClient, fetchMattermostMe, type MattermostClient } from "./client.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { OpenClawConfig, PluginRuntime, ReplyPayload } from "openclaw/plugin-sdk/mattermost";
|
||||
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { OpenClawConfig, PluginRuntime, ReplyPayload } from "../runtime-api.js";
|
||||
import { getAgentScopedMediaLocalRoots } from "../runtime-api.js";
|
||||
|
||||
type MarkdownTableMode = Parameters<PluginRuntime["channel"]["text"]["convertMarkdownTables"]>[1];
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export * from "../../runtime-api.js";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "../runtime-api.js";
|
||||
import { getMattermostRuntime } from "../runtime.js";
|
||||
import { resolveMattermostAccount } from "./accounts.js";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
type OpenClawConfig,
|
||||
type ReplyPayload,
|
||||
type RuntimeEnv,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "../runtime-api.js";
|
||||
import type { ResolvedMattermostAccount } from "../mattermost/accounts.js";
|
||||
import { getMattermostRuntime } from "../runtime.js";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { OpenClawPluginApi } from "../runtime-api.js";
|
||||
import type { ResolvedMattermostAccount } from "./accounts.js";
|
||||
import { resolveSlashCommandConfig, type MattermostRegisteredCommand } from "./slash-commands.js";
|
||||
import { createSlashCommandHttpHandler } from "./slash-http.js";
|
||||
|
|
@ -86,8 +86,8 @@ export function activateSlashCommands(params: {
|
|||
registeredCommands: MattermostRegisteredCommand[];
|
||||
triggerMap?: Map<string, string>;
|
||||
api: {
|
||||
cfg: import("openclaw/plugin-sdk/mattermost").OpenClawConfig;
|
||||
runtime: import("openclaw/plugin-sdk/mattermost").RuntimeEnv;
|
||||
cfg: import("../runtime-api.js").OpenClawConfig;
|
||||
runtime: import("../runtime-api.js").RuntimeEnv;
|
||||
};
|
||||
log?: (msg: string) => void;
|
||||
}) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { OpenClawConfig } from "../runtime-api.js";
|
||||
import { resolveMattermostAccount } from "./accounts.js";
|
||||
import {
|
||||
createMattermostClient,
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export * from "../runtime-api.js";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginRuntime } from "openclaw/plugin-sdk/mattermost";
|
||||
import type { PluginRuntime } from "./runtime-api.js";
|
||||
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
||||
|
||||
const { setRuntime: setMattermostRuntime, getRuntime: getMattermostRuntime } =
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
hasConfiguredSecretInput,
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInputString,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
|
||||
export {
|
||||
buildSecretInputSchema,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
migrateBaseNameToDefaultAccount,
|
||||
normalizeAccountId,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
import { resolveMattermostAccount, type ResolvedMattermostAccount } from "./mattermost/accounts.js";
|
||||
import { normalizeMattermostBaseUrl } from "./mattermost/client.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
DEFAULT_ACCOUNT_ID,
|
||||
hasConfiguredSecretInput,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
import { type ChannelSetupWizard } from "openclaw/plugin-sdk/setup";
|
||||
import { formatDocsLink } from "openclaw/plugin-sdk/setup";
|
||||
import { listMattermostAccountIds } from "./mattermost/accounts.js";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type {
|
|||
DmPolicy,
|
||||
GroupPolicy,
|
||||
SecretInput,
|
||||
} from "openclaw/plugin-sdk/mattermost";
|
||||
} from "./runtime-api.js";
|
||||
|
||||
export type MattermostReplyToMode = "off" | "first" | "all";
|
||||
export type MattermostChatTypeKey = "direct" | "channel" | "group";
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
export * from "openclaw/plugin-sdk/tlon";
|
||||
export * from "./src/setup-core.js";
|
||||
export * from "./src/setup-surface.js";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import crypto from "node:crypto";
|
||||
import { configureClient } from "@tloncorp/api";
|
||||
import type {
|
||||
ChannelOutboundAdapter,
|
||||
ChannelPlugin,
|
||||
OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/tlon";
|
||||
import type { ChannelOutboundAdapter, ChannelPlugin, OpenClawConfig } from "../api.js";
|
||||
import { createLoggerBackedRuntime, createReplyPrefixOptions } from "../api.js";
|
||||
import { monitorTlonProvider } from "./monitor/index.js";
|
||||
import { tlonSetupWizard } from "./setup-surface.js";
|
||||
import {
|
||||
|
|
@ -230,7 +227,7 @@ export async function startTlonGatewayAccount(
|
|||
accountId: account.accountId,
|
||||
ship: account.ship,
|
||||
url: account.url,
|
||||
} as import("openclaw/plugin-sdk/tlon").ChannelAccountSnapshot);
|
||||
} as ChannelAccountSnapshot);
|
||||
ctx.log?.info(`[${account.accountId}] starting Tlon provider for ${account.ship ?? "tlon"}`);
|
||||
return monitorTlonProvider({
|
||||
runtime: ctx.runtime,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
||||
import type { ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk/tlon";
|
||||
import { tlonChannelConfigSchema } from "./config-schema.js";
|
||||
import {
|
||||
applyTlonSetupConfig,
|
||||
|
|
@ -14,6 +13,7 @@ import {
|
|||
resolveTlonOutboundTarget,
|
||||
} from "./targets.js";
|
||||
import { resolveTlonAccount, listTlonAccountIds } from "./types.js";
|
||||
import type { ChannelAccountSnapshot, ChannelPlugin, OpenClawConfig } from "../api.js";
|
||||
import { validateUrbitBaseUrl } from "./urbit/base-url.js";
|
||||
|
||||
const TLON_CHANNEL_ID = "tlon" as const;
|
||||
|
|
@ -214,7 +214,7 @@ export const tlonPlugin: ChannelPlugin = {
|
|||
lastError: runtime?.lastError ?? null,
|
||||
probe,
|
||||
};
|
||||
return snapshot as import("openclaw/plugin-sdk/tlon").ChannelAccountSnapshot;
|
||||
return snapshot as ChannelAccountSnapshot;
|
||||
},
|
||||
},
|
||||
gateway: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/tlon";
|
||||
import { buildChannelConfigSchema } from "../api.js";
|
||||
import { z } from "zod";
|
||||
|
||||
const ShipSchema = z.string().min(1);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { RuntimeEnv } from "openclaw/plugin-sdk/tlon";
|
||||
import type { RuntimeEnv } from "../../api.js";
|
||||
import type { Foreigns } from "../urbit/foreigns.js";
|
||||
import { formatChangesDate } from "./utils.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { RuntimeEnv } from "openclaw/plugin-sdk/tlon";
|
||||
import type { RuntimeEnv } from "../../api.js";
|
||||
import { extractMessageText } from "./utils.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { RuntimeEnv, ReplyPayload, OpenClawConfig } from "openclaw/plugin-sdk/tlon";
|
||||
import { createLoggerBackedRuntime, createReplyPrefixOptions } from "openclaw/plugin-sdk/tlon";
|
||||
import type { RuntimeEnv, ReplyPayload, OpenClawConfig } from "../../api.js";
|
||||
import { createLoggerBackedRuntime, createReplyPrefixOptions } from "../../api.js";
|
||||
import { getTlonRuntime } from "../runtime.js";
|
||||
import { createSettingsManager, type TlonSettingsStore } from "../settings.js";
|
||||
import { normalizeShip, parseChannelNest } from "../targets.js";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { homedir } from "node:os";
|
|||
import * as path from "node:path";
|
||||
import { Readable } from "node:stream";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/tlon";
|
||||
import { fetchWithSsrFGuard } from "../api.js";
|
||||
import { getDefaultSsrFPolicy } from "../urbit/context.js";
|
||||
|
||||
// Default to OpenClaw workspace media directory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { createDedupeCache } from "openclaw/plugin-sdk/tlon";
|
||||
import { createDedupeCache } from "../../api.js";
|
||||
|
||||
export type ProcessedMessageTracker = {
|
||||
mark: (id?: string | null) => boolean;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk/tlon";
|
||||
import type { PluginRuntime } from "../api.js";
|
||||
|
||||
const { setRuntime: setTlonRuntime, getRuntime: getTlonRuntime } =
|
||||
createPluginRuntimeStore<PluginRuntime>("Tlon runtime not initialized");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/tlon";
|
||||
import type { OpenClawConfig } from "../api.js";
|
||||
|
||||
export type TlonResolvedAccount = {
|
||||
accountId: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/tlon";
|
||||
import type { LookupFn, SsrFPolicy } from "../../api.js";
|
||||
import { UrbitAuthError } from "./errors.js";
|
||||
import { urbitFetch } from "./fetch.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { isBlockedHostnameOrIp } from "openclaw/plugin-sdk/tlon";
|
||||
import { isBlockedHostnameOrIp } from "../../api.js";
|
||||
|
||||
export type UrbitBaseUrlValidation =
|
||||
| { ok: true; baseUrl: string; hostname: string }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/tlon";
|
||||
import type { LookupFn, SsrFPolicy } from "../../api.js";
|
||||
import { UrbitHttpError } from "./errors.js";
|
||||
import { urbitFetch } from "./fetch.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { SsrFPolicy } from "openclaw/plugin-sdk/tlon";
|
||||
import type { SsrFPolicy } from "../../api.js";
|
||||
import { validateUrbitBaseUrl } from "./base-url.js";
|
||||
import { UrbitUrlError } from "./errors.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/tlon";
|
||||
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/tlon";
|
||||
import type { LookupFn, SsrFPolicy } from "../../api.js";
|
||||
import { fetchWithSsrFGuard } from "../../api.js";
|
||||
import { validateUrbitBaseUrl } from "./base-url.js";
|
||||
import { UrbitUrlError } from "./errors.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { randomUUID } from "node:crypto";
|
||||
import { Readable } from "node:stream";
|
||||
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/tlon";
|
||||
import type { LookupFn, SsrFPolicy } from "../../api.js";
|
||||
import { ensureUrbitChannelOpen, pokeUrbitChannel, scryUrbitPath } from "./channel-ops.js";
|
||||
import { getUrbitContext, normalizeUrbitCookie } from "./context.js";
|
||||
import { urbitFetch } from "./fetch.js";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Upload an image from a URL to Tlon storage.
|
||||
*/
|
||||
import { uploadFile } from "@tloncorp/api";
|
||||
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/tlon";
|
||||
import { fetchWithSsrFGuard } from "../../api.js";
|
||||
import { getDefaultSsrFPolicy } from "./context.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,11 +122,13 @@ const LOCAL_EXTENSION_API_BARREL_GUARDS = [
|
|||
"diffs",
|
||||
"llm-task",
|
||||
"line",
|
||||
"mattermost",
|
||||
"memory-lancedb",
|
||||
"nextcloud-talk",
|
||||
"synology-chat",
|
||||
"talk-voice",
|
||||
"thread-ownership",
|
||||
"tlon",
|
||||
"voice-call",
|
||||
] as const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue