refactor: untangle remaining plugin sdk boundaries

This commit is contained in:
Peter Steinberger
2026-03-16 21:13:56 -07:00
parent afc0172cb1
commit 9ebe38b6e3
492 changed files with 5657 additions and 2877 deletions

View File

@@ -2,7 +2,7 @@ import {
detectZaiEndpoint as detectZaiEndpointCore,
type ZaiDetectedEndpoint,
type ZaiEndpointId,
} from "../../src/commands/zai-endpoint-detect.js";
} from "openclaw/plugin-sdk/zai";
type DetectZaiEndpointFn = typeof detectZaiEndpointCore;

View File

@@ -10,23 +10,21 @@ import {
type ProviderResolveDynamicModelContext,
type ProviderRuntimeModel,
} from "openclaw/plugin-sdk/core";
import { upsertAuthProfile } from "../../src/agents/auth-profiles.js";
import { DEFAULT_CONTEXT_TOKENS } from "../../src/agents/defaults.js";
import { normalizeModelCompat } from "../../src/agents/model-compat.js";
import { createZaiToolStreamWrapper } from "../../src/agents/pi-embedded-runner/zai-stream-wrappers.js";
import { resolveRequiredHomeDir } from "openclaw/plugin-sdk/infra-runtime";
import {
applyAuthProfileConfig,
buildApiKeyCredential,
ensureApiKeyFromOptionEnvOrPrompt,
normalizeApiKeyInput,
normalizeOptionalSecretInput,
type SecretInput,
upsertAuthProfile,
validateApiKeyInput,
} from "../../src/commands/auth-choice.api-key.js";
import { ensureApiKeyFromOptionEnvOrPrompt } from "../../src/commands/auth-choice.apply-helpers.js";
import { buildApiKeyCredential } from "../../src/commands/auth-credentials.js";
import { applyAuthProfileConfig } from "../../src/commands/onboard-auth.js";
import type { SecretInput } from "../../src/config/types.secrets.js";
import { resolveRequiredHomeDir } from "../../src/infra/home-dir.js";
import { fetchZaiUsage } from "../../src/infra/provider-usage.fetch.js";
import { normalizeOptionalSecretInput } from "../../src/utils/normalize-secret-input.js";
} from "openclaw/plugin-sdk/provider-auth";
import { DEFAULT_CONTEXT_TOKENS, normalizeModelCompat } from "openclaw/plugin-sdk/provider-models";
import { createZaiToolStreamWrapper } from "openclaw/plugin-sdk/provider-stream";
import { fetchZaiUsage } from "openclaw/plugin-sdk/provider-usage";
import { detectZaiEndpoint, type ZaiEndpointId } from "./detect.js";
import { zaiMediaUnderstandingProvider } from "./media-understanding-provider.js";
import { applyZaiConfig, applyZaiProviderConfig, ZAI_DEFAULT_MODEL_REF } from "./onboard.js";
const PROVIDER_ID = "zai";
@@ -335,7 +333,6 @@ const zaiPlugin = {
fetchUsageSnapshot: async (ctx) => await fetchZaiUsage(ctx.token, ctx.timeoutMs, ctx.fetchFn),
isCacheTtlEligible: () => true,
});
api.registerMediaUnderstandingProvider(zaiMediaUnderstandingProvider);
},
};

View File

@@ -1,16 +1,15 @@
import {
applyAgentDefaultModelPrimary,
applyProviderConfigWithModelCatalog,
} from "../../src/commands/onboard-auth.config-shared.js";
import type { OpenClawConfig } from "../../src/config/config.js";
import {
buildZaiModelDefinition,
resolveZaiBaseUrl,
ZAI_DEFAULT_MODEL_ID,
ZAI_DEFAULT_MODEL_REF,
} from "./model-definitions.js";
} from "openclaw/plugin-sdk/provider-models";
import {
applyAgentDefaultModelPrimary,
applyProviderConfigWithModelCatalog,
type OpenClawConfig,
} from "openclaw/plugin-sdk/provider-onboard";
export { ZAI_DEFAULT_MODEL_REF };
export const ZAI_DEFAULT_MODEL_REF = `zai/${ZAI_DEFAULT_MODEL_ID}`;
const ZAI_DEFAULT_MODELS = [
buildZaiModelDefinition({ id: "glm-5" }),