feat: enhance role-tier structure for models and update related configurations

This commit is contained in:
Lauren ten Hoor
2026-02-11 01:49:14 +08:00
parent b249217bc1
commit 2450181482
8 changed files with 174 additions and 127 deletions

View File

@@ -18,56 +18,113 @@ export function createSetupTool(api: OpenClawPluginApi) {
parameters: {
type: "object",
properties: {
newAgentName: { type: "string", description: "Create a new agent. Omit to configure current workspace." },
channelBinding: { type: "string", enum: ["telegram", "whatsapp"], description: "Channel to bind (optional, with newAgentName only)." },
migrateFrom: { type: "string", description: "Agent ID to migrate channel binding from. Check openclaw.json bindings first." },
newAgentName: {
type: "string",
description:
"Create a new agent. Omit to configure current workspace.",
},
channelBinding: {
type: "string",
enum: ["telegram", "whatsapp"],
description: "Channel to bind (optional, with newAgentName only).",
},
migrateFrom: {
type: "string",
description:
"Agent ID to migrate channel binding from. Check openclaw.json bindings first.",
},
models: {
type: "object", description: "Model overrides per role and tier.",
type: "object",
description: "Model overrides per role and tier.",
properties: {
dev: {
type: "object", description: "Developer tier models",
type: "object",
description: "Developer tier models",
properties: {
junior: { type: "string", description: `Default: ${DEFAULT_MODELS.junior}` },
medior: { type: "string", description: `Default: ${DEFAULT_MODELS.medior}` },
senior: { type: "string", description: `Default: ${DEFAULT_MODELS.senior}` },
junior: {
type: "string",
description: `Default: ${DEFAULT_MODELS.junior}`,
},
medior: {
type: "string",
description: `Default: ${DEFAULT_MODELS.medior}`,
},
senior: {
type: "string",
description: `Default: ${DEFAULT_MODELS.senior}`,
},
},
},
qa: {
type: "object", description: "QA tier models",
type: "object",
description: "QA tier models",
properties: {
"qa-engineer": { type: "string", description: `Default: ${DEFAULT_MODELS["qa-engineer"]}` },
"manual-tester": { type: "string", description: `Default: ${DEFAULT_MODELS["manual-tester"]}` },
reviewer: {
type: "string",
description: `Default: ${DEFAULT_MODELS.reviewer}`,
},
tester: {
type: "string",
description: `Default: ${DEFAULT_MODELS.tester}`,
},
},
},
},
},
projectExecution: { type: "string", enum: ["parallel", "sequential"], description: "Project execution mode. Default: parallel." },
projectExecution: {
type: "string",
enum: ["parallel", "sequential"],
description: "Project execution mode. Default: parallel.",
},
},
},
async execute(_id: string, params: Record<string, unknown>) {
const result = await runSetup({
newAgentName: params.newAgentName as string | undefined,
channelBinding: (params.channelBinding as "telegram" | "whatsapp") ?? null,
channelBinding:
(params.channelBinding as "telegram" | "whatsapp") ?? null,
migrateFrom: params.migrateFrom as string | undefined,
agentId: params.newAgentName ? undefined : ctx.agentId,
workspacePath: params.newAgentName ? undefined : ctx.workspaceDir,
models: params.models as Partial<Record<Tier, string>> | undefined,
projectExecution: params.projectExecution as "parallel" | "sequential" | undefined,
projectExecution: params.projectExecution as
| "parallel"
| "sequential"
| undefined,
});
const lines = [
result.agentCreated ? `Agent "${result.agentId}" created` : `Configured "${result.agentId}"`,
result.agentCreated
? `Agent "${result.agentId}" created`
: `Configured "${result.agentId}"`,
"",
];
if (result.bindingMigrated) {
lines.push(`✅ Binding migrated: ${result.bindingMigrated.channel} (${result.bindingMigrated.from}${result.agentId})`, "");
lines.push(
`✅ Binding migrated: ${result.bindingMigrated.channel} (${result.bindingMigrated.from}${result.agentId})`,
"",
);
}
lines.push("Models:", ...ALL_TIERS.map((t) => ` ${t}: ${result.models[t]}`), "", "Files:", ...result.filesWritten.map((f) => ` ${f}`));
if (result.warnings.length > 0) lines.push("", "Warnings:", ...result.warnings.map((w) => ` ${w}`));
lines.push("", "Next: register a project, then create issues and pick them up.");
lines.push(
"Models:",
...ALL_TIERS.map((t) => ` ${t}: ${result.models[t]}`),
"",
"Files:",
...result.filesWritten.map((f) => ` ${f}`),
);
if (result.warnings.length > 0)
lines.push("", "Warnings:", ...result.warnings.map((w) => ` ${w}`));
lines.push(
"",
"Next: register a project, then create issues and pick them up.",
);
return jsonResult({ success: true, ...result, summary: lines.join("\n") });
return jsonResult({
success: true,
...result,
summary: lines.join("\n"),
});
},
});
}

View File

@@ -14,6 +14,7 @@ import { getWorker } from "../projects.js";
import { dispatchTask } from "../dispatch.js";
import { notify, getNotificationConfig } from "../notify.js";
import { findNextIssue, detectRoleFromLabel, detectTierFromLabels } from "../services/tick.js";
import { isDevTier } from "../tiers.js";
import { requireWorkspaceDir, resolveContext, resolveProject, resolveProvider, groupOnlyError, getPluginConfig, tickAndNotify } from "../tool-helpers.js";
export function createWorkStartTool(api: OpenClawPluginApi) {
@@ -83,8 +84,8 @@ export function createWorkStartTool(api: OpenClawPluginApi) {
} else {
const labelTier = detectTierFromLabels(issue.labels);
if (labelTier) {
if (role === "qa" && labelTier !== "qa") { selectedTier = "qa"; tierReason = `QA overrides "${labelTier}"`; tierSource = "role-override"; }
else if (role === "dev" && labelTier === "qa") { const s = selectTier(issue.title, issue.description ?? "", role); selectedTier = s.tier; tierReason = s.reason; tierSource = "heuristic"; }
if (role === "qa" && isDevTier(labelTier)) { const s = selectTier(issue.title, issue.description ?? "", role); selectedTier = s.tier; tierReason = `QA overrides dev tier "${labelTier}"`; tierSource = "role-override"; }
else if (role === "dev" && !isDevTier(labelTier)) { const s = selectTier(issue.title, issue.description ?? "", role); selectedTier = s.tier; tierReason = s.reason; tierSource = "heuristic"; }
else { selectedTier = labelTier; tierReason = `Label: "${labelTier}"`; tierSource = "label"; }
} else {
const s = selectTier(issue.title, issue.description ?? "", role);