mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 22:15:57 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
8
openclaw/extensions/volcengine/api.ts
Normal file
8
openclaw/extensions/volcengine/api.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export { buildDoubaoCodingProvider, buildDoubaoProvider } from "./provider-catalog.js";
|
||||
export {
|
||||
buildDoubaoModelDefinition,
|
||||
DOUBAO_BASE_URL,
|
||||
DOUBAO_CODING_BASE_URL,
|
||||
DOUBAO_CODING_MODEL_CATALOG,
|
||||
DOUBAO_MODEL_CATALOG,
|
||||
} from "./models.js";
|
||||
47
openclaw/extensions/volcengine/index.test.ts
Normal file
47
openclaw/extensions/volcengine/index.test.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { registerSingleProviderPlugin } from "../../test/helpers/plugins/plugin-registration.js";
|
||||
import plugin from "./index.js";
|
||||
import { DOUBAO_CODING_MODEL_CATALOG, DOUBAO_MODEL_CATALOG } from "./models.js";
|
||||
|
||||
describe("volcengine plugin", () => {
|
||||
it("augments the catalog with bundled standard and plan models", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
const entries = await provider.augmentModelCatalog?.({
|
||||
env: process.env,
|
||||
entries: [],
|
||||
} as never);
|
||||
|
||||
expect(entries).toContainEqual(
|
||||
expect.objectContaining({
|
||||
provider: "volcengine",
|
||||
id: DOUBAO_MODEL_CATALOG[0].id,
|
||||
name: DOUBAO_MODEL_CATALOG[0].name,
|
||||
reasoning: DOUBAO_MODEL_CATALOG[0].reasoning,
|
||||
input: [...DOUBAO_MODEL_CATALOG[0].input],
|
||||
contextWindow: DOUBAO_MODEL_CATALOG[0].contextWindow,
|
||||
}),
|
||||
);
|
||||
expect(entries).toContainEqual(
|
||||
expect.objectContaining({
|
||||
provider: "volcengine-plan",
|
||||
id: DOUBAO_CODING_MODEL_CATALOG[0].id,
|
||||
name: DOUBAO_CODING_MODEL_CATALOG[0].name,
|
||||
reasoning: DOUBAO_CODING_MODEL_CATALOG[0].reasoning,
|
||||
input: [...DOUBAO_CODING_MODEL_CATALOG[0].input],
|
||||
contextWindow: DOUBAO_CODING_MODEL_CATALOG[0].contextWindow,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("declares its coding provider auth alias in the manifest", () => {
|
||||
const pluginJson = JSON.parse(
|
||||
readFileSync(resolve(import.meta.dirname, "openclaw.plugin.json"), "utf-8"),
|
||||
);
|
||||
|
||||
expect(pluginJson.providerAuthAliases).toEqual({
|
||||
"volcengine-plan": "volcengine",
|
||||
});
|
||||
});
|
||||
});
|
||||
82
openclaw/extensions/volcengine/index.ts
Normal file
82
openclaw/extensions/volcengine/index.ts
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
||||
import { ensureModelAllowlistEntry } from "openclaw/plugin-sdk/provider-onboard";
|
||||
import { DOUBAO_CODING_MODEL_CATALOG, DOUBAO_MODEL_CATALOG } from "./models.js";
|
||||
import { buildDoubaoCodingProvider, buildDoubaoProvider } from "./provider-catalog.js";
|
||||
|
||||
const PROVIDER_ID = "volcengine";
|
||||
const VOLCENGINE_DEFAULT_MODEL_REF = "volcengine-plan/ark-code-latest";
|
||||
|
||||
export default definePluginEntry({
|
||||
id: PROVIDER_ID,
|
||||
name: "Volcengine Provider",
|
||||
description: "Bundled Volcengine provider plugin",
|
||||
register(api) {
|
||||
api.registerProvider({
|
||||
id: PROVIDER_ID,
|
||||
label: "Volcengine",
|
||||
docsPath: "/concepts/model-providers#volcano-engine-doubao",
|
||||
envVars: ["VOLCANO_ENGINE_API_KEY"],
|
||||
auth: [
|
||||
createProviderApiKeyAuthMethod({
|
||||
providerId: PROVIDER_ID,
|
||||
methodId: "api-key",
|
||||
label: "Volcano Engine API key",
|
||||
hint: "API key",
|
||||
optionKey: "volcengineApiKey",
|
||||
flagName: "--volcengine-api-key",
|
||||
envVar: "VOLCANO_ENGINE_API_KEY",
|
||||
promptMessage: "Enter Volcano Engine API key",
|
||||
defaultModel: VOLCENGINE_DEFAULT_MODEL_REF,
|
||||
expectedProviders: ["volcengine"],
|
||||
applyConfig: (cfg) =>
|
||||
ensureModelAllowlistEntry({
|
||||
cfg,
|
||||
modelRef: VOLCENGINE_DEFAULT_MODEL_REF,
|
||||
}),
|
||||
wizard: {
|
||||
choiceId: "volcengine-api-key",
|
||||
choiceLabel: "Volcano Engine API key",
|
||||
groupId: "volcengine",
|
||||
groupLabel: "Volcano Engine",
|
||||
groupHint: "API key",
|
||||
},
|
||||
}),
|
||||
],
|
||||
catalog: {
|
||||
order: "paired",
|
||||
run: async (ctx) => {
|
||||
const apiKey = ctx.resolveProviderApiKey(PROVIDER_ID).apiKey;
|
||||
if (!apiKey) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
providers: {
|
||||
volcengine: { ...buildDoubaoProvider(), apiKey },
|
||||
"volcengine-plan": { ...buildDoubaoCodingProvider(), apiKey },
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
augmentModelCatalog: () => {
|
||||
const volcengineModels = DOUBAO_MODEL_CATALOG.map((entry) => ({
|
||||
provider: "volcengine",
|
||||
id: entry.id,
|
||||
name: entry.name,
|
||||
reasoning: entry.reasoning,
|
||||
input: [...entry.input],
|
||||
contextWindow: entry.contextWindow,
|
||||
}));
|
||||
const volcenginePlanModels = DOUBAO_CODING_MODEL_CATALOG.map((entry) => ({
|
||||
provider: "volcengine-plan",
|
||||
id: entry.id,
|
||||
name: entry.name,
|
||||
reasoning: entry.reasoning,
|
||||
input: [...entry.input],
|
||||
contextWindow: entry.contextWindow,
|
||||
}));
|
||||
return [...volcengineModels, ...volcenginePlanModels];
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
70
openclaw/extensions/volcengine/models.ts
Normal file
70
openclaw/extensions/volcengine/models.ts
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import {
|
||||
buildVolcModelDefinition,
|
||||
VOLC_MODEL_GLM_4_7,
|
||||
VOLC_MODEL_KIMI_K2_5,
|
||||
VOLC_SHARED_CODING_MODEL_CATALOG,
|
||||
} from "openclaw/plugin-sdk/volc-model-catalog-shared";
|
||||
|
||||
export const DOUBAO_BASE_URL = "https://ark.cn-beijing.volces.com/api/v3";
|
||||
export const DOUBAO_CODING_BASE_URL = "https://ark.cn-beijing.volces.com/api/coding/v3";
|
||||
export const DOUBAO_DEFAULT_MODEL_ID = "doubao-seed-1-8-251228";
|
||||
export const DOUBAO_CODING_DEFAULT_MODEL_ID = "ark-code-latest";
|
||||
export const DOUBAO_DEFAULT_MODEL_REF = `volcengine/${DOUBAO_DEFAULT_MODEL_ID}`;
|
||||
|
||||
export const DOUBAO_DEFAULT_COST = {
|
||||
input: 0.0001,
|
||||
output: 0.0002,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
};
|
||||
|
||||
export const DOUBAO_MODEL_CATALOG = [
|
||||
{
|
||||
id: "doubao-seed-code-preview-251028",
|
||||
name: "doubao-seed-code-preview-251028",
|
||||
reasoning: false,
|
||||
input: ["text", "image"] as const,
|
||||
contextWindow: 256000,
|
||||
maxTokens: 4096,
|
||||
},
|
||||
{
|
||||
id: "doubao-seed-1-8-251228",
|
||||
name: "Doubao Seed 1.8",
|
||||
reasoning: false,
|
||||
input: ["text", "image"] as const,
|
||||
contextWindow: 256000,
|
||||
maxTokens: 4096,
|
||||
},
|
||||
VOLC_MODEL_KIMI_K2_5,
|
||||
VOLC_MODEL_GLM_4_7,
|
||||
{
|
||||
id: "deepseek-v3-2-251201",
|
||||
name: "DeepSeek V3.2",
|
||||
reasoning: false,
|
||||
input: ["text", "image"] as const,
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const DOUBAO_CODING_MODEL_CATALOG = [
|
||||
...VOLC_SHARED_CODING_MODEL_CATALOG,
|
||||
{
|
||||
id: "doubao-seed-code-preview-251028",
|
||||
name: "Doubao Seed Code Preview",
|
||||
reasoning: false,
|
||||
input: ["text"] as const,
|
||||
contextWindow: 256000,
|
||||
maxTokens: 4096,
|
||||
},
|
||||
] as const;
|
||||
|
||||
export type DoubaoCatalogEntry = (typeof DOUBAO_MODEL_CATALOG)[number];
|
||||
export type DoubaoCodingCatalogEntry = (typeof DOUBAO_CODING_MODEL_CATALOG)[number];
|
||||
|
||||
export function buildDoubaoModelDefinition(
|
||||
entry: DoubaoCatalogEntry | DoubaoCodingCatalogEntry,
|
||||
): ModelDefinitionConfig {
|
||||
return buildVolcModelDefinition(entry, DOUBAO_DEFAULT_COST);
|
||||
}
|
||||
31
openclaw/extensions/volcengine/openclaw.plugin.json
Normal file
31
openclaw/extensions/volcengine/openclaw.plugin.json
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"id": "volcengine",
|
||||
"enabledByDefault": true,
|
||||
"providers": ["volcengine", "volcengine-plan"],
|
||||
"providerAuthEnvVars": {
|
||||
"volcengine": ["VOLCANO_ENGINE_API_KEY"]
|
||||
},
|
||||
"providerAuthAliases": {
|
||||
"volcengine-plan": "volcengine"
|
||||
},
|
||||
"providerAuthChoices": [
|
||||
{
|
||||
"provider": "volcengine",
|
||||
"method": "api-key",
|
||||
"choiceId": "volcengine-api-key",
|
||||
"choiceLabel": "Volcano Engine API key",
|
||||
"groupId": "volcengine",
|
||||
"groupLabel": "Volcano Engine",
|
||||
"groupHint": "API key",
|
||||
"optionKey": "volcengineApiKey",
|
||||
"cliFlag": "--volcengine-api-key",
|
||||
"cliOption": "--volcengine-api-key <key>",
|
||||
"cliDescription": "Volcano Engine API key"
|
||||
}
|
||||
],
|
||||
"configSchema": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
15
openclaw/extensions/volcengine/package.json
Normal file
15
openclaw/extensions/volcengine/package.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "@openclaw/volcengine-provider",
|
||||
"version": "2026.4.20",
|
||||
"private": true,
|
||||
"description": "OpenClaw Volcengine provider plugin",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@openclaw/plugin-sdk": "workspace:*"
|
||||
},
|
||||
"openclaw": {
|
||||
"extensions": [
|
||||
"./index.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
24
openclaw/extensions/volcengine/provider-catalog.ts
Normal file
24
openclaw/extensions/volcengine/provider-catalog.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import {
|
||||
buildDoubaoModelDefinition,
|
||||
DOUBAO_BASE_URL,
|
||||
DOUBAO_CODING_BASE_URL,
|
||||
DOUBAO_CODING_MODEL_CATALOG,
|
||||
DOUBAO_MODEL_CATALOG,
|
||||
} from "./models.js";
|
||||
|
||||
export function buildDoubaoProvider(): ModelProviderConfig {
|
||||
return {
|
||||
baseUrl: DOUBAO_BASE_URL,
|
||||
api: "openai-completions",
|
||||
models: DOUBAO_MODEL_CATALOG.map(buildDoubaoModelDefinition),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildDoubaoCodingProvider(): ModelProviderConfig {
|
||||
return {
|
||||
baseUrl: DOUBAO_CODING_BASE_URL,
|
||||
api: "openai-completions",
|
||||
models: DOUBAO_CODING_MODEL_CATALOG.map(buildDoubaoModelDefinition),
|
||||
};
|
||||
}
|
||||
16
openclaw/extensions/volcengine/tsconfig.json
Normal file
16
openclaw/extensions/volcengine/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"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue