refactor: slim plugin sdk provider entrypoints
This commit is contained in:
@@ -4792,7 +4792,7 @@
|
||||
"exportName": "buildOptionalSecretInputSchema",
|
||||
"kind": "function",
|
||||
"source": {
|
||||
"line": 18,
|
||||
"line": 20,
|
||||
"path": "src/plugin-sdk/secret-input.ts"
|
||||
}
|
||||
},
|
||||
@@ -4801,7 +4801,7 @@
|
||||
"exportName": "buildSecretInputArraySchema",
|
||||
"kind": "function",
|
||||
"source": {
|
||||
"line": 23,
|
||||
"line": 25,
|
||||
"path": "src/plugin-sdk/secret-input.ts"
|
||||
}
|
||||
},
|
||||
@@ -4810,7 +4810,7 @@
|
||||
"exportName": "buildSecretInputSchema",
|
||||
"kind": "function",
|
||||
"source": {
|
||||
"line": 11,
|
||||
"line": 54,
|
||||
"path": "src/plugin-sdk/secret-input-schema.ts"
|
||||
}
|
||||
},
|
||||
@@ -4832,6 +4832,15 @@
|
||||
"path": "src/config/types.secrets.ts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"declaration": "export function normalizeSecretInput(value: unknown): string;",
|
||||
"exportName": "normalizeSecretInput",
|
||||
"kind": "function",
|
||||
"source": {
|
||||
"line": 16,
|
||||
"path": "src/utils/normalize-secret-input.ts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"declaration": "export function normalizeSecretInputString(value: unknown): string | undefined;",
|
||||
"exportName": "normalizeSecretInputString",
|
||||
|
||||
@@ -527,11 +527,12 @@
|
||||
{"declaration":"export function createPluginRuntimeStore<T>(errorMessage: string): { setRuntime: (next: T) => void; clearRuntime: () => void; tryGetRuntime: () => T | null; getRuntime: () => T; };","entrypoint":"runtime-store","exportName":"createPluginRuntimeStore","importSpecifier":"openclaw/plugin-sdk/runtime-store","kind":"function","recordType":"export","sourceLine":4,"sourcePath":"src/plugin-sdk/runtime-store.ts"}
|
||||
{"declaration":"export type PluginRuntime = PluginRuntime;","entrypoint":"runtime-store","exportName":"PluginRuntime","importSpecifier":"openclaw/plugin-sdk/runtime-store","kind":"type","recordType":"export","sourceLine":54,"sourcePath":"src/plugins/runtime/types.ts"}
|
||||
{"category":"channel","entrypoint":"secret-input","importSpecifier":"openclaw/plugin-sdk/secret-input","recordType":"module","sourceLine":1,"sourcePath":"src/plugin-sdk/secret-input.ts"}
|
||||
{"declaration":"export function buildOptionalSecretInputSchema(): ZodOptional<ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>>;","entrypoint":"secret-input","exportName":"buildOptionalSecretInputSchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":18,"sourcePath":"src/plugin-sdk/secret-input.ts"}
|
||||
{"declaration":"export function buildSecretInputArraySchema(): ZodArray<ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>>;","entrypoint":"secret-input","exportName":"buildSecretInputArraySchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":23,"sourcePath":"src/plugin-sdk/secret-input.ts"}
|
||||
{"declaration":"export function buildSecretInputSchema(): ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>;","entrypoint":"secret-input","exportName":"buildSecretInputSchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":11,"sourcePath":"src/plugin-sdk/secret-input-schema.ts"}
|
||||
{"declaration":"export function buildOptionalSecretInputSchema(): ZodOptional<ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>>;","entrypoint":"secret-input","exportName":"buildOptionalSecretInputSchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":20,"sourcePath":"src/plugin-sdk/secret-input.ts"}
|
||||
{"declaration":"export function buildSecretInputArraySchema(): ZodArray<ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>>;","entrypoint":"secret-input","exportName":"buildSecretInputArraySchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":25,"sourcePath":"src/plugin-sdk/secret-input.ts"}
|
||||
{"declaration":"export function buildSecretInputSchema(): ZodUnion<readonly [ZodString, ZodDiscriminatedUnion<[ZodObject<{ source: ZodLiteral<\"env\">; provider: ZodString; id: ZodString; }, $strip>, ZodObject<...>, ZodObject<...>], \"source\">]>;","entrypoint":"secret-input","exportName":"buildSecretInputSchema","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":54,"sourcePath":"src/plugin-sdk/secret-input-schema.ts"}
|
||||
{"declaration":"export function hasConfiguredSecretInput(value: unknown, defaults?: SecretDefaults | undefined): boolean;","entrypoint":"secret-input","exportName":"hasConfiguredSecretInput","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":106,"sourcePath":"src/config/types.secrets.ts"}
|
||||
{"declaration":"export function normalizeResolvedSecretInputString(params: { value: unknown; refValue?: unknown; defaults?: SecretDefaults | undefined; path: string; }): string | undefined;","entrypoint":"secret-input","exportName":"normalizeResolvedSecretInputString","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":144,"sourcePath":"src/config/types.secrets.ts"}
|
||||
{"declaration":"export function normalizeSecretInput(value: unknown): string;","entrypoint":"secret-input","exportName":"normalizeSecretInput","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":16,"sourcePath":"src/utils/normalize-secret-input.ts"}
|
||||
{"declaration":"export function normalizeSecretInputString(value: unknown): string | undefined;","entrypoint":"secret-input","exportName":"normalizeSecretInputString","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"function","recordType":"export","sourceLine":113,"sourcePath":"src/config/types.secrets.ts"}
|
||||
{"declaration":"export type SecretInput = SecretInput;","entrypoint":"secret-input","exportName":"SecretInput","importSpecifier":"openclaw/plugin-sdk/secret-input","kind":"type","recordType":"export","sourceLine":16,"sourcePath":"src/config/types.secrets.ts"}
|
||||
{"category":"utilities","entrypoint":"testing","importSpecifier":"openclaw/plugin-sdk/testing","recordType":"module","sourceLine":1,"sourcePath":"src/plugin-sdk/testing.ts"}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { normalizeSecretInput } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
||||
import {
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInput,
|
||||
} from "openclaw/plugin-sdk/secret-input";
|
||||
|
||||
export const DEFAULT_FIRECRAWL_BASE_URL = "https://api.firecrawl.dev";
|
||||
export const DEFAULT_FIRECRAWL_SEARCH_TIMEOUT_SECONDS = 30;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { markdownToText, truncateText } from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import {
|
||||
DEFAULT_CACHE_TTL_MINUTES,
|
||||
markdownToText,
|
||||
normalizeCacheKey,
|
||||
postTrustedWebToolsJson,
|
||||
readCache,
|
||||
resolveCacheTtlMs,
|
||||
truncateText,
|
||||
writeCache,
|
||||
} from "openclaw/plugin-sdk/provider-web-search";
|
||||
import { wrapExternalContent, wrapWebContent } from "openclaw/plugin-sdk/security-runtime";
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { jsonResult, readNumberParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
import {
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readStringParam,
|
||||
} from "openclaw/plugin-sdk/provider-web-search";
|
||||
import { runFirecrawlScrape } from "./firecrawl-client.js";
|
||||
|
||||
function optionalStringEnum<const T extends readonly string[]>(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
import {
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readStringArrayParam,
|
||||
readStringParam,
|
||||
} from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
} from "openclaw/plugin-sdk/provider-web-search";
|
||||
import { runFirecrawlSearch } from "./firecrawl-client.js";
|
||||
|
||||
const FirecrawlSearchToolSchema = Type.Object(
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
ProviderAuthContext,
|
||||
ProviderFetchUsageSnapshotContext,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth-result";
|
||||
import { fetchGeminiUsage } from "openclaw/plugin-sdk/provider-usage";
|
||||
import { isModernGoogleModel, resolveGoogle31ForwardCompatModel } from "./provider-models.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ImageGenerationProvider } from "openclaw/plugin-sdk/image-generation";
|
||||
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/image-generation-core";
|
||||
import {
|
||||
DEFAULT_GOOGLE_API_BASE_URL,
|
||||
normalizeGoogleApiBaseUrl,
|
||||
|
||||
+196
-10
@@ -1,17 +1,203 @@
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth";
|
||||
import type { ImageGenerationProvider } from "openclaw/plugin-sdk/image-generation";
|
||||
import type { MediaUnderstandingProvider } from "openclaw/plugin-sdk/media-understanding";
|
||||
import {
|
||||
definePluginEntry,
|
||||
type OpenClawPluginApi,
|
||||
type ProviderAuthContext,
|
||||
type ProviderFetchUsageSnapshotContext,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
||||
import {
|
||||
GOOGLE_GEMINI_DEFAULT_MODEL,
|
||||
applyGoogleGeminiModelDefault,
|
||||
} from "openclaw/plugin-sdk/provider-models";
|
||||
import { createGoogleThinkingPayloadWrapper } from "openclaw/plugin-sdk/provider-stream";
|
||||
createGoogleThinkingPayloadWrapper,
|
||||
} from "openclaw/plugin-sdk/provider-google";
|
||||
import type { ProviderPlugin } from "openclaw/plugin-sdk/provider-models";
|
||||
import { buildGoogleGeminiCliBackend } from "./cli-backend.js";
|
||||
import { registerGoogleGeminiCliProvider } from "./gemini-cli-provider.js";
|
||||
import { buildGoogleImageGenerationProvider } from "./image-generation-provider.js";
|
||||
import { googleMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
||||
import { isModernGoogleModel, resolveGoogle31ForwardCompatModel } from "./provider-models.js";
|
||||
import { createGeminiWebSearchProvider } from "./src/gemini-web-search-provider.js";
|
||||
|
||||
const GOOGLE_GEMINI_CLI_PROVIDER_ID = "google-gemini-cli";
|
||||
const GOOGLE_GEMINI_CLI_PROVIDER_LABEL = "Gemini CLI OAuth";
|
||||
const GOOGLE_GEMINI_CLI_DEFAULT_MODEL = "google-gemini-cli/gemini-3.1-pro-preview";
|
||||
const GOOGLE_GEMINI_CLI_ENV_VARS = [
|
||||
"OPENCLAW_GEMINI_OAUTH_CLIENT_ID",
|
||||
"OPENCLAW_GEMINI_OAUTH_CLIENT_SECRET",
|
||||
"GEMINI_CLI_OAUTH_CLIENT_ID",
|
||||
"GEMINI_CLI_OAUTH_CLIENT_SECRET",
|
||||
] as const;
|
||||
|
||||
type GoogleOauthApiKeyCredential = {
|
||||
type?: string;
|
||||
access?: string;
|
||||
projectId?: string;
|
||||
};
|
||||
|
||||
let googleGeminiCliProviderPromise: Promise<ProviderPlugin> | null = null;
|
||||
let googleImageGenerationProviderPromise: Promise<ImageGenerationProvider> | null = null;
|
||||
let googleMediaUnderstandingProviderPromise: Promise<MediaUnderstandingProvider> | null = null;
|
||||
|
||||
type GoogleMediaUnderstandingProvider = MediaUnderstandingProvider & {
|
||||
describeImage: NonNullable<MediaUnderstandingProvider["describeImage"]>;
|
||||
describeImages: NonNullable<MediaUnderstandingProvider["describeImages"]>;
|
||||
transcribeAudio: NonNullable<MediaUnderstandingProvider["transcribeAudio"]>;
|
||||
describeVideo: NonNullable<MediaUnderstandingProvider["describeVideo"]>;
|
||||
};
|
||||
|
||||
function formatGoogleOauthApiKey(cred: GoogleOauthApiKeyCredential): string {
|
||||
if (cred.type !== "oauth" || typeof cred.access !== "string" || !cred.access.trim()) {
|
||||
return "";
|
||||
}
|
||||
return JSON.stringify({
|
||||
token: cred.access,
|
||||
projectId: cred.projectId,
|
||||
});
|
||||
}
|
||||
|
||||
async function loadGoogleGeminiCliProvider(): Promise<ProviderPlugin> {
|
||||
if (!googleGeminiCliProviderPromise) {
|
||||
googleGeminiCliProviderPromise = import("./gemini-cli-provider.js").then((mod) => {
|
||||
let provider: ProviderPlugin | undefined;
|
||||
mod.registerGoogleGeminiCliProvider({
|
||||
registerProvider(entry) {
|
||||
provider = entry;
|
||||
},
|
||||
} as Pick<OpenClawPluginApi, "registerProvider"> as OpenClawPluginApi);
|
||||
if (!provider) {
|
||||
throw new Error("google gemini cli provider missing provider registration");
|
||||
}
|
||||
return provider;
|
||||
});
|
||||
}
|
||||
return await googleGeminiCliProviderPromise;
|
||||
}
|
||||
|
||||
async function loadGoogleImageGenerationProvider(): Promise<ImageGenerationProvider> {
|
||||
if (!googleImageGenerationProviderPromise) {
|
||||
googleImageGenerationProviderPromise = import("./image-generation-provider.js").then((mod) =>
|
||||
mod.buildGoogleImageGenerationProvider(),
|
||||
);
|
||||
}
|
||||
return await googleImageGenerationProviderPromise;
|
||||
}
|
||||
|
||||
async function loadGoogleMediaUnderstandingProvider(): Promise<MediaUnderstandingProvider> {
|
||||
if (!googleMediaUnderstandingProviderPromise) {
|
||||
googleMediaUnderstandingProviderPromise = import("./media-understanding-provider.js").then(
|
||||
(mod) => mod.googleMediaUnderstandingProvider,
|
||||
);
|
||||
}
|
||||
return await googleMediaUnderstandingProviderPromise;
|
||||
}
|
||||
|
||||
async function loadGoogleRequiredMediaUnderstandingProvider(): Promise<GoogleMediaUnderstandingProvider> {
|
||||
const provider = await loadGoogleMediaUnderstandingProvider();
|
||||
if (
|
||||
!provider.describeImage ||
|
||||
!provider.describeImages ||
|
||||
!provider.transcribeAudio ||
|
||||
!provider.describeVideo
|
||||
) {
|
||||
throw new Error("google media understanding provider missing required handlers");
|
||||
}
|
||||
return provider as GoogleMediaUnderstandingProvider;
|
||||
}
|
||||
|
||||
function createLazyGoogleGeminiCliProvider(): ProviderPlugin {
|
||||
return {
|
||||
id: GOOGLE_GEMINI_CLI_PROVIDER_ID,
|
||||
label: GOOGLE_GEMINI_CLI_PROVIDER_LABEL,
|
||||
docsPath: "/providers/models",
|
||||
aliases: ["gemini-cli"],
|
||||
envVars: [...GOOGLE_GEMINI_CLI_ENV_VARS],
|
||||
auth: [
|
||||
{
|
||||
id: "oauth",
|
||||
label: "Google OAuth",
|
||||
hint: "PKCE + localhost callback",
|
||||
kind: "oauth",
|
||||
run: async (ctx: ProviderAuthContext) => {
|
||||
const provider = await loadGoogleGeminiCliProvider();
|
||||
const authMethod = provider.auth?.[0];
|
||||
if (!authMethod || authMethod.kind !== "oauth") {
|
||||
return { profiles: [] };
|
||||
}
|
||||
return await authMethod.run(ctx);
|
||||
},
|
||||
},
|
||||
],
|
||||
wizard: {
|
||||
setup: {
|
||||
choiceId: "google-gemini-cli",
|
||||
choiceLabel: "Gemini CLI OAuth",
|
||||
choiceHint: "Google OAuth with project-aware token payload",
|
||||
methodId: "oauth",
|
||||
},
|
||||
},
|
||||
resolveDynamicModel: (ctx) =>
|
||||
resolveGoogle31ForwardCompatModel({ providerId: GOOGLE_GEMINI_CLI_PROVIDER_ID, ctx }),
|
||||
isModernModelRef: ({ modelId }) => isModernGoogleModel(modelId),
|
||||
formatApiKey: (cred) => formatGoogleOauthApiKey(cred as GoogleOauthApiKeyCredential),
|
||||
resolveUsageAuth: async (ctx) => {
|
||||
const provider = await loadGoogleGeminiCliProvider();
|
||||
return await provider.resolveUsageAuth?.(ctx);
|
||||
},
|
||||
fetchUsageSnapshot: async (ctx: ProviderFetchUsageSnapshotContext) => {
|
||||
const provider = await loadGoogleGeminiCliProvider();
|
||||
if (!provider.fetchUsageSnapshot) {
|
||||
throw new Error("google gemini cli provider missing usage snapshot handler");
|
||||
}
|
||||
return await provider.fetchUsageSnapshot(ctx);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createLazyGoogleImageGenerationProvider(): ImageGenerationProvider {
|
||||
return {
|
||||
id: "google",
|
||||
label: "Google",
|
||||
defaultModel: "gemini-3.1-flash-image-preview",
|
||||
models: ["gemini-3.1-flash-image-preview", "gemini-3-pro-image-preview"],
|
||||
capabilities: {
|
||||
generate: {
|
||||
maxCount: 4,
|
||||
supportsSize: true,
|
||||
supportsAspectRatio: true,
|
||||
supportsResolution: true,
|
||||
},
|
||||
edit: {
|
||||
enabled: true,
|
||||
maxCount: 4,
|
||||
maxInputImages: 5,
|
||||
supportsSize: true,
|
||||
supportsAspectRatio: true,
|
||||
supportsResolution: true,
|
||||
},
|
||||
geometry: {
|
||||
sizes: ["1024x1024", "1024x1536", "1536x1024", "1024x1792", "1792x1024"],
|
||||
aspectRatios: ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"],
|
||||
resolutions: ["1K", "2K", "4K"],
|
||||
},
|
||||
},
|
||||
generateImage: async (req) => (await loadGoogleImageGenerationProvider()).generateImage(req),
|
||||
};
|
||||
}
|
||||
|
||||
function createLazyGoogleMediaUnderstandingProvider(): MediaUnderstandingProvider {
|
||||
return {
|
||||
id: "google",
|
||||
capabilities: ["image", "audio", "video"],
|
||||
describeImage: async (...args) =>
|
||||
await (await loadGoogleRequiredMediaUnderstandingProvider()).describeImage(...args),
|
||||
describeImages: async (...args) =>
|
||||
await (await loadGoogleRequiredMediaUnderstandingProvider()).describeImages(...args),
|
||||
transcribeAudio: async (...args) =>
|
||||
await (await loadGoogleRequiredMediaUnderstandingProvider()).transcribeAudio(...args),
|
||||
describeVideo: async (...args) =>
|
||||
await (await loadGoogleRequiredMediaUnderstandingProvider()).describeVideo(...args),
|
||||
};
|
||||
}
|
||||
|
||||
export default definePluginEntry({
|
||||
id: "google",
|
||||
name: "Google Plugin",
|
||||
@@ -50,9 +236,9 @@ export default definePluginEntry({
|
||||
isModernModelRef: ({ modelId }) => isModernGoogleModel(modelId),
|
||||
});
|
||||
api.registerCliBackend(buildGoogleGeminiCliBackend());
|
||||
registerGoogleGeminiCliProvider(api);
|
||||
api.registerImageGenerationProvider(buildGoogleImageGenerationProvider());
|
||||
api.registerMediaUnderstandingProvider(googleMediaUnderstandingProvider);
|
||||
api.registerProvider(createLazyGoogleGeminiCliProvider());
|
||||
api.registerImageGenerationProvider(createLazyGoogleImageGenerationProvider());
|
||||
api.registerMediaUnderstandingProvider(createLazyGoogleMediaUnderstandingProvider());
|
||||
api.registerWebSearchProvider(createGeminiWebSearchProvider());
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-en
|
||||
import {
|
||||
createMoonshotThinkingWrapper,
|
||||
resolveMoonshotThinkingType,
|
||||
} from "openclaw/plugin-sdk/provider-stream";
|
||||
} from "openclaw/plugin-sdk/provider-moonshot";
|
||||
import { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
||||
import {
|
||||
applyMoonshotConfig,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { normalizeSecretInput } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
||||
import {
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInput,
|
||||
} from "openclaw/plugin-sdk/secret-input";
|
||||
|
||||
export const DEFAULT_TAVILY_BASE_URL = "https://api.tavily.com";
|
||||
export const DEFAULT_TAVILY_SEARCH_TIMEOUT_SECONDS = 30;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { jsonResult, readNumberParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
import {
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readStringParam,
|
||||
} from "openclaw/plugin-sdk/provider-web-search";
|
||||
import { runTavilyExtract } from "./tavily-client.js";
|
||||
|
||||
function optionalStringEnum<const T extends readonly string[]>(
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { jsonResult, readNumberParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
import {
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readStringParam,
|
||||
} from "openclaw/plugin-sdk/provider-web-search";
|
||||
import { runTavilySearch } from "./tavily-client.js";
|
||||
|
||||
function optionalStringEnum<const T extends readonly string[]>(
|
||||
|
||||
@@ -456,6 +456,10 @@
|
||||
"types": "./dist/plugin-sdk/provider-auth-api-key.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-auth-api-key.js"
|
||||
},
|
||||
"./plugin-sdk/provider-auth-result": {
|
||||
"types": "./dist/plugin-sdk/provider-auth-result.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-auth-result.js"
|
||||
},
|
||||
"./plugin-sdk/provider-auth-login": {
|
||||
"types": "./dist/plugin-sdk/provider-auth-login.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-auth-login.js"
|
||||
@@ -488,6 +492,10 @@
|
||||
"types": "./dist/plugin-sdk/provider-models.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-models.js"
|
||||
},
|
||||
"./plugin-sdk/provider-moonshot": {
|
||||
"types": "./dist/plugin-sdk/provider-moonshot.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-moonshot.js"
|
||||
},
|
||||
"./plugin-sdk/provider-onboard": {
|
||||
"types": "./dist/plugin-sdk/provider-onboard.d.ts",
|
||||
"default": "./dist/plugin-sdk/provider-onboard.js"
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
"nostr",
|
||||
"provider-auth",
|
||||
"provider-auth-api-key",
|
||||
"provider-auth-result",
|
||||
"provider-auth-login",
|
||||
"plugin-entry",
|
||||
"provider-catalog",
|
||||
@@ -112,6 +113,7 @@
|
||||
"provider-http",
|
||||
"provider-google",
|
||||
"provider-models",
|
||||
"provider-moonshot",
|
||||
"provider-onboard",
|
||||
"provider-stream",
|
||||
"provider-usage",
|
||||
|
||||
@@ -4,3 +4,11 @@ export { normalizeGoogleModelId } from "../agents/model-id-normalization.js";
|
||||
export { DEFAULT_GOOGLE_API_BASE_URL } from "../infra/google-api-base-url.js";
|
||||
export { normalizeGoogleApiBaseUrl } from "../infra/google-api-base-url.js";
|
||||
export { parseGeminiAuth } from "../infra/gemini-auth.js";
|
||||
export {
|
||||
createGoogleThinkingPayloadWrapper,
|
||||
sanitizeGoogleThinkingPayload,
|
||||
} from "../agents/pi-embedded-runner/google-stream-wrappers.js";
|
||||
export {
|
||||
applyGoogleGeminiModelDefault,
|
||||
GOOGLE_GEMINI_DEFAULT_MODEL,
|
||||
} from "../plugins/provider-model-defaults.js";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Public Moonshot provider helpers shared by bundled Moonshot extensions.
|
||||
|
||||
export {
|
||||
createMoonshotThinkingWrapper,
|
||||
resolveMoonshotThinkingType,
|
||||
} from "../agents/pi-embedded-runner/moonshot-stream-wrappers.js";
|
||||
@@ -5,7 +5,12 @@ import type {
|
||||
WebSearchProviderPlugin,
|
||||
WebSearchProviderToolDefinition,
|
||||
} from "../plugins/types.js";
|
||||
export { readNumberParam, readStringArrayParam, readStringParam } from "../agents/tools/common.js";
|
||||
export {
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readStringArrayParam,
|
||||
readStringParam,
|
||||
} from "../agents/tools/common.js";
|
||||
export { resolveCitationRedirectUrl } from "../agents/tools/web-search-citation-redirect.js";
|
||||
export {
|
||||
buildSearchCacheKey,
|
||||
@@ -41,6 +46,7 @@ export {
|
||||
export type { SearchConfigRecord } from "../agents/tools/web-search-provider-common.js";
|
||||
export { resolveWebSearchProviderCredential } from "../agents/tools/web-search-provider-credentials.js";
|
||||
export { withTrustedWebToolsEndpoint } from "../agents/tools/web-guarded-fetch.js";
|
||||
export { markdownToText, truncateText } from "../agents/tools/web-fetch-utils.js";
|
||||
export {
|
||||
DEFAULT_CACHE_TTL_MINUTES,
|
||||
DEFAULT_TIMEOUT_SECONDS,
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInputString,
|
||||
} from "../config/types.secrets.js";
|
||||
import { normalizeSecretInput } from "../utils/normalize-secret-input.js";
|
||||
import { buildSecretInputSchema } from "./secret-input-schema.js";
|
||||
|
||||
export type { SecretInput } from "../config/types.secrets.js";
|
||||
@@ -11,6 +12,7 @@ export {
|
||||
buildSecretInputSchema,
|
||||
hasConfiguredSecretInput,
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInput,
|
||||
normalizeSecretInputString,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user