mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-18 08:31:49 -06:00
ae4806ed9a
Summary: - Merged feat(plugins): add embedding provider contract after ClawSweeper review. Automerge notes: - PR branch already contained follow-up commit before automerge: chore(plugins): refresh embedding provider sdk baseline - PR branch already contained follow-up commit before automerge: docs(plugins): document embedding provider contract - PR branch already contained follow-up commit before automerge: fix(plugins): restore embedding providers after snapshot loads - PR branch already contained follow-up commit before automerge: fix(plugins): resolve embedding providers from manifests - PR branch already contained follow-up commit before automerge: fix(plugin-sdk): keep embedding provider registry mutators internal - PR branch already contained follow-up commit before automerge: chore(plugin-sdk): refresh embedding provider API baseline Validation: - ClawSweeper review passed for head41ebd66ab4. - Required merge gates passed before the squash merge. Prepared head SHA:41ebd66ab4Review: https://github.com/openclaw/openclaw/pull/84947#issuecomment-4514762026 Co-authored-by: Bob <dutifulbob@gmail.com> Co-authored-by: Mariano Belinky <mbelinky@gmail.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: osolmaz Co-authored-by: osolmaz <2453968+osolmaz@users.noreply.github.com>
101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
import {
|
|
attachPluginApiFacades,
|
|
type OpenClawPluginApiWithoutFacades,
|
|
} from "../plugins/api-facades.js";
|
|
import type { OpenClawPluginApi } from "./plugin-runtime.js";
|
|
|
|
export type TestPluginApiInput = Partial<OpenClawPluginApi>;
|
|
|
|
export function createTestPluginApi(api: TestPluginApiInput = {}): OpenClawPluginApi {
|
|
const { agent, lifecycle, runContext, session, ...flatApi } = api;
|
|
const mergedApi = {
|
|
id: "test-plugin",
|
|
name: "test-plugin",
|
|
source: "test",
|
|
registrationMode: "full",
|
|
config: {},
|
|
runtime: {} as OpenClawPluginApi["runtime"],
|
|
logger: { info() {}, warn() {}, error() {}, debug() {} },
|
|
registerTool() {},
|
|
registerHook() {},
|
|
registerHttpRoute() {},
|
|
registerHostedMediaResolver() {},
|
|
registerChannel() {},
|
|
registerGatewayMethod() {},
|
|
registerCli() {},
|
|
registerNodeCliFeature() {},
|
|
registerCliBackend() {},
|
|
registerTextTransforms() {},
|
|
registerService() {},
|
|
registerGatewayDiscoveryService() {},
|
|
registerReload() {},
|
|
registerNodeHostCommand() {},
|
|
registerNodeInvokePolicy() {},
|
|
registerSecurityAuditCollector() {},
|
|
registerConfigMigration() {},
|
|
registerMigrationProvider() {},
|
|
registerAutoEnableProbe() {},
|
|
registerProvider() {},
|
|
registerModelCatalogProvider() {},
|
|
registerEmbeddingProvider() {},
|
|
registerSpeechProvider() {},
|
|
registerRealtimeTranscriptionProvider() {},
|
|
registerRealtimeVoiceProvider() {},
|
|
registerMediaUnderstandingProvider() {},
|
|
registerImageGenerationProvider() {},
|
|
registerMusicGenerationProvider() {},
|
|
registerVideoGenerationProvider() {},
|
|
registerWebFetchProvider() {},
|
|
registerWebSearchProvider() {},
|
|
registerInteractiveHandler() {},
|
|
onConversationBindingResolved() {},
|
|
registerCommand() {},
|
|
registerContextEngine() {},
|
|
registerCompactionProvider() {},
|
|
registerAgentHarness() {},
|
|
registerCodexAppServerExtensionFactory() {},
|
|
registerAgentToolResultMiddleware() {},
|
|
registerDetachedTaskRuntime() {},
|
|
registerSessionExtension() {},
|
|
enqueueNextTurnInjection: async (injection) => ({
|
|
enqueued: false,
|
|
id: "",
|
|
sessionKey: injection.sessionKey,
|
|
}),
|
|
registerTrustedToolPolicy() {},
|
|
registerToolMetadata() {},
|
|
registerControlUiDescriptor() {},
|
|
registerRuntimeLifecycle() {},
|
|
registerAgentEventSubscription() {},
|
|
emitAgentEvent: () => ({ emitted: false as const, reason: "test api" }),
|
|
setRunContext: () => false,
|
|
getRunContext: () => undefined,
|
|
clearRunContext() {},
|
|
registerSessionSchedulerJob: () => undefined,
|
|
registerSessionAction() {},
|
|
sendSessionAttachment: async () => ({ ok: false, error: "test plugin api" }),
|
|
scheduleSessionTurn: async () => undefined,
|
|
unscheduleSessionTurnsByTag: async () => ({ removed: 0, failed: 0 }),
|
|
registerMemoryCapability() {},
|
|
registerMemoryPromptSection() {},
|
|
registerMemoryPromptSupplement() {},
|
|
registerMemoryCorpusSupplement() {},
|
|
registerMemoryFlushPlan() {},
|
|
registerMemoryRuntime() {},
|
|
registerMemoryEmbeddingProvider() {},
|
|
resolvePath(input: string) {
|
|
return input;
|
|
},
|
|
on() {},
|
|
...flatApi,
|
|
} as OpenClawPluginApiWithoutFacades;
|
|
const withFacades = attachPluginApiFacades(mergedApi);
|
|
return {
|
|
...withFacades,
|
|
...(agent ? { agent } : {}),
|
|
...(lifecycle ? { lifecycle } : {}),
|
|
...(runContext ? { runContext } : {}),
|
|
...(session ? { session } : {}),
|
|
};
|
|
}
|