Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Platform releases use `vX.Y.Z` tags and publish `ghcr.io/tencent/loopforge`. LoopForge Local packages use `local-vX.Y.Z` tags and are published by manually running the `release-local` workflow.

## Unreleased

### Platform

- Platform administration shares model credentials per CLI instead of one CodeBuddy key. 平台管理 → 共享模型 Key holds one API Key per CLI (CodeBuddy, Codex, Claude Code), each with its own allow list of models and default; CodeBuddy keeps its network environment, Codex and Claude Code take an optional Base URL so a self-hosted gateway works, and the page can fetch the models a gateway publishes. Members without their own key for a CLI chat and run LOOP nodes on the shared one, limited to those models, while members with their own key are unaffected. The keys live in `platform_model_keys`; `migrations/050_platform_model_keys.sql` copies the earlier CodeBuddy row and the platform keeps reading the old table until then. Scheduled tasks, clarification, reports, bots and run evaluation keep using personal credentials.

## 0.4.3 — LOOP orchestration, execution machines and asset evolution

### Platform
Expand Down
1 change: 1 addition & 0 deletions chatbot/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3138,6 +3138,7 @@ export default function App() {
defaultModel={chat.model}
sponsoredModel={chat.sponsoredModel}
sponsoredModels={chat.sponsoredModels}
sharedEngines={chat.sharedEngines}
onClose={closeQuickAccess}
onOpenView={(view) => navigate(view)}
onCredentialsSaved={chat.refreshCredentials}
Expand Down
23 changes: 14 additions & 9 deletions chatbot/src/QuickAccessWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ export default function QuickAccessWizard({
projectId = "",
sponsoredModel = "",
sponsoredModels = [],
sharedEngines = {},
onClose,
onCompleted,
onCredentialsSaved,
Expand Down Expand Up @@ -1103,7 +1104,12 @@ export default function QuickAccessWizard({
const selectedRepo = (bindRepoNow && parsedRepo) || parseSavedRepo(defaultRepo, gongfengHost);
const repoAccess = gitAccess(selectedRepo);
const readyCLIs = EXECUTORS.filter(cli => personalEngineConfigured(storedUser, cli.id));
const cliReady = readyCLIs.length > 0 || Boolean(sponsoredModel);
// CLIs the platform lends a key for, so a member without their own can run.
const sharedCLIs = EXECUTORS.filter(cli => (sharedEngines?.[cli.id] || []).length > 0);
const sharedCLIText = sponsoredModel
? `平台共享模型(${sharedModelNames(sponsoredModels, sponsoredModel)})`
: sharedCLIs.length ? `平台共享 ${sharedCLIs.map(cli => cli.label).join("、")} 凭据` : "";
const cliReady = readyCLIs.length > 0 || Boolean(sharedCLIText);
const nodes =
activeWorkflow?.nodes?.filter((node) => node.type === "agent") ||
FALLBACK_NODES;
Expand Down Expand Up @@ -1559,13 +1565,12 @@ export default function QuickAccessWizard({
: "未配置,克隆/推送私有仓库前可在个人配置补齐"}
</span>
</li>
<li className={completedSummary?.cliNames?.length || sponsoredModel ? "is-ok" : "is-warn"}>
<li className={completedSummary?.cliNames?.length || cliReady ? "is-ok" : "is-warn"}>
<HarnessIcon name={completedSummary?.cliNames?.length ? "check" : "info"} size={14} />
<span>
模型 CLI · {completedSummary?.cliNames?.join("、") ||
(sponsoredModel
? `平台共享模型(${sharedModelNames(sponsoredModels, sponsoredModel)})`
: "可在个人配置或执行机器设置中准备")}
sharedCLIText ||
"可在个人配置或执行机器设置中准备"}
</span>
</li>
<li className="is-ok">
Expand Down Expand Up @@ -1662,8 +1667,8 @@ export default function QuickAccessWizard({
<p className="qa-lede">
{hasGit || readyCLIs.length
? "可以继续选择项目和仓库,也可以先补齐下面的配置。"
: sponsoredModel
? "平台共享模型可用,可直接继续。需要操作私有仓库时,可以在这里添加 Git 凭据。"
: cliReady
? `${sharedCLIText}可用,可直接继续。需要操作私有仓库时,可以在这里添加 Git 凭据。`
: "配置任意一项即可继续。下一步选择项目和仓库。"}
</p>
) : null}
Expand Down Expand Up @@ -1719,7 +1724,7 @@ export default function QuickAccessWizard({
<header className="qa-cred-head">
<div>
<strong id="qa-executors-title">执行器</strong>
<span>{readyCLIs.length ? readyCLIs.map(cli => cli.label).join("、") : sponsoredModel ? "可使用平台共享模型" : "尚未配置执行器"}</span>
<span>{readyCLIs.length ? readyCLIs.map(cli => cli.label).join("、") : sharedCLIText || "尚未配置执行器"}</span>
</div>
<StatusPill ok={cliReady} />
</header>
Expand Down Expand Up @@ -2124,7 +2129,7 @@ export default function QuickAccessWizard({
<span>
{repoAccess.label} {repoAccess.ready ? "已配置" : "未配置"} ·
CLI · {readyCLIs.length ? readyCLIs.map(cli => cli.label).join("、") :
sponsoredModel ? "使用平台共享模型" : "未配置"}
sharedCLIText || "未配置"}
</span>
</dd>
</div>
Expand Down
3 changes: 3 additions & 0 deletions chatbot/src/useChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export function useChat() {
[selection, setSelection] = useState(() => ({ executor: storedExecutor(), model: null, effort: null })),
[codeBuddyDefault, setCodeBuddyDefault] = useState({ id: "default", name: "默认" }),
[sponsoredModels, setSponsoredModels] = useState([]),
[sharedEngines, setSharedEngines] = useState({}),
[providerCatalogs, setProviderCatalogs] = useState({}),
[generation, setGeneration] = useState(null),
[stopRequest, setStopRequest] = useState(null),
Expand Down Expand Up @@ -337,6 +338,7 @@ export function useChat() {
setCatalogEngines(catalog.engines || []);
setCodeBuddyDefault({ id: catalog.default || "default", name: "默认", efforts: catalog.defaultEfforts });
setSponsoredModels(sponsoredModelList(catalog));
setSharedEngines(catalog.sharedEngines || {});
}, []);
useEffect(() => {
if (!user?.id || user.isGuest) {
Expand Down Expand Up @@ -1817,6 +1819,7 @@ export function useChat() {
sponsored,
sponsoredModel,
sponsoredModels,
sharedEngines,
generation,
live,
error,
Expand Down
26 changes: 24 additions & 2 deletions chatbot/tests/quick-access-wizard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,30 @@ describe("QuickAccessWizard", () => {
/>,
);
await screen.findByRole("dialog");
expect(screen.getByText(/平台共享模型可用,可直接继续/)).toBeVisible();
expect(screen.getByText("可使用平台共享模型")).toBeVisible();
expect(screen.getByText(/平台共享模型(m1)可用,可直接继续/)).toBeVisible();
expect(screen.getAllByText(/平台共享模型(m1)/).length).toBeGreaterThan(1);
await userAction.click(screen.getByRole("button", { name: "下一步" }));
expect(await screen.findByText("项目与仓库", { selector: "h3" })).toBeInTheDocument();
mockState.unconfigured = false;
});

test("a shared CLI key lets new users skip credentials too", async () => {
mockState.unconfigured = true;
const userAction = userEvent.setup();
render(
<QuickAccessWizard
open
user={{ id: 1, loginName: "tester", chineseName: "测试" }}
projects={[project]}
projectId="p1"
sharedEngines={{ codex: ["gpt-6.1-terra"] }}
onClose={vi.fn()}
onCompleted={vi.fn()}
onOpenView={vi.fn()}
/>,
);
await screen.findByRole("dialog");
expect(screen.getByText(/平台共享 Codex 凭据可用,可直接继续/)).toBeVisible();
await userAction.click(screen.getByRole("button", { name: "下一步" }));
expect(await screen.findByText("项目与仓库", { selector: "h3" })).toBeInTheDocument();
mockState.unconfigured = false;
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ The installer checks the helper destinations against the staged macOS binary and

When platform updates are enabled, macOS runners synchronize the helper in the background at startup. A failed version check is retried during rescans, including when an older helper remains usable. A readable, compatible local ELF or a locally configured script wrapper can be copied into a Docker workspace with executable permissions while the sync runs. Operations that need a missing helper for Git or MCP can wait up to five seconds for the initial sync. The background download continues within its own transfer timeout.

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 LOOPs 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. Clarification, reports, bots and run evaluation use the personal credentials of the relevant account. Scheduled prompts follow the selected CLI's credential and sponsorship settings. 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.
A platform administrator can share one API Key per CLI under **Platform administration → Shared Model Key** (平台管理 → 共享模型 Key): CodeBuddy needs the network environment that issued its key, Codex and Claude Code take the key plus an optional Base URL for a gateway (empty uses the official endpoint). Each CLI has its own allow list of models, the first being the default; the page offers the CLI's built-in catalog, can fetch the models a gateway publishes, and accepts extra model IDs. Members without a key of their own for that CLI then chat and run LOOPs on the shared one, 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. Clarification, reports, bots and run evaluation still use the personal credentials of the relevant account, and AI scheduled tasks follow the selected CLI's credential; CodeBuddy keeps the shared-key fallback described in [ai-scheduled-task-capabilities](ai-scheduled-task-capabilities.md). Keys are stored in the database like personal keys, one row per CLI in `platform_model_keys`, and are never shown again after saving. `migrations/050_platform_model_keys.sql` copies the CodeBuddy key of the earlier single-key table; the platform reads that table while the copy has not run, and clearing the shared CodeBuddy key removes both rows. `AGENTFLOW_ASSISTANT_SPONSOR_LOGIN`, which lent one account's CodeBuddy key limited to `deepseek-v4.1-flash`, still applies while no shared CodeBuddy 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 LOOP 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. 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.

Expand Down
28 changes: 28 additions & 0 deletions internal/domain/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,34 @@ func IsAgentCLIKind(kind string) bool {
})
}

// Shared model credential engines: the CLIs whose API Key a platform
// administrator may share with members who configured none of their own
// (平台管理 → 共享模型 Key). The agent CLIs above are excluded because their
// model configuration lives in a private HOME that only personal credentials
// fill. The order is the switch order on that page.
const (
SharedModelProviderCodeBuddy = "codebuddy"
SharedModelProviderCodex = "codex"
SharedModelProviderClaude = "claude-code"
)

var SharedModelProviders = []string{SharedModelProviderCodeBuddy, SharedModelProviderCodex, SharedModelProviderClaude}

// NormalizeSharedModelProvider accepts the shared-credential engine names,
// including the "claude" alias older personal settings used, and returns the
// canonical one.
func NormalizeSharedModelProvider(raw string) (string, bool) {
switch strings.ToLower(strings.TrimSpace(raw)) {
case "", SharedModelProviderCodeBuddy:
return SharedModelProviderCodeBuddy, true
case SharedModelProviderCodex:
return SharedModelProviderCodex, true
case "claude", SharedModelProviderClaude:
return SharedModelProviderClaude, true
}
return "", false
}

// ValidateAgentEffort checks a role's reasoning-effort choice against the
// levels published for the resolved executor kind.
func ValidateAgentEffort(effort, executorKind string) error {
Expand Down
70 changes: 0 additions & 70 deletions internal/engine/codebuddy_auth.go

This file was deleted.

Loading
Loading