Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
12
extensions/stepfun/README.md
Normal file
12
extensions/stepfun/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# OpenClaw StepFun Provider
|
||||
|
||||
Official OpenClaw provider plugin for StepFun.
|
||||
|
||||
Install from OpenClaw:
|
||||
|
||||
```bash
|
||||
openclaw plugins install @openclaw/stepfun-provider
|
||||
openclaw gateway restart
|
||||
```
|
||||
|
||||
See <https://docs.openclaw.ai/providers/stepfun> for setup and configuration.
|
||||
65
extensions/stepfun/index.test.ts
Normal file
65
extensions/stepfun/index.test.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
// Stepfun tests cover index plugin behavior.
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import {
|
||||
registerProviderPlugin,
|
||||
requireRegisteredProvider,
|
||||
} from "openclaw/plugin-sdk/plugin-test-runtime";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import stepfunPlugin from "./index.js";
|
||||
|
||||
type StepFunManifest = {
|
||||
setup?: {
|
||||
providers?: Array<{
|
||||
id?: string;
|
||||
authMethods?: string[];
|
||||
envVars?: string[];
|
||||
}>;
|
||||
};
|
||||
providerAuthChoices?: Array<{
|
||||
provider?: string;
|
||||
method?: string;
|
||||
choiceId?: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
function readManifest(): StepFunManifest {
|
||||
return JSON.parse(readFileSync(resolve(import.meta.dirname, "openclaw.plugin.json"), "utf-8"));
|
||||
}
|
||||
|
||||
describe("stepfun provider registration", () => {
|
||||
it("keeps manifest auth choices aligned with runtime provider methods", async () => {
|
||||
const { providers } = await registerProviderPlugin({
|
||||
plugin: stepfunPlugin,
|
||||
id: "stepfun",
|
||||
name: "StepFun",
|
||||
});
|
||||
const manifest = readManifest();
|
||||
const runtimeChoices = ["stepfun", "stepfun-plan"].flatMap((providerId) => {
|
||||
const provider = requireRegisteredProvider(providers, providerId);
|
||||
return provider.auth.map((method) => ({
|
||||
provider: provider.id,
|
||||
method: method.id,
|
||||
choiceId: method.wizard?.choiceId,
|
||||
}));
|
||||
});
|
||||
|
||||
const manifestChoices = manifest.providerAuthChoices?.map((choice) => ({
|
||||
provider: choice.provider,
|
||||
method: choice.method,
|
||||
choiceId: choice.choiceId,
|
||||
}));
|
||||
|
||||
expect(runtimeChoices).toEqual(manifestChoices);
|
||||
expect(manifest.setup?.providers).toEqual([
|
||||
{
|
||||
id: "stepfun",
|
||||
envVars: ["STEPFUN_API_KEY"],
|
||||
},
|
||||
{
|
||||
id: "stepfun-plan",
|
||||
envVars: ["STEPFUN_API_KEY"],
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
253
extensions/stepfun/index.ts
Normal file
253
extensions/stepfun/index.ts
Normal file
@@ -0,0 +1,253 @@
|
||||
// Stepfun plugin entrypoint registers its OpenClaw integration.
|
||||
import {
|
||||
definePluginEntry,
|
||||
type OpenClawConfig,
|
||||
type ProviderCatalogContext,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
||||
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
import {
|
||||
applyStepFunPlanConfig,
|
||||
applyStepFunPlanConfigCn,
|
||||
applyStepFunStandardConfig,
|
||||
applyStepFunStandardConfigCn,
|
||||
} from "./onboard.js";
|
||||
import {
|
||||
buildStepFunPlanProvider,
|
||||
buildStepFunProvider,
|
||||
STEPFUN_DEFAULT_MODEL_REF,
|
||||
STEPFUN_PLAN_CN_BASE_URL,
|
||||
STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
||||
STEPFUN_PLAN_INTL_BASE_URL,
|
||||
STEPFUN_PLAN_PROVIDER_ID,
|
||||
STEPFUN_PROVIDER_ID,
|
||||
STEPFUN_STANDARD_CN_BASE_URL,
|
||||
STEPFUN_STANDARD_INTL_BASE_URL,
|
||||
} from "./provider-catalog.js";
|
||||
|
||||
type StepFunRegion = "cn" | "intl";
|
||||
type StepFunSurface = "standard" | "plan";
|
||||
|
||||
function trimExplicitBaseUrl(ctx: ProviderCatalogContext, providerId: string): string | undefined {
|
||||
const explicitProvider = ctx.config.models?.providers?.[providerId];
|
||||
const baseUrl =
|
||||
typeof explicitProvider?.baseUrl === "string" ? explicitProvider.baseUrl.trim() : "";
|
||||
return baseUrl || undefined;
|
||||
}
|
||||
|
||||
function inferRegionFromBaseUrl(baseUrl: string | undefined): StepFunRegion | undefined {
|
||||
if (!baseUrl) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
const host = normalizeLowercaseStringOrEmpty(new URL(baseUrl).hostname);
|
||||
if (host === "api.stepfun.com") {
|
||||
return "cn";
|
||||
}
|
||||
if (host === "api.stepfun.ai") {
|
||||
return "intl";
|
||||
}
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function inferRegionFromProfileId(profileId: string | undefined): StepFunRegion | undefined {
|
||||
if (!profileId) {
|
||||
return undefined;
|
||||
}
|
||||
if (profileId.includes(":cn")) {
|
||||
return "cn";
|
||||
}
|
||||
if (profileId.includes(":intl")) {
|
||||
return "intl";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function inferRegionFromEnv(env: NodeJS.ProcessEnv): StepFunRegion | undefined {
|
||||
// Shared env-only setup needs one stable fallback region.
|
||||
if (env.STEPFUN_API_KEY?.trim()) {
|
||||
return "intl";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function inferRegionFromExplicitBaseUrls(ctx: ProviderCatalogContext): StepFunRegion | undefined {
|
||||
return (
|
||||
inferRegionFromBaseUrl(trimExplicitBaseUrl(ctx, STEPFUN_PROVIDER_ID)) ??
|
||||
inferRegionFromBaseUrl(trimExplicitBaseUrl(ctx, STEPFUN_PLAN_PROVIDER_ID))
|
||||
);
|
||||
}
|
||||
|
||||
function resolveDefaultBaseUrl(surface: StepFunSurface, region: StepFunRegion): string {
|
||||
if (surface === "plan") {
|
||||
return region === "cn" ? STEPFUN_PLAN_CN_BASE_URL : STEPFUN_PLAN_INTL_BASE_URL;
|
||||
}
|
||||
return region === "cn" ? STEPFUN_STANDARD_CN_BASE_URL : STEPFUN_STANDARD_INTL_BASE_URL;
|
||||
}
|
||||
|
||||
function resolveStepFunCatalog(
|
||||
ctx: ProviderCatalogContext,
|
||||
params: { providerId: string; surface: StepFunSurface },
|
||||
) {
|
||||
const auth = ctx.resolveProviderAuth(params.providerId);
|
||||
const apiKey = auth.apiKey ?? ctx.resolveProviderApiKey(params.providerId).apiKey;
|
||||
if (!apiKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const explicitBaseUrl = trimExplicitBaseUrl(ctx, params.providerId);
|
||||
const region =
|
||||
inferRegionFromBaseUrl(explicitBaseUrl) ??
|
||||
inferRegionFromExplicitBaseUrls(ctx) ??
|
||||
inferRegionFromProfileId(auth.profileId) ??
|
||||
inferRegionFromEnv(ctx.env);
|
||||
// Keep discovery working for legacy/manual auth profiles that resolved a
|
||||
// key but do not encode region in the profile id.
|
||||
const baseUrl = explicitBaseUrl ?? resolveDefaultBaseUrl(params.surface, region ?? "intl");
|
||||
return {
|
||||
provider:
|
||||
params.surface === "plan"
|
||||
? { ...buildStepFunPlanProvider(baseUrl), apiKey }
|
||||
: { ...buildStepFunProvider(baseUrl), apiKey },
|
||||
};
|
||||
}
|
||||
|
||||
function resolveProfileIds(region: StepFunRegion): [string, string] {
|
||||
return region === "cn"
|
||||
? ["stepfun:cn", "stepfun-plan:cn"]
|
||||
: ["stepfun:intl", "stepfun-plan:intl"];
|
||||
}
|
||||
|
||||
function createStepFunApiKeyMethod(params: {
|
||||
providerId: string;
|
||||
methodId: string;
|
||||
label: string;
|
||||
hint: string;
|
||||
region: StepFunRegion;
|
||||
promptMessage: string;
|
||||
defaultModel: string;
|
||||
choiceId: string;
|
||||
choiceLabel: string;
|
||||
choiceHint: string;
|
||||
applyConfig: (cfg: OpenClawConfig) => OpenClawConfig;
|
||||
}) {
|
||||
return createProviderApiKeyAuthMethod({
|
||||
providerId: params.providerId,
|
||||
methodId: params.methodId,
|
||||
label: params.label,
|
||||
hint: params.hint,
|
||||
optionKey: "stepfunApiKey",
|
||||
flagName: "--stepfun-api-key",
|
||||
envVar: "STEPFUN_API_KEY",
|
||||
promptMessage: params.promptMessage,
|
||||
profileIds: resolveProfileIds(params.region),
|
||||
allowProfile: false,
|
||||
defaultModel: params.defaultModel,
|
||||
expectedProviders: [STEPFUN_PROVIDER_ID, STEPFUN_PLAN_PROVIDER_ID],
|
||||
applyConfig: params.applyConfig,
|
||||
wizard: {
|
||||
choiceId: params.choiceId,
|
||||
choiceLabel: params.choiceLabel,
|
||||
choiceHint: params.choiceHint,
|
||||
groupId: "stepfun",
|
||||
groupLabel: "StepFun",
|
||||
groupHint: "Standard / Step Plan (China / Global)",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default definePluginEntry({
|
||||
id: STEPFUN_PROVIDER_ID,
|
||||
name: "StepFun",
|
||||
description: "Bundled StepFun standard and Step Plan provider plugin",
|
||||
register(api) {
|
||||
api.registerProvider({
|
||||
id: STEPFUN_PROVIDER_ID,
|
||||
label: "StepFun",
|
||||
docsPath: "/providers/stepfun",
|
||||
envVars: ["STEPFUN_API_KEY"],
|
||||
auth: [
|
||||
createStepFunApiKeyMethod({
|
||||
providerId: STEPFUN_PROVIDER_ID,
|
||||
methodId: "standard-api-key-cn",
|
||||
label: "StepFun Standard API key (China)",
|
||||
hint: "Endpoint: api.stepfun.com/v1",
|
||||
region: "cn",
|
||||
promptMessage: "Enter StepFun API key for China endpoints",
|
||||
defaultModel: STEPFUN_DEFAULT_MODEL_REF,
|
||||
choiceId: "stepfun-standard-api-key-cn",
|
||||
choiceLabel: "StepFun Standard API key (China)",
|
||||
choiceHint: "Endpoint: api.stepfun.com/v1",
|
||||
applyConfig: applyStepFunStandardConfigCn,
|
||||
}),
|
||||
createStepFunApiKeyMethod({
|
||||
providerId: STEPFUN_PROVIDER_ID,
|
||||
methodId: "standard-api-key-intl",
|
||||
label: "StepFun Standard API key (Global/Intl)",
|
||||
hint: "Endpoint: api.stepfun.ai/v1",
|
||||
region: "intl",
|
||||
promptMessage: "Enter StepFun API key for global endpoints",
|
||||
defaultModel: STEPFUN_DEFAULT_MODEL_REF,
|
||||
choiceId: "stepfun-standard-api-key-intl",
|
||||
choiceLabel: "StepFun Standard API key (Global/Intl)",
|
||||
choiceHint: "Endpoint: api.stepfun.ai/v1",
|
||||
applyConfig: applyStepFunStandardConfig,
|
||||
}),
|
||||
],
|
||||
catalog: {
|
||||
order: "paired",
|
||||
run: async (ctx) =>
|
||||
resolveStepFunCatalog(ctx, {
|
||||
providerId: STEPFUN_PROVIDER_ID,
|
||||
surface: "standard",
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
api.registerProvider({
|
||||
id: STEPFUN_PLAN_PROVIDER_ID,
|
||||
label: "StepFun Step Plan",
|
||||
docsPath: "/providers/stepfun",
|
||||
envVars: ["STEPFUN_API_KEY"],
|
||||
auth: [
|
||||
createStepFunApiKeyMethod({
|
||||
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
||||
methodId: "plan-api-key-cn",
|
||||
label: "StepFun Step Plan API key (China)",
|
||||
hint: "Endpoint: api.stepfun.com/step_plan/v1",
|
||||
region: "cn",
|
||||
promptMessage: "Enter StepFun API key for China endpoints",
|
||||
defaultModel: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
||||
choiceId: "stepfun-plan-api-key-cn",
|
||||
choiceLabel: "StepFun Step Plan API key (China)",
|
||||
choiceHint: "Endpoint: api.stepfun.com/step_plan/v1",
|
||||
applyConfig: applyStepFunPlanConfigCn,
|
||||
}),
|
||||
createStepFunApiKeyMethod({
|
||||
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
||||
methodId: "plan-api-key-intl",
|
||||
label: "StepFun Step Plan API key (Global/Intl)",
|
||||
hint: "Endpoint: api.stepfun.ai/step_plan/v1",
|
||||
region: "intl",
|
||||
promptMessage: "Enter StepFun API key for global endpoints",
|
||||
defaultModel: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
||||
choiceId: "stepfun-plan-api-key-intl",
|
||||
choiceLabel: "StepFun Step Plan API key (Global/Intl)",
|
||||
choiceHint: "Endpoint: api.stepfun.ai/step_plan/v1",
|
||||
applyConfig: applyStepFunPlanConfig,
|
||||
}),
|
||||
],
|
||||
catalog: {
|
||||
order: "paired",
|
||||
run: async (ctx) =>
|
||||
resolveStepFunCatalog(ctx, {
|
||||
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
||||
surface: "plan",
|
||||
}),
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
12
extensions/stepfun/npm-shrinkwrap.json
generated
Normal file
12
extensions/stepfun/npm-shrinkwrap.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@openclaw/stepfun-provider",
|
||||
"version": "2026.6.11",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@openclaw/stepfun-provider",
|
||||
"version": "2026.6.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
74
extensions/stepfun/onboard.ts
Normal file
74
extensions/stepfun/onboard.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
// Stepfun setup module handles plugin onboarding behavior.
|
||||
import {
|
||||
createModelCatalogPresetAppliers,
|
||||
type ModelProviderConfig,
|
||||
type OpenClawConfig,
|
||||
type ProviderOnboardPresetAppliers,
|
||||
} from "openclaw/plugin-sdk/provider-onboard";
|
||||
import {
|
||||
buildStepFunPlanProvider,
|
||||
buildStepFunProvider,
|
||||
STEPFUN_DEFAULT_MODEL_REF,
|
||||
STEPFUN_PLAN_CN_BASE_URL,
|
||||
STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
||||
STEPFUN_PLAN_INTL_BASE_URL,
|
||||
STEPFUN_PLAN_PROVIDER_ID,
|
||||
STEPFUN_PROVIDER_ID,
|
||||
STEPFUN_STANDARD_CN_BASE_URL,
|
||||
STEPFUN_STANDARD_INTL_BASE_URL,
|
||||
} from "./provider-catalog.js";
|
||||
|
||||
function createStepFunPresetAppliers(params: {
|
||||
providerId: string;
|
||||
primaryModelRef: string;
|
||||
alias: string;
|
||||
buildProvider: (baseUrl: string) => ModelProviderConfig;
|
||||
}): ProviderOnboardPresetAppliers<[string]> {
|
||||
return createModelCatalogPresetAppliers<[string]>({
|
||||
primaryModelRef: params.primaryModelRef,
|
||||
resolveParams: (_cfg: OpenClawConfig, baseUrl: string) => {
|
||||
const provider = params.buildProvider(baseUrl);
|
||||
const models = provider.models ?? [];
|
||||
return {
|
||||
providerId: params.providerId,
|
||||
api: provider.api ?? "openai-completions",
|
||||
baseUrl,
|
||||
catalogModels: models,
|
||||
aliases: [
|
||||
...models.map((model) => `${params.providerId}/${model.id}`),
|
||||
{ modelRef: params.primaryModelRef, alias: params.alias },
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const stepFunPresetAppliers = createStepFunPresetAppliers({
|
||||
providerId: STEPFUN_PROVIDER_ID,
|
||||
primaryModelRef: STEPFUN_DEFAULT_MODEL_REF,
|
||||
alias: "StepFun",
|
||||
buildProvider: buildStepFunProvider,
|
||||
});
|
||||
|
||||
const stepFunPlanPresetAppliers = createStepFunPresetAppliers({
|
||||
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
||||
primaryModelRef: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
||||
alias: "StepFun Plan",
|
||||
buildProvider: buildStepFunPlanProvider,
|
||||
});
|
||||
|
||||
export function applyStepFunStandardConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return stepFunPresetAppliers.applyConfig(cfg, STEPFUN_STANDARD_CN_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyStepFunStandardConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return stepFunPresetAppliers.applyConfig(cfg, STEPFUN_STANDARD_INTL_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyStepFunPlanConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return stepFunPlanPresetAppliers.applyConfig(cfg, STEPFUN_PLAN_CN_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyStepFunPlanConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return stepFunPlanPresetAppliers.applyConfig(cfg, STEPFUN_PLAN_INTL_BASE_URL);
|
||||
}
|
||||
147
extensions/stepfun/openclaw.plugin.json
Normal file
147
extensions/stepfun/openclaw.plugin.json
Normal file
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"id": "stepfun",
|
||||
"name": "StepFun",
|
||||
"activation": {
|
||||
"onStartup": false
|
||||
},
|
||||
"enabledByDefault": true,
|
||||
"providers": ["stepfun", "stepfun-plan"],
|
||||
"autoEnableWhenConfiguredProviders": ["stepfun", "stepfun-plan"],
|
||||
"setup": {
|
||||
"providers": [
|
||||
{
|
||||
"id": "stepfun",
|
||||
"envVars": ["STEPFUN_API_KEY"]
|
||||
},
|
||||
{
|
||||
"id": "stepfun-plan",
|
||||
"envVars": ["STEPFUN_API_KEY"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"modelCatalog": {
|
||||
"providers": {
|
||||
"stepfun": {
|
||||
"baseUrl": "https://api.stepfun.ai/v1",
|
||||
"api": "openai-completions",
|
||||
"models": [
|
||||
{
|
||||
"id": "step-3.5-flash",
|
||||
"name": "Step 3.5 Flash",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"stepfun-plan": {
|
||||
"baseUrl": "https://api.stepfun.ai/step_plan/v1",
|
||||
"api": "openai-completions",
|
||||
"models": [
|
||||
{
|
||||
"id": "step-3.5-flash",
|
||||
"name": "Step 3.5 Flash",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "step-3.5-flash-2603",
|
||||
"name": "Step 3.5 Flash 2603",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"discovery": {
|
||||
"stepfun": "static",
|
||||
"stepfun-plan": "static"
|
||||
}
|
||||
},
|
||||
"providerAuthChoices": [
|
||||
{
|
||||
"provider": "stepfun",
|
||||
"method": "standard-api-key-cn",
|
||||
"choiceId": "stepfun-standard-api-key-cn",
|
||||
"choiceLabel": "StepFun Standard API key (China)",
|
||||
"choiceHint": "Endpoint: api.stepfun.com/v1",
|
||||
"groupId": "stepfun",
|
||||
"groupLabel": "StepFun",
|
||||
"groupHint": "Standard / Step Plan (China / Global)",
|
||||
"optionKey": "stepfunApiKey",
|
||||
"cliFlag": "--stepfun-api-key",
|
||||
"cliOption": "--stepfun-api-key <key>",
|
||||
"cliDescription": "StepFun API key"
|
||||
},
|
||||
{
|
||||
"provider": "stepfun",
|
||||
"method": "standard-api-key-intl",
|
||||
"choiceId": "stepfun-standard-api-key-intl",
|
||||
"choiceLabel": "StepFun Standard API key (Global/Intl)",
|
||||
"choiceHint": "Endpoint: api.stepfun.ai/v1",
|
||||
"groupId": "stepfun",
|
||||
"groupLabel": "StepFun",
|
||||
"groupHint": "Standard / Step Plan (China / Global)",
|
||||
"optionKey": "stepfunApiKey",
|
||||
"cliFlag": "--stepfun-api-key",
|
||||
"cliOption": "--stepfun-api-key <key>",
|
||||
"cliDescription": "StepFun API key"
|
||||
},
|
||||
{
|
||||
"provider": "stepfun-plan",
|
||||
"method": "plan-api-key-cn",
|
||||
"choiceId": "stepfun-plan-api-key-cn",
|
||||
"choiceLabel": "StepFun Step Plan API key (China)",
|
||||
"choiceHint": "Endpoint: api.stepfun.com/step_plan/v1",
|
||||
"groupId": "stepfun",
|
||||
"groupLabel": "StepFun",
|
||||
"groupHint": "Standard / Step Plan (China / Global)",
|
||||
"optionKey": "stepfunApiKey",
|
||||
"cliFlag": "--stepfun-api-key",
|
||||
"cliOption": "--stepfun-api-key <key>",
|
||||
"cliDescription": "StepFun API key"
|
||||
},
|
||||
{
|
||||
"provider": "stepfun-plan",
|
||||
"method": "plan-api-key-intl",
|
||||
"choiceId": "stepfun-plan-api-key-intl",
|
||||
"choiceLabel": "StepFun Step Plan API key (Global/Intl)",
|
||||
"choiceHint": "Endpoint: api.stepfun.ai/step_plan/v1",
|
||||
"groupId": "stepfun",
|
||||
"groupLabel": "StepFun",
|
||||
"groupHint": "Standard / Step Plan (China / Global)",
|
||||
"optionKey": "stepfunApiKey",
|
||||
"cliFlag": "--stepfun-api-key",
|
||||
"cliOption": "--stepfun-api-key <key>",
|
||||
"cliDescription": "StepFun API key"
|
||||
}
|
||||
],
|
||||
"configSchema": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
35
extensions/stepfun/package.json
Normal file
35
extensions/stepfun/package.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@openclaw/stepfun-provider",
|
||||
"version": "2026.6.11",
|
||||
"description": "OpenClaw StepFun provider plugin.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/openclaw/openclaw"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@openclaw/plugin-sdk": "workspace:*"
|
||||
},
|
||||
"openclaw": {
|
||||
"extensions": [
|
||||
"./index.ts"
|
||||
],
|
||||
"install": {
|
||||
"clawhubSpec": "clawhub:@openclaw/stepfun-provider",
|
||||
"npmSpec": "@openclaw/stepfun-provider",
|
||||
"defaultChoice": "npm",
|
||||
"minHostVersion": ">=2026.6.9"
|
||||
},
|
||||
"compat": {
|
||||
"pluginApi": ">=2026.6.11"
|
||||
},
|
||||
"build": {
|
||||
"openclawVersion": "2026.6.11",
|
||||
"bundledDist": false
|
||||
},
|
||||
"release": {
|
||||
"publishToClawHub": true,
|
||||
"publishToNpm": true
|
||||
}
|
||||
}
|
||||
}
|
||||
41
extensions/stepfun/provider-catalog.ts
Normal file
41
extensions/stepfun/provider-catalog.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
// Stepfun provider module implements model/runtime integration.
|
||||
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
||||
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
||||
|
||||
export const STEPFUN_PROVIDER_ID = "stepfun";
|
||||
export const STEPFUN_PLAN_PROVIDER_ID = "stepfun-plan";
|
||||
|
||||
export const STEPFUN_STANDARD_CN_BASE_URL = "https://api.stepfun.com/v1";
|
||||
export const STEPFUN_STANDARD_INTL_BASE_URL = "https://api.stepfun.ai/v1";
|
||||
export const STEPFUN_PLAN_CN_BASE_URL = "https://api.stepfun.com/step_plan/v1";
|
||||
export const STEPFUN_PLAN_INTL_BASE_URL = "https://api.stepfun.ai/step_plan/v1";
|
||||
|
||||
const STEPFUN_DEFAULT_MODEL_ID = "step-3.5-flash";
|
||||
export const STEPFUN_DEFAULT_MODEL_REF = `${STEPFUN_PROVIDER_ID}/${STEPFUN_DEFAULT_MODEL_ID}`;
|
||||
export const STEPFUN_PLAN_DEFAULT_MODEL_REF = `${STEPFUN_PLAN_PROVIDER_ID}/${STEPFUN_DEFAULT_MODEL_ID}`;
|
||||
|
||||
type StepFunManifestProviderId = keyof typeof manifest.modelCatalog.providers;
|
||||
|
||||
function buildStepFunManifestProvider(
|
||||
providerId: StepFunManifestProviderId,
|
||||
baseUrl: string,
|
||||
): ModelProviderConfig {
|
||||
const provider = buildManifestModelProviderConfig({
|
||||
providerId,
|
||||
catalog: manifest.modelCatalog.providers[providerId],
|
||||
});
|
||||
return provider.baseUrl === baseUrl ? provider : { ...provider, baseUrl };
|
||||
}
|
||||
|
||||
export function buildStepFunProvider(
|
||||
baseUrl: string = STEPFUN_STANDARD_INTL_BASE_URL,
|
||||
): ModelProviderConfig {
|
||||
return buildStepFunManifestProvider(STEPFUN_PROVIDER_ID, baseUrl);
|
||||
}
|
||||
|
||||
export function buildStepFunPlanProvider(
|
||||
baseUrl: string = STEPFUN_PLAN_INTL_BASE_URL,
|
||||
): ModelProviderConfig {
|
||||
return buildStepFunManifestProvider(STEPFUN_PLAN_PROVIDER_ID, baseUrl);
|
||||
}
|
||||
16
extensions/stepfun/tsconfig.json
Normal file
16
extensions/stepfun/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../tsconfig.package-boundary.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./*.ts", "./src/**/*.ts"],
|
||||
"exclude": [
|
||||
"./**/*.test.ts",
|
||||
"./dist/**",
|
||||
"./node_modules/**",
|
||||
"./src/test-support/**",
|
||||
"./src/**/*test-helpers.ts",
|
||||
"./src/**/*test-harness.ts",
|
||||
"./src/**/*test-support.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user