forked from bai/curriculum-project-hub
refactor(hub): role 改为数据条目,不再是写死的闭集枚举
ADR-0017 说 role-based routing 是 product/admin config,不是 spec invariant。 之前 RunRole = "draft"|"review"|"triage" 闭集违反这条——role 钉死在代码里, 教师/admin 无法自定义。改为: - RoleEntry(id+label+defaultModel)是数据,registry 持有 role 集合 - roleId 退化为 string,新 role 是配置改动不是代码改动 - runner 不再带 role 字段(model 已由 caller resolve 好传入,role 透传无意义) - 未知 role 优雅降级到首个启用 model,不抛 tsc --noEmit rc=0;role-as-data + ADR-0003 不变式 smoke 通过。
This commit is contained in:
+5
-3
@@ -24,7 +24,11 @@ function main(): void {
|
||||
{ id: "z-ai/glm-4.6", label: "GLM-4.6", toolCapable: true },
|
||||
{ id: "anthropic/claude-3.5-sonnet", label: "Claude 3.5 Sonnet", toolCapable: true },
|
||||
],
|
||||
{ draft: "z-ai/glm-4.6", review: "anthropic/claude-3.5-sonnet" },
|
||||
[
|
||||
// Roles are data here — admin/teachers add presets, not code changes.
|
||||
{ id: "draft", label: "草稿", defaultModel: "z-ai/glm-4.6" },
|
||||
{ id: "review", label: "审校", defaultModel: "anthropic/claude-3.5-sonnet" },
|
||||
],
|
||||
);
|
||||
|
||||
const tools = new ToolRegistry();
|
||||
@@ -36,11 +40,9 @@ function main(): void {
|
||||
);
|
||||
|
||||
const model = models.resolve(undefined, "draft");
|
||||
|
||||
runAgent(provider, tools, {
|
||||
prompt: "ping",
|
||||
model,
|
||||
role: "draft",
|
||||
project: {
|
||||
projectId: "proj-skeleton",
|
||||
boundChatId: "chat-skeleton",
|
||||
|
||||
Reference in New Issue
Block a user