Extensions: migrate tlon plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 01:20:18 -05:00
parent 9bf08c926b
commit b0bca8d6e9
19 changed files with 32 additions and 32 deletions

View File

@@ -5,12 +5,12 @@ import type {
ChannelPlugin,
ChannelSetupInput,
OpenClawConfig,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import {
applyAccountNameToChannelSection,
DEFAULT_ACCOUNT_ID,
normalizeAccountId,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { buildTlonAccountFields } from "./account-fields.js";
import { tlonChannelConfigSchema } from "./config-schema.js";
import { monitorTlonProvider } from "./monitor/index.js";
@@ -497,7 +497,7 @@ export const tlonPlugin: ChannelPlugin = {
lastError: runtime?.lastError ?? null,
probe,
};
return snapshot as import("openclaw/plugin-sdk").ChannelAccountSnapshot;
return snapshot as import("openclaw/plugin-sdk/compat").ChannelAccountSnapshot;
},
},
gateway: {
@@ -507,7 +507,7 @@ export const tlonPlugin: ChannelPlugin = {
accountId: account.accountId,
ship: account.ship,
url: account.url,
} as import("openclaw/plugin-sdk").ChannelAccountSnapshot);
} as import("openclaw/plugin-sdk/compat").ChannelAccountSnapshot);
ctx.log?.info(`[${account.accountId}] starting Tlon provider for ${account.ship ?? "tlon"}`);
return monitorTlonProvider({
runtime: ctx.runtime,

View File

@@ -1,4 +1,4 @@
import { buildChannelConfigSchema } from "openclaw/plugin-sdk";
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/compat";
import { z } from "zod";
const ShipSchema = z.string().min(1);

View File

@@ -1,4 +1,4 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk/compat";
import type { Foreigns } from "../urbit/foreigns.js";
import { formatChangesDate } from "./utils.js";

View File

@@ -1,4 +1,4 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { extractMessageText } from "./utils.js";
/**

View File

@@ -1,5 +1,5 @@
import type { RuntimeEnv, ReplyPayload, OpenClawConfig } from "openclaw/plugin-sdk";
import { createLoggerBackedRuntime, createReplyPrefixOptions } from "openclaw/plugin-sdk";
import type { RuntimeEnv, ReplyPayload, OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { createLoggerBackedRuntime, createReplyPrefixOptions } from "openclaw/plugin-sdk/compat";
import { getTlonRuntime } from "../runtime.js";
import { createSettingsManager, type TlonSettingsStore } from "../settings.js";
import { normalizeShip, parseChannelNest } from "../targets.js";

View File

@@ -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";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/compat";
import { getDefaultSsrFPolicy } from "../urbit/context.js";
// Default to OpenClaw workspace media directory

View File

@@ -1,4 +1,4 @@
import { createDedupeCache } from "openclaw/plugin-sdk";
import { createDedupeCache } from "openclaw/plugin-sdk/compat";
export type ProcessedMessageTracker = {
mark: (id?: string | null) => boolean;

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import {
formatDocsLink,
promptAccountId,
@@ -6,7 +6,7 @@ import {
normalizeAccountId,
type ChannelOnboardingAdapter,
type WizardPrompter,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { buildTlonAccountFields } from "./account-fields.js";
import type { TlonResolvedAccount } from "./types.js";
import { listTlonAccountIds, resolveTlonAccount } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
let runtime: PluginRuntime | null = null;

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
export type TlonResolvedAccount = {
accountId: string;

View File

@@ -1,5 +1,5 @@
import type { LookupFn } from "openclaw/plugin-sdk";
import { SsrFBlockedError } from "openclaw/plugin-sdk";
import type { LookupFn } from "openclaw/plugin-sdk/compat";
import { SsrFBlockedError } from "openclaw/plugin-sdk/compat";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { authenticate } from "./auth.js";

View File

@@ -1,4 +1,4 @@
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk";
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { UrbitAuthError } from "./errors.js";
import { urbitFetch } from "./fetch.js";

View File

@@ -1,4 +1,4 @@
import { isBlockedHostnameOrIp } from "openclaw/plugin-sdk";
import { isBlockedHostnameOrIp } from "openclaw/plugin-sdk/compat";
export type UrbitBaseUrlValidation =
| { ok: true; baseUrl: string; hostname: string }

View File

@@ -1,4 +1,4 @@
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk";
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { UrbitHttpError } from "./errors.js";
import { urbitFetch } from "./fetch.js";

View File

@@ -1,4 +1,4 @@
import type { SsrFPolicy } from "openclaw/plugin-sdk";
import type { SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { validateUrbitBaseUrl } from "./base-url.js";
import { UrbitUrlError } from "./errors.js";

View File

@@ -1,5 +1,5 @@
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk";
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/compat";
import { validateUrbitBaseUrl } from "./base-url.js";
import { UrbitUrlError } from "./errors.js";

View File

@@ -1,6 +1,6 @@
import { randomUUID } from "node:crypto";
import { Readable } from "node:stream";
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk";
import type { LookupFn, SsrFPolicy } from "openclaw/plugin-sdk/compat";
import { ensureUrbitChannelOpen, pokeUrbitChannel, scryUrbitPath } from "./channel-ops.js";
import { getUrbitContext, normalizeUrbitCookie } from "./context.js";
import { urbitFetch } from "./fetch.js";

View File

@@ -1,8 +1,8 @@
import { describe, expect, it, vi, afterEach, beforeEach } from "vitest";
// Mock fetchWithSsrFGuard from plugin-sdk
vi.mock("openclaw/plugin-sdk", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk")>();
vi.mock("openclaw/plugin-sdk/compat", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/compat")>();
return {
...actual,
fetchWithSsrFGuard: vi.fn(),
@@ -24,7 +24,7 @@ describe("uploadImageFromUrl", () => {
});
it("fetches image and calls uploadFile, returns uploaded URL", async () => {
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk");
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/compat");
const mockFetch = vi.mocked(fetchWithSsrFGuard);
const { uploadFile } = await import("@tloncorp/api");
@@ -59,7 +59,7 @@ describe("uploadImageFromUrl", () => {
});
it("returns original URL if fetch fails", async () => {
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk");
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/compat");
const mockFetch = vi.mocked(fetchWithSsrFGuard);
// Mock fetchWithSsrFGuard to return a failed response
@@ -79,7 +79,7 @@ describe("uploadImageFromUrl", () => {
});
it("returns original URL if upload fails", async () => {
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk");
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/compat");
const mockFetch = vi.mocked(fetchWithSsrFGuard);
const { uploadFile } = await import("@tloncorp/api");
@@ -127,7 +127,7 @@ describe("uploadImageFromUrl", () => {
});
it("extracts filename from URL path", async () => {
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk");
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/compat");
const mockFetch = vi.mocked(fetchWithSsrFGuard);
const { uploadFile } = await import("@tloncorp/api");
@@ -157,7 +157,7 @@ describe("uploadImageFromUrl", () => {
});
it("uses default filename when URL has no path", async () => {
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk");
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/compat");
const mockFetch = vi.mocked(fetchWithSsrFGuard);
const { uploadFile } = await import("@tloncorp/api");

View File

@@ -2,7 +2,7 @@
* Upload an image from a URL to Tlon storage.
*/
import { uploadFile } from "@tloncorp/api";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/compat";
import { getDefaultSsrFPolicy } from "./context.js";
/**