Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

fix(web): let a SOP role choose any built-in CLI (#199)

crispinhu27b751e09b7dfe
diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml
index 30b6934c..af025a19 100644
--- a/docs/api/openapi.yaml
+++ b/docs/api/openapi.yaml
@@ -1965,7 +1965,7 @@ paths:
get:
tags: [Assets]
operationId: listExecutors
- description: Returns the fixed CodeBuddy, Codex, and Claude Code CLI catalog. Executors are not user-configurable.
+ description: Returns the read-only built-in CLI catalog. Executors are not user-configurable.
responses:
"200":
$ref: "#/components/responses/AssetList"
@@ -1975,7 +1975,7 @@ paths:
get:
tags: [Assets]
operationId: listExecutorModels
- description: Returns, per built-in CLI (codebuddy, codex, claude), the selectable model IDs, the default model and the reasoning-effort levels. An Agent's model should be one of these IDs.
+ description: Returns, per built-in CLI, the selectable model IDs, the default model and the reasoning-effort levels. An Agent's model should be one of these IDs.
responses:
"200":
description: Model catalog keyed by CLI id
diff --git a/docs/api/orchestration.md b/docs/api/orchestration.md
index 351fcc65..70f0c71c 100644
--- a/docs/api/orchestration.md
+++ b/docs/api/orchestration.md
@@ -22,7 +22,7 @@
}
```
-节点类型为 `agent|script|approval`。脚本节点通过 `scriptLanguage`(`shell|python`)和 `script` 配置;Agent 节点只引用角色定义,任务说明写在角色的 `prompt`(一段自由文本)上;运行时引擎用角色名称、产物契约、门禁和重试策略把它包成节点任务书。节点可配置制品契约、失败/重试策略和画布位置。角色的 CLI 仅可选择 CodeBuddy、Codex 或 Claude Code。旧的 `command` 节点在保存时会迁移为 shell 脚本节点。
+节点类型为 `agent|script|approval`。脚本节点通过 `scriptLanguage`(`shell|python`)和 `script` 配置;Agent 节点只引用角色定义,任务说明写在角色的 `prompt`(一段自由文本)上;运行时引擎用角色名称、产物契约、门禁和重试策略把它包成节点任务书。节点可配置制品契约、失败/重试策略和画布位置。角色的 CLI 与 `GET /api/executors` 的内置目录一致。旧的 `command` 节点在保存时会迁移为 shell 脚本节点。
### `GET /api/workflows`
diff --git a/docs/api/registry.md b/docs/api/registry.md
index 92fd4f1d..7f17a059 100644
--- a/docs/api/registry.md
+++ b/docs/api/registry.md
@@ -173,7 +173,7 @@ curl -u "$AGENTFLOW_USER:$AGENTFLOW_PASS" -X POST \
### `GET /api/executors`
-返回只读的三个内置 CLI:CodeBuddy、Codex、Claude Code。CLI 不允许通过 API 新增或修改;模型在 Agent 中设置,API Key/Base URL 使用需求责任人(未指定时为项目 Owner)的个人配置。
+返回只读的内置 CLI 目录(CodeBuddy、Codex、Claude Code,以及 OpenCode、Cursor CLI、Antigravity、Kimi Code、Pi、DeepSeek Harness、ZCode)。CLI 不允许通过 API 新增或修改;模型在 Agent 中设置,API Key/Base URL 使用需求责任人(未指定时为项目 Owner)的个人配置。
## Dockerfile、Environment 与 Sandbox Profile
diff --git a/docs/deployment.md b/docs/deployment.md
index b2ec4f3b..b6c1ed5f 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -122,7 +122,7 @@ Personal runners are connected from the execution-machine page with a short-live
A platform administrator can share one CodeBuddy API Key under **Platform administration → Shared CodeBuddy Key** (平台共享 CodeBuddy Key): pick the network environment that issued it and the models members may use (the first is the default). Members without a key of their own then chat and run SOPs on it, limited to those models; a role configured with another model runs on the default and the run says so. Members with their own key keep using it with any model. Scheduled tasks, clarification, reports, bots and run evaluation still need the runner's own key. A scheduled task uses the key for its selected CLI and does not borrow the shared CodeBuddy key. The key is stored in the database like personal keys and is never shown again after saving. `AGENTFLOW_ASSISTANT_SPONSOR_LOGIN`, which lent one account's key limited to `deepseek-v4.1-flash`, still applies while no shared key is configured.
-Configure provider credentials in the platform UI, not the host's global CLI configuration. Credentials are bound to the responsible actor by the upstream runtime. The home composer and SOP roles support CodeBuddy, Codex and Claude Code independently. Select the executor beside the home model selector; its API key (and optional Codex/Claude base URL) comes from your personal settings. Changing the executor preserves the draft; saved conversations record the executor used. Main Bot writes still pass through the platform tool gateway and its approval checks. Requirement clarification and notifications continue to use CodeBuddy. A scheduled assistant task can select any supported CLI and runs as an ordinary chat turn; Codex and Claude Code still need that account's own credential. Live model tests are opt-in; set `AGENTFLOW_LIVE_TESTS=1` only for the acceptance suites that need to load local credentials.
+Configure provider credentials in the platform UI, not the host's global CLI configuration. Credentials are bound to the responsible actor by the upstream runtime. The home composer and SOP roles each choose a built-in CLI independently. Select the executor beside the home model selector; its API key (and optional Codex/Claude base URL) comes from your personal settings. Changing the executor preserves the draft; saved conversations record the executor used. Main Bot writes still pass through the platform tool gateway and its approval checks. Requirement clarification and notifications continue to use CodeBuddy. A scheduled assistant task can select any supported CLI and runs as an ordinary chat turn; Codex and Claude Code still need that account's own credential. Live model tests are opt-in; set `AGENTFLOW_LIVE_TESTS=1` only for the acceptance suites that need to load local credentials.
## Observability schema
diff --git a/internal/application/operations.go b/internal/application/operations.go
index d68b3dd3..25e6beb9 100644
--- a/internal/application/operations.go
+++ b/internal/application/operations.go
@@ -68,7 +68,7 @@ func PublicOperations() []Operation {
{Name: "mcp_servers_save", Description: "Create or update an external MCP server asset", Method: "PUT", Path: "/api/mcp-servers"},
{Name: "mcp_servers_import", Description: "Import external MCP server definitions from JSON", Method: "POST", Path: "/api/mcp-servers/import"},
{Name: "executors_list", Description: "List executor definitions", Method: "GET", Path: "/api/executors", ReadOnly: true},
- {Name: "executor_models_list", Description: "List the selectable model IDs, default model and reasoning-effort levels of each built-in CLI (codebuddy, codex, claude). Use a listed id as an Agent's model.", Method: "GET", Path: "/api/executor-models", ReadOnly: true},
+ {Name: "executor_models_list", Description: "List the selectable model IDs, default model and reasoning-effort levels of each built-in CLI. Use a listed id as an Agent's model.", Method: "GET", Path: "/api/executor-models", ReadOnly: true},
{Name: "dockerfiles_list", Description: "List Dockerfile assets", Method: "GET", Path: "/api/dockerfiles", ReadOnly: true},
{Name: "dockerfiles_save", Description: "Create or update a Dockerfile asset", Method: "PUT", Path: "/api/dockerfiles"},
{Name: "dockerfiles_delete", Description: "Delete a Dockerfile that is not shared and not referenced by any sandbox", Method: "DELETE", Path: "/api/dockerfiles"},
diff --git a/internal/httpapi/catalog.go b/internal/httpapi/catalog.go
index a6dbf4d7..f8a9a485 100644
--- a/internal/httpapi/catalog.go
+++ b/internal/httpapi/catalog.go
@@ -316,7 +316,7 @@ func (h *catalogHandlers) agents(c *gin.Context) {
}
builtIn, ok := repo.BuiltInExecutor(v.ExecutorID)
if !ok {
- c.JSON(http.StatusBadRequest, map[string]string{"error": "CLI 仅支持 codebuddy、codex 或 claude"})
+ c.JSON(http.StatusBadRequest, map[string]string{"error": "不支持的 CLI:" + v.ExecutorID})
return
}
if err := domain.ValidateAgentEffort(v.Effort, builtIn.Kind); err != nil {
@@ -1228,7 +1228,7 @@ func (h *catalogHandlers) workflow(c *gin.Context) {
}
builtIn, ok := repo.BuiltInExecutor(agent.ExecutorID)
if !ok {
- c.JSON(http.StatusBadRequest, map[string]string{"error": "CLI 仅支持 codebuddy、codex 或 claude"})
+ c.JSON(http.StatusBadRequest, map[string]string{"error": "不支持的 CLI:" + agent.ExecutorID})
return
}
if err := domain.ValidateAgentEffort(agent.Effort, builtIn.Kind); err != nil {
diff --git a/internal/httpapi/issues_test.go b/internal/httpapi/issues_test.go
index bc056f62..c9f3d241 100644
--- a/internal/httpapi/issues_test.go
+++ b/internal/httpapi/issues_test.go
@@ -558,11 +558,14 @@ func TestAgentAPIOnlyAcceptsBuiltInCLIs(t *testing.T) {
t.Cleanup(func() { s.Close() })
h := New(s, engine.New(s, runtime.NewManager(filepath.Join(t.TempDir(), "workspaces"))), tracker.NewService(), "", "")
- requestJSON[map[string]string](t, h, http.MethodPut, "/api/agents", map[string]any{"id": "custom-cli", "name": "Custom CLI", "projectId": "platform", "executorId": "custom"}, http.StatusBadRequest)
- for _, executorID := range []string{"codebuddy", "codex", "claude"} {
- created := requestJSON[domain.AgentDefinition](t, h, http.MethodPut, "/api/agents", map[string]any{"id": "agent-" + executorID, "name": executorID, "projectId": "platform", "executorId": executorID}, http.StatusOK)
- if created.ExecutorID != executorID {
- t.Fatalf("agent CLI = %q, want %q", created.ExecutorID, executorID)
+ rejected := requestJSON[map[string]string](t, h, http.MethodPut, "/api/agents", map[string]any{"id": "custom-cli", "name": "Custom CLI", "projectId": "platform", "executorId": "custom"}, http.StatusBadRequest)
+ if !strings.Contains(rejected["error"], "不支持的 CLI") {
+ t.Fatalf("unknown CLI error = %q", rejected["error"])
+ }
+ for _, executor := range repo.BuiltInExecutors() {
+ created := requestJSON[domain.AgentDefinition](t, h, http.MethodPut, "/api/agents", map[string]any{"id": "agent-" + executor.ID, "name": executor.Name, "projectId": "platform", "executorId": executor.ID}, http.StatusOK)
+ if created.ExecutorID != executor.ID {
+ t.Fatalf("agent CLI = %q, want %q", created.ExecutorID, executor.ID)
}
}
}
diff --git a/web/app/agents.js b/web/app/agents.js
index 76b04073..99a61bc9 100644
--- a/web/app/agents.js
+++ b/web/app/agents.js
@@ -117,7 +117,7 @@ function syncAgentTabIndicators(){$$('#agentsView .agent-tabs, #agentModal .agen
if(typeof document!=='undefined'&&document.fonts?.ready)document.fonts.ready.then(()=>syncAgentTabIndicators()).catch(()=>{});
function pickerHTML(items,selected,prefix){return `<input class="input picker-filter" data-picker-filter="${prefix}" placeholder="筛选名称或说明…">${(items||[]).map(x=>`<label class="asset-check"><input type="checkbox" name="${prefix}" value="${x.id}" ${(selected||[]).includes(x.id)?'checked':''}><span>${escapeHTML(x.name)}<small>${escapeHTML(x.description||x.id)}</small></span></label>`).join('')||'<span class="type-label">暂无可用资产,请先到对应的资产管理页面添加</span>'}`}
function bindPickerFilters(root){(root||document).querySelectorAll('[data-picker-filter]').forEach(input=>input.oninput=()=>{const q=input.value.trim().toLowerCase();input.parentElement.querySelectorAll('.asset-check').forEach(row=>row.hidden=!!q&&!row.textContent.toLowerCase().includes(q))})}
-function executorOptions(selected){const allowed=new Set(['codebuddy','codex','claude']),items=(state.data.executors||[]).filter(x=>allowed.has(x.id)),legacy=selected&&!allowed.has(selected)?`<option value="${escapeHTML(selected)}" selected disabled>历史执行器 ${escapeHTML(selected)}(请重新选择 CLI)</option>`:'';return legacy+items.map(x=>`<option value="${escapeHTML(x.id)}" ${x.id===selected?'selected':''}>${escapeHTML(x.name||x.id)}</option>`).join('')}
+function executorOptions(selected){const allowed=new Set(['codebuddy','codex','claude','opencode','cursor','agy','kimi','pi','dsh','zcode']),items=(state.data.executors||[]).filter(x=>allowed.has(x.id)),legacy=selected&&!allowed.has(selected)?`<option value="${escapeHTML(selected)}" selected disabled>历史执行器 ${escapeHTML(selected)}(请重新选择 CLI)</option>`:'';return legacy+items.map(x=>`<option value="${escapeHTML(x.id)}" ${x.id===selected?'selected':''}>${escapeHTML(x.name||x.id)}</option>`).join('')}
const AGENT_CUSTOM_MODEL='__custom__';
function executorModelCatalogs(){return window.AgentFlowExecutorModels||{}}
async function loadExecutorModelCatalogs(){
diff --git a/web/orchestrate.js b/web/orchestrate.js
index adbec650..aa718bfb 100644
--- a/web/orchestrate.js
+++ b/web/orchestrate.js
@@ -3,7 +3,7 @@ let aiBuild = null;
let aiAbort = null;
const aiHistory = {};
-const aiOrchestratorCLIBrands = {codebuddy:'codebuddy', codex:'codex', 'claude-code':'claude', opencode:'opencode', cursor:'cursor', agy:'gemini', kimi:'kimi', pi:'pi', dsh:'deepseek'};
+const aiOrchestratorCLIBrands = {codebuddy:'codebuddy', codex:'codex', 'claude-code':'claude', opencode:'opencode', cursor:'cursor', agy:'gemini', kimi:'kimi', pi:'pi', dsh:'deepseek', zcode:'glm'};
function aiOrchestratorEngine(model) {
const listed = window.AgentFlowAssistantModels?.catalog().models.find(item => item.id === model);
diff --git a/web/syntax_test.go b/web/syntax_test.go
index 38787305..930f4be7 100644
--- a/web/syntax_test.go
+++ b/web/syntax_test.go
@@ -828,9 +828,21 @@ global.escapeHTML = value => String(value);
global.state = {data: {executors: [
{id: 'codebuddy', name: 'CodeBuddy'},
{id: 'codex', name: 'Codex'},
- {id: 'claude', name: 'Claude Code'}
+ {id: 'claude', name: 'Claude Code'},
+ {id: 'opencode', name: 'OpenCode'},
+ {id: 'cursor', name: 'Cursor CLI'},
+ {id: 'agy', name: 'Antigravity'},
+ {id: 'kimi', name: 'Kimi Code'},
+ {id: 'pi', name: 'Pi'},
+ {id: 'dsh', name: 'DeepSeek Harness'},
+ {id: 'zcode', name: 'ZCode'},
+ {id: 'mock', name: '演示执行器'}
]}};
eval(code.slice(code.indexOf('function executorOptions('), code.indexOf('function selectAgent(')));
+for (const id of ['opencode', 'cursor', 'agy', 'kimi', 'pi', 'dsh', 'zcode']) {
+ assert.ok(executorOptions(id).includes('value="' + id + '" selected'), id);
+}
+assert.ok(!executorOptions('codex').includes('value="mock"'));
const legacy = executorOptions('legacy-codex');
assert.ok(legacy.includes('历史执行器 legacy-codex'));
assert.ok(legacy.includes('value="legacy-codex" selected disabled'));