Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(connections): one Connections list driven by a provider registry (#6134)

ddupont74ff486506e5
diff --git a/apps/cua-spaces-desktop/src/bridge/agent-keys.ts b/apps/cua-spaces-desktop/src/bridge/agent-keys.ts
index 62c8cd04e4..0f51684f83 100644
--- a/apps/cua-spaces-desktop/src/bridge/agent-keys.ts
+++ b/apps/cua-spaces-desktop/src/bridge/agent-keys.ts
@@ -1,26 +1,41 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-// Settings → Connectors' provider keys (`agentKeys.*`), kept by the daemon in the
+// Settings → Connections' provider keys (`agentKeys.*`), kept by the daemon in the
// system's credential store (the SwiftUI host's `AgentKeysModel`). The key
// travels once, in `agentKeys.set`'s arguments; answers never carry one.
import type { BridgeContext } from "./context";
import { optionalString, string } from "./args";
import type { Handlers } from "./host";
+/** The non-secret choices a connection carries: a plan or region, and its fields (a model, a custom endpoint's URL). */
+function choices(args: Record<string, unknown>): Record<string, unknown> {
+ const out: Record<string, unknown> = {};
+ const region = optionalString(args, "region");
+ if (region) out.region = region;
+ const fields = args.fields;
+ if (fields && typeof fields === "object" && !Array.isArray(fields)) {
+ const clean = Object.fromEntries(Object.entries(fields as Record<string, unknown>).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
+ if (Object.keys(clean).length) out.fields = clean;
+ }
+ return out;
+}
+
export function agentKeysMethods({ model }: BridgeContext): Handlers {
return {
"agentKeys.list": () => model.agents.keys.call("agent_keys.list"),
"agentKeys.check": () => model.agents.keys.call("agent_keys.check"),
"agentKeys.set": (args) => {
- const call: Record<string, unknown> = { provider: string(args, "provider"), value: string(args, "value") };
+ // A custom endpoint may have no key: `value` is then empty.
+ const call: Record<string, unknown> = { provider: string(args, "provider"), value: typeof args.value === "string" ? args.value : "" };
const env = optionalString(args, "env");
if (env) call.env = env;
+ Object.assign(call, choices(args));
return model.agents.keys.call("agent_keys.set", call);
},
"agentKeys.remove": (args) => model.agents.keys.call("agent_keys.remove", { env: string(args, "env") }),
// Which provider keys your login shell has (names only), and one saved from it (the value never crosses the bridge).
"agentKeys.shell": () => model.agents.keys.call("agent_keys.shell"),
- "agentKeys.fromShell": (args) => model.agents.keys.call("agent_keys.from_shell", { env: string(args, "env") }),
+ "agentKeys.fromShell": (args) => model.agents.keys.call("agent_keys.from_shell", { env: string(args, "env"), ...choices(args) }),
};
}
diff --git a/apps/cua-spaces-desktop/src/model/agents.ts b/apps/cua-spaces-desktop/src/model/agents.ts
index 4b5b493d37..d39da8e035 100644
--- a/apps/cua-spaces-desktop/src/model/agents.ts
+++ b/apps/cua-spaces-desktop/src/model/agents.ts
@@ -373,6 +373,12 @@ export class AgentKeysModel {
}
}
+/** A record of strings (a connection's non-secret fields), else empty. */
+function stringMap(v: unknown): Map<string, string> {
+ if (!v || typeof v !== "object" || Array.isArray(v)) return new Map();
+ return new Map(Object.entries(v as Record<string, unknown>).filter((e): e is [string, string] => typeof e[1] === "string"));
+}
+
/** The core's input for `agent_keys.list`'s answer (never a value). */
export function agentKeysInput(report: Json | null, error: string | null): AppAgentKeysInput {
const keys = arr(report ?? {}, "keys")
@@ -382,6 +388,9 @@ export function agentKeysInput(report: Json | null, error: string | null): AppAg
last4: typeof k.last4 === "string" ? k.last4 : "",
addedMs: BigInt(typeof k.added_ms === "number" && k.added_ms >= 0 ? Math.floor(k.added_ms) : 0),
expired: k.expired === true,
+ label: typeof k.label === "string" && k.label ? k.label : undefined,
+ region: typeof k.region === "string" && k.region ? k.region : undefined,
+ fields: stringMap(k.fields),
}))
.filter((k) => k.env !== "");
const unavailable = report?.available === false ? (typeof report.unavailable === "string" ? report.unavailable : "this machine can't keep keys") : undefined;
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
index 7f31f3d2bc..c6079e3a81 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
@@ -8836,7 +8836,16 @@ export type AppAgentKeyInput = {
/**
* A copied sign-in's name ("Signed in as [email protected] (Claude Max)").
*/
- label?: string
+ label?: string,
+ /**
+ * The plan or region chosen for it (Z.AI), when the provider has them.
+ */
+ region?: string,
+ /**
+ * Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ * and `wire`, or a `model`. Never the key.
+ */
+ fields: Map<string, string>
}
/**
@@ -8865,7 +8874,9 @@ const FfiConverterTypeAppAgentKeyInput = (() => {
last4: FfiConverterString.read(from),
addedMs: FfiConverterUInt64.read(from),
expired: FfiConverterBool.read(from),
- label: FfiConverterOptionalString.read(from)
+ label: FfiConverterOptionalString.read(from),
+ region: FfiConverterOptionalString.read(from),
+ fields: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -8875,6 +8886,8 @@ const FfiConverterTypeAppAgentKeyInput = (() => {
FfiConverterUInt64.write(value.addedMs, into);
FfiConverterBool.write(value.expired, into);
FfiConverterOptionalString.write(value.label, into);
+ FfiConverterOptionalString.write(value.region, into);
+ FfiConverterMapStringString.write(value.fields, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
@@ -8882,7 +8895,9 @@ const FfiConverterTypeAppAgentKeyInput = (() => {
FfiConverterString.allocationSize(value.last4) +
FfiConverterUInt64.allocationSize(value.addedMs) +
FfiConverterBool.allocationSize(value.expired) +
- FfiConverterOptionalString.allocationSize(value.label);
+ FfiConverterOptionalString.allocationSize(value.label) +
+ FfiConverterOptionalString.allocationSize(value.region) +
+ FfiConverterMapStringString.allocationSize(value.fields);
}
};
@@ -69639,6 +69654,9 @@ const FfiConverterSequenceTypeAppLineView = new FfiConverterArray(FfiConverterTy
// FfiConverter for AppFileView | undefined
const FfiConverterOptionalTypeAppFileView = new FfiConverterOptional(FfiConverterTypeAppFileView);
+// FfiConverter for Map<string, string>
+const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
+
// FfiConverter for bigint | undefined
const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
@@ -69867,9 +69885,6 @@ const FfiConverterSequenceTypeAppDeviceInput = new FfiConverterArray(FfiConverte
// FfiConverter for Array<AppAuditInput>
const FfiConverterSequenceTypeAppAuditInput = new FfiConverterArray(FfiConverterTypeAppAuditInput);
-// FfiConverter for Map<string, string>
-const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
-
// FfiConverter for Array<AppMachineInput>
const FfiConverterSequenceTypeAppMachineInput = new FfiConverterArray(FfiConverterTypeAppMachineInput);
diff --git a/apps/cua-spaces-desktop/test/agents-fixtures.ts b/apps/cua-spaces-desktop/test/agents-fixtures.ts
index 77cc373d90..2129a2ab9c 100644
--- a/apps/cua-spaces-desktop/test/agents-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/agents-fixtures.ts
@@ -98,7 +98,14 @@ export class FakeAgentKeysTools {
const env = provider === "anthropic" ? "ANTHROPIC_API_KEY" : provider === "openai" ? "OPENAI_API_KEY" : String(args.env ?? "");
const value = String(args.value ?? "");
this.keys = this.keys.filter((k) => k.env !== env);
- this.keys.push({ provider, env, last4: value.slice(-4), added_ms: 1_790_000_100_000 });
+ this.keys.push({
+ provider,
+ env,
+ last4: value.slice(-4),
+ added_ms: 1_790_000_100_000,
+ ...(typeof args.region === "string" ? { region: args.region } : {}),
+ ...(args.fields && typeof args.fields === "object" ? { fields: args.fields } : {}),
+ });
break;
}
case "agent_keys.remove":
diff --git a/apps/cua-spaces-desktop/test/agents.test.ts b/apps/cua-spaces-desktop/test/agents.test.ts
index 2a76a8d969..922a25b5c8 100644
--- a/apps/cua-spaces-desktop/test/agents.test.ts
+++ b/apps/cua-spaces-desktop/test/agents.test.ts
@@ -461,6 +461,13 @@ describe.skipIf(!built)("agents", () => {
expect(JSON.stringify(set)).not.toContain("sk-ant");
await call(bridge, "agentKeys.set", { provider: "other", env: "MISTRAL_API_KEY", value: "mk-0000-9z9z" });
expect(keys.calls.at(-1)![1]).toEqual({ provider: "other", value: "mk-0000-9z9z", env: "MISTRAL_API_KEY" });
+ // A plan, and a custom endpoint's non-secret fields (its key may be empty), reach the daemon as given.
+ await call(bridge, "agentKeys.set", { provider: "zai", value: "zk-0000-9z9z", region: "coding-global" });
+ expect(keys.calls.at(-1)).toEqual(["agent_keys.set", { provider: "zai", value: "zk-0000-9z9z", region: "coding-global" }]);
+ const fields = { base_url: "http://127.0.0.1:1234/v1", model: "qwen", wire: "openai-chat" };
+ const custom = await call(bridge, "agentKeys.set", { provider: "custom", fields });
+ expect(keys.calls.at(-1)).toEqual(["agent_keys.set", { provider: "custom", value: "", fields }]);
+ expect(JSON.stringify(custom)).toContain("http://127.0.0.1:1234/v1");
const removed = await call(bridge, "agentKeys.remove", { env: "ANTHROPIC_API_KEY" });
expect(keys.calls.at(-1)).toEqual(["agent_keys.remove", { env: "ANTHROPIC_API_KEY" }]);
for (const [m, a] of [["agentKeys.list", listed], ["agentKeys.set", set], ["agentKeys.remove", removed]] as const) expect(shapeProblems(m, a)).toEqual([]);
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentKeysModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentKeysModel.swift
index 6d78aba217..7b1231cf09 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentKeysModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AgentKeysModel.swift
@@ -5,12 +5,12 @@ import CuaSpacesFFI
import Foundation
import Observation
-/// Settings → Connectors: the provider keys agents get. The cua daemon keeps
+/// Settings → Connections: the provider keys agents get. The cua daemon keeps
/// them in the Keychain (`agent_keys.list/set/remove`, its app methods; no
/// MCP tool reaches them) and answers only the provider, the variable, the
/// last four characters and when each was added. Every word and rule is the
/// app core's (`appAgentKeysView`, `appAgentKeyForm`); the web UI's
-/// Settings → Connectors draws the same.
+/// Settings → Connections draws the same.
///
/// A key passes through here once, in `save`, and is never kept.
@MainActor @Observable
@@ -50,10 +50,15 @@ public final class AgentKeysModel {
}
}
- /// Adds or replaces a key (`env` names an Other key).
- public func save(provider: String, env: String?, value: String) async throws {
+ /// Adds or replaces a key (`env` names an Other key; `provider` is a provider
+ /// of the registry otherwise). `region` and `fields` are the non-secret
+ /// choices a connection carries (a plan, a model, a custom endpoint's URL).
+ public func save(provider: String, env: String?, value: String,
+ region: String? = nil, fields: [String: String] = [:]) async throws {
var args: [String: Any] = ["provider": provider, "value": value]
if provider == "other", let env, !env.isEmpty { args["env"] = env }
+ if let region, !region.isEmpty { args["region"] = region }
+ if !fields.isEmpty { args["fields"] = fields }
try await call("agent_keys.set", args)
}
@@ -72,7 +77,9 @@ public final class AgentKeysModel {
last4: k["last4"] as? String ?? "",
addedMs: (k["added_ms"] as? NSNumber)?.uint64Value ?? 0,
expired: k["expired"] as? Bool ?? false,
- label: k["label"] as? String)
+ label: k["label"] as? String,
+ region: k["region"] as? String,
+ fields: (k["fields"] as? [String: String]) ?? [:])
}
let unavailable = report?["available"] as? Bool == false
? (report?["unavailable"] as? String ?? "this computer can't keep keys") : nil
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index 8db2ee4ba3..2b2d1a6315 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -121,7 +121,7 @@ public final class AppModel {
public let checklist: ChecklistModel
/// Settings, Storage: the Cua Volume's store, Finder volume and cache.
public internal(set) var storage: StorageModel
- /// Settings, Connectors: the provider keys agents get (kept by the daemon).
+ /// Settings, Connections: the provider keys agents get (kept by the daemon).
public let agentKeys: AgentKeysModel
/// The user's own clouds: the "Your cloud" tile and "Connect a cloud".
public let cloud: CloudModel
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ProviderRegistry.generated.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ProviderRegistry.generated.swift
new file mode 100644
index 0000000000..ec07b4d920
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ProviderRegistry.generated.swift
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// Generated by `cargo run -p cua-connections --bin cua-connections-gen` from
+// libs/cua/crates/cua-connections/providers/*.toml. Do not edit.
+
+/// The providers a person can see, in rank order, as the app core lists them.
+public enum ProviderRegistry {
+ public static let ids: [String] = [
+ "anthropic",
+ "openai",
+ "openrouter",
+ "google",
+ "xai",
+ "deepseek",
+ "kimi",
+ "github",
+ "huggingface",
+ "zai",
+ "fireworks",
+ "nvidia",
+ "ollama-cloud",
+ "deepinfra",
+ "novita",
+ "nebius-token-factory",
+ "gmi",
+ "upstage",
+ "arcee",
+ "ai-gateway",
+ "opencode-zen",
+ "opencode-go",
+ "kilocode",
+ "xiaomi",
+ "stepfun",
+ "minimax",
+ "alibaba",
+ "custom",
+ ]
+
+ public static let methodKinds: [String] = [
+ "api_key",
+ "import_login",
+ "device_code",
+ "browser_oauth",
+ "subscription_login",
+ "adc",
+ "local_server",
+ "custom_endpoint",
+ ]
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
index 42fc50fc88..f7e0b2521c 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift
@@ -78,19 +78,26 @@ extension WebUIBridge {
if model.identity != nil { try await model.teamsReader?.ackShareRemovals() }
return NSNull()
- // Settings, Connectors: the daemon's agent_keys methods (the key travels
+ // Settings, Connections: the daemon's agent_keys methods (the key travels
// once, in agentKeys.set's arguments; answers never carry one).
case "agentKeys.list": return try await model.agentKeys.call("agent_keys.list")
// The providers are asked whether the saved API keys still work (answers cached for minutes).
case "agentKeys.check": return try await model.agentKeys.call("agent_keys.check")
case "agentKeys.set":
- var keyArgs: [String: Any] = ["provider": try string(args, "provider"), "value": try string(args, "value")]
+ // A custom endpoint may have no key: `value` is then empty.
+ var keyArgs: [String: Any] = ["provider": try string(args, "provider"), "value": (args["value"] as? String) ?? ""]
if let env = args["env"] as? String, !env.isEmpty { keyArgs["env"] = env }
+ if let region = args["region"] as? String, !region.isEmpty { keyArgs["region"] = region }
+ if let fields = args["fields"] as? [String: String], !fields.isEmpty { keyArgs["fields"] = fields }
return try await model.agentKeys.call("agent_keys.set", keyArgs)
case "agentKeys.remove": return try await model.agentKeys.call("agent_keys.remove", ["env": try string(args, "env")])
// Which provider keys your login shell has (names only), and one saved from it (the value never crosses the bridge).
case "agentKeys.shell": return try await model.agentKeys.call("agent_keys.shell")
- case "agentKeys.fromShell": return try await model.agentKeys.call("agent_keys.from_shell", ["env": try string(args, "env")])
+ case "agentKeys.fromShell":
+ var shellArgs: [String: Any] = ["env": try string(args, "env")]
+ if let region = args["region"] as? String, !region.isEmpty { shellArgs["region"] = region }
+ if let fields = args["fields"] as? [String: String], !fields.isEmpty { shellArgs["fields"] = fields }
+ return try await model.agentKeys.call("agent_keys.from_shell", shellArgs)
// Cua Volume
case "volume.overview": return try await volumeOverview()
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/AgentKeysTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/AgentKeysTests.swift
index 7d793995db..fa91528730 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/AgentKeysTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/AgentKeysTests.swift
@@ -8,7 +8,7 @@ import Foundation
import SwiftUI
import Testing
-/// An in-memory daemon for Settings → Connectors: `agent_keys.*` as the daemon
+/// An in-memory daemon for Settings → Connections: `agent_keys.*` as the daemon
/// answers them (never a value).
final class FakeAgentKeysTools: AgentsToolRunning, @unchecked Sendable {
var calls: [(String, [String: Any])] = []
@@ -43,7 +43,7 @@ final class FakeAgentKeysTools: AgentsToolRunning, @unchecked Sendable {
}
@MainActor
-@Suite("Settings → Connectors")
+@Suite("Settings → Connections")
struct AgentKeysTests {
init() { _ = NSApplication.shared }
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index c90552cb76..d0a0ca6815 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -2263,7 +2263,7 @@ struct ParityTests {
}
}
- /// Settings → Connectors (`run_agent_keys`): the section for each input, the
+ /// Settings → Connections (`run_agent_keys`): the section for each input, the
/// add or replace sheet, the Remove question and the variable names.
func runAgentKeys(_ f: [String: Any]) throws -> [Any] {
var frames: [Any] = []
diff --git a/apps/cua-spaces-web/e2e/agent-keys.ts b/apps/cua-spaces-web/e2e/agent-keys.ts
index eb97531e0d..2b6f959eb0 100644
--- a/apps/cua-spaces-web/e2e/agent-keys.ts
+++ b/apps/cua-spaces-web/e2e/agent-keys.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Screen checks for the `agent-keys` flow (Settings, Connectors, Providers): each section,
+ * Screen checks for the `agent-keys` flow (Settings, Connections, Providers): each section,
* sheet and Remove question the replay reached goes on the real screen
* through `window.__cuaParity.showAgentKeys`, and the screen must show the
* core's words. Then a key is added and removed for real on the demo host,
@@ -32,13 +32,13 @@ const TYPED = "sk-ant-test-0000";
export async function checkAgentKeys(page: Page, checkpoints: ParityCheckpoint[]): Promise<number> {
let checked = 0;
- await page.goto("/settings/connectors?bridge=demo&parity");
+ await page.goto("/settings/connections?bridge=demo&parity");
await page.waitForFunction(() => window.__cuaParity !== undefined);
expect(await page.evaluate(() => window.__cuaParity!.coreStatus), "the wasm core loaded").toBe("ready");
for (const { input, view } of unique(checkpoints, "agent-keys")) {
await page.evaluate((i) => window.__cuaParity!.showAgentKeys(i), input);
- const step = `Settings, Connectors with ${input.keys.map((k) => k.env).join(", ") || "no keys"}${view.notice ? " (notice)" : ""}`;
+ const step = `Settings, Connections with ${input.keys.map((k) => k.env).join(", ") || "no keys"}${view.notice ? " (notice)" : ""}`;
// The Providers group draws the core's view of the same keys: the add button follows canEdit.
await expect(page.locator("[data-connectors-providers]"), step).toBeVisible();
if (view.canEdit) await expect(page.locator("[data-agent-key-add-other]"), step).toBeEnabled();
@@ -90,7 +90,7 @@ export async function checkAgentKeys(page: Page, checkpoints: ParityCheckpoint[]
}
// For real on the demo host: add another company's key, then remove it.
- await page.goto("/settings/connectors?bridge=demo");
+ await page.goto("/settings/connections?bridge=demo");
await page.locator("[data-agent-key-add-other]").click();
const sheet = page.locator("[data-agent-key-sheet]");
await expect(sheet.locator("[data-agent-key-save]")).toBeDisabled();
diff --git a/apps/cua-spaces-web/e2e/flows.ts b/apps/cua-spaces-web/e2e/flows.ts
index 7b90b37562..af6a1a1913 100644
--- a/apps/cua-spaces-web/e2e/flows.ts
+++ b/apps/cua-spaces-web/e2e/flows.ts
@@ -79,7 +79,7 @@ export const FLOW_PLAN: Record<string, FlowPlan> = {
"agent-keys": { status: "run", screen: "settings/connected-apps" },
connectors: {
status: "skip",
- reason: "The redesign's Connectors page, an app's page, the @ picker and the agent list draw connectors.*, summon.* and agentList.view as is; the webview parity test replays this flow on the wasm core, and src/__tests__/connectors-redesign.test.tsx, ask-first-in-space.test.tsx and home-agents.test.tsx drive the screens",
+ reason: "The Connections page, an app's page, the @ picker and the agent list draw connectors.*, summon.* and agentList.view as is; the webview parity test replays this flow on the wasm core, and src/__tests__/connectors-redesign.test.tsx, ask-first-in-space.test.tsx and home-agents.test.tsx drive the screens",
},
"your-cloud": { status: "run", screen: "new-space" },
"telemetry-funnel": { status: "run", screen: "spaces" },
diff --git a/apps/cua-spaces-web/e2e/parity.spec.ts b/apps/cua-spaces-web/e2e/parity.spec.ts
index 2097cb706e..8bef07f472 100644
--- a/apps/cua-spaces-web/e2e/parity.spec.ts
+++ b/apps/cua-spaces-web/e2e/parity.spec.ts
@@ -44,7 +44,7 @@ const PATHS: Record<ParityScreen, string> = {
"settings/general": "/settings/general",
"settings/about": "/settings/about",
"settings/advanced": "/settings/advanced",
- "settings/connected-apps": "/settings/connectors",
+ "settings/connected-apps": "/settings/connections",
notifications: "/notifications",
machines: "/machines",
agents: "/agents/all",
diff --git a/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts b/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts
index f55022c361..211c25d65b 100644
--- a/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts
+++ b/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Settings tabs keep their place: some are long (Connectors: the page
+ * Settings tabs keep their place: some are long (Connections: the page
* scrolls), the others are short (it doesn't). The page's scrollbar must not take width
* from the column on one tab and not the other, or the tab bar and content
* jump sideways when you switch.
@@ -13,12 +13,12 @@ import { expect, test } from "./host";
const TABS = [
["Account", "/settings"],
["General", "/settings/general"],
- ["Connectors", "/settings/connectors"],
+ ["Connections", "/settings/connections"],
["Advanced", "/settings/advanced"],
["About", "/settings/about"],
] as const;
-// A window that fits the short tabs but not Connectors; a Settings tab bar and heading to measure.
+// A window that fits the short tabs but not Connections; a Settings tab bar and heading to measure.
test.use({
viewport: { width: 1100, height: 900 },
// Headless Chromium hides scrollbars by default; a Mac window with a mouse
diff --git a/apps/cua-spaces-web/e2e/volume.ts b/apps/cua-spaces-web/e2e/volume.ts
index af031a0235..981def93b6 100644
--- a/apps/cua-spaces-web/e2e/volume.ts
+++ b/apps/cua-spaces-web/e2e/volume.ts
@@ -164,7 +164,7 @@ async function checkOnboardingDrive(page: Page, cps: ParityCheckpoint[]): Promis
async function checkDriverCard(page: Page, cps: ParityCheckpoint[]): Promise<number> {
let checked = 0;
- // Background computer use sits behind "Show all" on Settings, Connectors,
+ // Background computer use sits behind "Show all" on Settings, Connections,
// which draws once the coding apps have loaded.
const showAll = page.locator("[data-connected-show-all]");
await expect(showAll).toBeVisible();
diff --git a/apps/cua-spaces-web/src/__tests__/agent-failure.test.tsx b/apps/cua-spaces-web/src/__tests__/agent-failure.test.tsx
index 34e565ff96..3f0111285d 100644
--- a/apps/cua-spaces-web/src/__tests__/agent-failure.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/agent-failure.test.tsx
@@ -44,9 +44,13 @@ describe("an agent that is not connected", () => {
expect(reply.querySelector("[data-failure-connect]")).not.toBeNull();
expect(reply.textContent).toContain("I can't reach Claude yet. Connect Claude, then try again.");
expect(reply.textContent).not.toMatch(/401|authentication_error|OAuth/);
- // Connect opens Settings, Connectors on the app; Retry is there too.
- const connect = reply.querySelector<HTMLAnchorElement>("[data-failure-connect]")!;
- expect(connect.getAttribute("href")).toBe("/settings/connectors/claude-code");
+ // Connect opens the same sheet as Settings, Connections, on the provider that refused it; Retry is there too.
+ const connect = reply.querySelector<HTMLButtonElement>("[data-failure-connect]")!;
+ expect(connect.tagName).toBe("BUTTON");
+ await act(async () => {
+ fireEvent.click(connect);
+ });
+ await waitFor(() => expect(q("[data-import-sheet], [data-provider-sheet]")).not.toBeNull());
expect(reply.querySelector("[data-failure-retry]")).not.toBeNull();
// No middle dot anywhere in what the failure draws.
expect(claude.textContent).not.toContain("·");
diff --git a/apps/cua-spaces-web/src/__tests__/agents-chat.test.tsx b/apps/cua-spaces-web/src/__tests__/agents-chat.test.tsx
index 636ff7555d..c8cd31ef5b 100644
--- a/apps/cua-spaces-web/src/__tests__/agents-chat.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/agents-chat.test.tsx
@@ -131,7 +131,7 @@ describe("the Agents tab", () => {
expect(row.querySelector('[data-harness-mark="bot"]')).toBeNull();
const agent = row.dataset.agentsEmptyRow!.replace("connect-mac-", "");
await click(row);
- await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connectors"));
+ await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connections"));
expect((router.state.location.search as { app?: string }).app).toBe(agent);
// The row is there, and still off: opening the page did not connect it.
const appRow = await found(`[data-connector-app="${agent}"]`);
diff --git a/apps/cua-spaces-web/src/__tests__/agents-page.test.tsx b/apps/cua-spaces-web/src/__tests__/agents-page.test.tsx
index 6fd3b39091..2af9a1926c 100644
--- a/apps/cua-spaces-web/src/__tests__/agents-page.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/agents-page.test.tsx
@@ -61,7 +61,7 @@ describe.skipIf(!wasmBuilt)("Agents page", () => {
return b!;
}, { timeout: 8000 });
fireEvent.click(setup);
- await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connectors"));
+ await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connections"));
expect(router.state.location.search).toHaveProperty("app");
// Nothing was connected on the way.
expect(document.querySelector('[data-agents-empty="ready"]')).toBeNull();
diff --git a/apps/cua-spaces-web/src/__tests__/claude-import.test.tsx b/apps/cua-spaces-web/src/__tests__/claude-import.test.tsx
index bd3dbc6fc5..fb15dd2ea4 100644
--- a/apps/cua-spaces-web/src/__tests__/claude-import.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/claude-import.test.tsx
@@ -52,7 +52,7 @@ const WHO = "Signed in as [email protected] (Claude Max)";
describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("asks first, in plain words, and reads nothing until you agree", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
const sheet = await found("[data-import-sheet=consent]");
const text = sheet.textContent ?? "";
@@ -73,7 +73,7 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("Cancel leaves everything as it was", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
await found("[data-import-sheet=consent]");
await click([...document.querySelectorAll("button")].find((b) => b.textContent === "Cancel")!);
@@ -84,7 +84,7 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("Use my sign-in imports it for Claude Code alone, then every surface says who", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
await click(await found("[data-import-confirm]"));
await waitFor(() => expect(q("[data-import-sheet]")).toBeNull());
@@ -93,13 +93,13 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
// The row, the Anthropic provider row and the app's own page.
expect(q("[data-connector-app=claude-code]")!.textContent).toContain(WHO);
expect(q("[data-connector-provider=anthropic]")!.textContent).toContain(WHO);
- expect(q("[data-connector-provider=anthropic]")!.textContent).toContain("Sign out");
+ expect(q("[data-connector-provider=anthropic]")!.textContent).toContain("Disconnect");
// Hermes does not count it: a Claude sign-in is Claude Code's alone.
expect(q("[data-connector-app=hermes]")!.dataset.state).not.toBe("connected");
});
it("a sign-in that ran out reads Needs reconnect with Reconnect, never the name", async () => {
- await mountApp("/settings/connectors", host([], { claudeLogin: "expired" }));
+ await mountApp("/settings/connections", host([], { claudeLogin: "expired" }));
await waitFor(() => expect(q("[data-connector-provider=anthropic]")?.textContent).toContain("Needs reconnect"));
const app = q("[data-connector-app=claude-code]")!;
expect(app.dataset.state).toBe("not-connected");
@@ -113,7 +113,7 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("Reconnect asks again and imports the newer sign-in", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls, { claudeLogin: "expired" }));
+ await mountApp("/settings/connections", host(calls, { claudeLogin: "expired" }));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
await click(await found("[data-import-confirm]"));
await waitFor(() => expect(q("[data-connector-app=claude-code]")!.dataset.state).toBe("connected"));
@@ -123,7 +123,7 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("with nothing to import it offers, in order: sign in with Claude Code, paste a token, use an API key", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls, { claudeLogin: "none" }));
+ await mountApp("/settings/connections", host(calls, { claudeLogin: "none" }));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
await click(await found("[data-import-confirm]"));
const sheet = await found("[data-import-sheet=not-found]");
@@ -143,7 +143,7 @@ describe.skipIf(!wasmBuilt)("importing the Claude Code sign-in", () => {
it("Try again after signing in with Claude Code reads it again", async () => {
const calls: Call[] = [];
- await mountApp("/settings/connectors", host(calls, { claudeLogin: "none" }));
+ await mountApp("/settings/connections", host(calls, { claudeLogin: "none" }));
await click(await found("[data-connector-app=claude-code] [data-connector-connect]"));
await click(await found("[data-import-confirm]"));
await found("[data-import-sheet=not-found]");
@@ -171,7 +171,11 @@ describe.skipIf(!wasmBuilt)("the Space thread's Connect card", () => {
it("says Reconnect when the saved sign-in ran out, with the same word as Settings", async () => {
const r = await reply({ claudeLogin: "expired" });
await waitFor(() => expect(r.querySelector("[data-failure-connect]")?.textContent).toContain("Reconnect"));
- expect(r.querySelector<HTMLAnchorElement>("[data-failure-connect]")!.getAttribute("href")).toBe("/settings/connectors/claude-code");
+ // Connect opens the same sheet as Settings, on the provider that refused it: the import question.
+ const connect = r.querySelector<HTMLButtonElement>("[data-failure-connect]")!;
+ expect(connect.tagName).toBe("BUTTON");
+ await click(connect);
+ await found("[data-import-sheet=consent]");
expect(r.textContent).not.toContain("\u00b7");
});
diff --git a/apps/cua-spaces-web/src/__tests__/cli-settings.test.tsx b/apps/cua-spaces-web/src/__tests__/cli-settings.test.tsx
index 9fd471415c..0afd6751ae 100644
--- a/apps/cua-spaces-web/src/__tests__/cli-settings.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/cli-settings.test.tsx
@@ -14,7 +14,7 @@ stubBrowserApis();
describe.skipIf(!wasmBuilt)("Settings, Terminal", () => {
it("names the file, installs on Install, then says where it is", { timeout: 20_000 }, async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors", {
+ await mountApp("/settings/connections", {
failsCreates: false,
listsGhost: false,
demo: { cli: "missing" },
@@ -36,7 +36,7 @@ describe.skipIf(!wasmBuilt)("Settings, Terminal", () => {
});
it("shows where a Local build's CLI is", { timeout: 20_000 }, async () => {
- await mountApp("/settings/connectors", { failsCreates: false, listsGhost: false, demo: { cli: "local" } });
+ await mountApp("/settings/connections", { failsCreates: false, listsGhost: false, demo: { cli: "local" } });
await waitFor(() => expect(document.querySelector('[data-settings-cli="installed"]')?.textContent).toMatch(/~\/\.local\/bin\/cua-local.*cua-local spaces ls/), { timeout: 8000 });
});
});
diff --git a/apps/cua-spaces-web/src/__tests__/connect-other-machine.test.tsx b/apps/cua-spaces-web/src/__tests__/connect-other-machine.test.tsx
index 0e3ea5e5bb..1aeef48999 100644
--- a/apps/cua-spaces-web/src/__tests__/connect-other-machine.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/connect-other-machine.test.tsx
@@ -66,8 +66,8 @@ describe.skipIf(!wasmBuilt)("an agent on another machine", () => {
expect(q("[data-connect-others]")?.textContent).toMatch(/Not touched: .+/);
});
- it("Settings, Connectors names the machine it edits, what it leaves alone, and shows how to use it from another machine", async () => {
- await mountApp("/settings/connectors", { failsCreates: false, listsGhost: false });
+ it("Settings, Connections names the machine it edits, what it leaves alone, and shows how to use it from another machine", async () => {
+ await mountApp("/settings/connections", { failsCreates: false, listsGhost: false });
const footer = await waitFor(() => {
const f = q("[data-connectors-machine]");
if (!f) throw new Error("no footer");
@@ -90,7 +90,7 @@ describe.skipIf(!wasmBuilt)("an agent on another machine", () => {
expect(block.textContent).not.toMatch(/·|\bdevices?\b/i);
// An app's own page says which machine it is on.
cleanup();
- await mountApp("/settings/connectors/claude-code", { failsCreates: false, listsGhost: false });
+ await mountApp("/settings/connections/claude-code", { failsCreates: false, listsGhost: false });
await waitFor(() => expect(q("[data-connector-on]")?.textContent).toMatch(/^On \S+/));
});
diff --git a/apps/cua-spaces-web/src/__tests__/connections-list.test.tsx b/apps/cua-spaces-web/src/__tests__/connections-list.test.tsx
new file mode 100644
index 0000000000..b9d99c1712
--- /dev/null
+++ b/apps/cua-spaces-web/src/__tests__/connections-list.test.tsx
@@ -0,0 +1,231 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// Settings, Connections: one list of providers with their state and the apps
+// each works with, a searchable More providers, and a Connect sheet that
+// offers only the methods that apply. Saving never waits on the provider.
+
+import { act, cleanup, fireEvent, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { wasmBuilt } from "@/bridge/__tests__/testCore";
+import { DEMO_THREAD_SPACE } from "@/bridge/adapters/demo/thread";
+import { PROVIDER_REGISTRY } from "@/bridge/generated/providers";
+import { resetConnectedAppsState } from "@/hooks/use-connected-apps";
+import { resetConnectState } from "@/hooks/use-connectors";
+import { mountApp, stubBrowserApis } from "./app-harness";
+
+stubBrowserApis();
+beforeEach(() => {
+ localStorage.clear();
+ resetConnectedAppsState();
+ resetConnectState();
+});
+afterEach(() => {
+ cleanup();
+ vi.unstubAllEnvs();
+});
+
+type Call = { op: string; args: unknown };
+const q = (s: string) => document.querySelector<HTMLElement>(s);
+const qa = (s: string) => [...document.querySelectorAll<HTMLElement>(s)];
+const found = (s: string) =>
+ waitFor(() => {
+ const el = q(s);
+ expect(el).not.toBeNull();
+ return el!;
+ });
+const click = (el: Element) =>
+ act(async () => {
+ fireEvent.click(el);
+ });
+const type = (el: Element, value: string) => fireEvent.change(el, { target: { value } });
+const host = (calls: Call[], demo: object = {}) => ({ failsCreates: false, listsGhost: false, demo, intercept: (op: string, args: unknown) => (calls.push({ op, args }), undefined) });
+const sets = (calls: Call[]) => calls.filter((c) => c.op === "agentKeys.set").map((c) => c.args as Record<string, unknown>);
+
+describe.skipIf(!wasmBuilt)("the Connections list", () => {
+ it("shows the eight up front with the apps each works with, and the apps open their pages", async () => {
+ await mountApp("/settings/connections", host([]));
+ await found("[data-connector-provider=anthropic]");
+ expect(qa("[data-connectors-providers] [data-connector-provider]").map((r) => r.dataset.connectorProvider)).toEqual(
+ PROVIDER_REGISTRY.filter((p) => p.tier === "top").map((p) => p.id),
+ );
+ const anthropic = q("[data-connector-provider=anthropic]")!;
+ expect(anthropic.querySelector("[data-connector-works-with]")!.textContent).toContain("Works with");
+ // Claude Code takes Anthropic and no other provider on the list.
+ expect(qa("[data-connector-chip=claude-code]").map((c) => c.closest("[data-connector-provider]")!.getAttribute("data-connector-provider"))).toEqual(["anthropic"]);
+ // The chips are four and a count; a chip opens its app's page.
+ expect(anthropic.querySelectorAll("[data-connector-chip]").length).toBe(4);
+ expect(anthropic.querySelector("[data-connector-chips-more]")!.textContent).toBe("and 3 more");
+ const nav = await found("[data-connector-provider=anthropic] [data-connector-chip=claude-code]");
+ await click(nav);
+ await found("[data-connector-detail=claude-code]");
+ });
+
+ it("keeps the rest in More providers: closed, then all of them, searched by name or alias", async () => {
+ await mountApp("/settings/connections", host([]));
+ await found("[data-connectors-more]");
+ expect(qa("[data-connectors-more] [data-connector-provider]")).toHaveLength(0);
+ const toggle = q("[data-connectors-more-toggle]")!;
+ expect(toggle.textContent).toMatch(/^Show all \d+$/);
+ await click(toggle);
+ const all = await waitFor(() => {
+ const rows = qa("[data-connectors-more] [data-connector-provider]").map((r) => r.dataset.connectorProvider);
+ expect(rows.length).toBeGreaterThan(15);
+ return rows;
+ });
+ for (const id of ["huggingface", "zai", "fireworks", "nvidia", "ollama-cloud"]) expect(all).toContain(id);
+ // Unreviewed logins and providers Cua hasn't run yet never show.
+ for (const id of ["nous", "qwen-oauth", "minimax-oauth", "xai-oauth", "vertex", "bedrock", "azure-foundry", "meta-ai"]) expect(all).not.toContain(id);
+ // Search by alias: HF is Hugging Face, glm is Z.AI.
+ type(q("[data-connectors-search]")!, "hf");
+ await waitFor(() => expect(qa("[data-connectors-more] [data-connector-provider]").map((r) => r.dataset.connectorProvider)).toEqual(["huggingface"]));
+ type(q("[data-connectors-search]")!, "glm");
+ await waitFor(() => expect(qa("[data-connectors-more] [data-connector-provider]").map((r) => r.dataset.connectorProvider)).toEqual(["zai"]));
+ type(q("[data-connectors-search]")!, "no such thing");
+ await found("[data-connectors-more-empty]");
+ expect(q("[data-connectors-more-empty]")!.textContent).toBe("No provider matches that.");
+ });
+
+ it("an OpenRouter key connects it with one paste, saves without waiting for the provider, and Hermes works with it", async () => {
+ const calls: Call[] = [];
+ await mountApp("/settings/connections", host(calls));
+ await click(await found("[data-connector-provider=openrouter] [data-connector-provider-action]"));
+ await found("[data-provider-sheet=openrouter]");
+ // Only the way that applies, with who uses it.
+ expect(qa("[data-provider-way]").map((w) => w.dataset.providerWay)).toEqual(["key"]);
+ expect(q("[data-provider-sheet=openrouter]")!.textContent).toContain("Works with");
+ await click(q("[data-provider-way=key]")!);
+ expect((q("[data-provider-save]") as HTMLButtonElement).disabled).toBe(true);
+ type(await found("[data-provider-key]"), "sk-or-v1-0123456789abcdef");
+ const before = calls.length;
+ await click(q("[data-provider-save]")!);
+ await waitFor(() => expect(q("[data-connector-provider=openrouter]")!.dataset.state).toBe("connected"));
+ expect(sets(calls)).toEqual([{ provider: "openrouter", value: "sk-or-v1-0123456789abcdef", env: null }]);
+ // Nothing asked the provider before the key was saved: no check between Save and the write.
+ const between = calls.slice(before).map((c) => c.op);
+ expect(between.indexOf("agentKeys.set")).toBe(0);
+ const row = q("[data-connector-provider=openrouter]")!;
+ expect(row.textContent).toContain("Connected");
+ expect(row.querySelector("[data-connector-credential]")!.textContent).toContain("•••• cdef");
+ expect(row.textContent).toContain("Disconnect");
+ // Hermes (and the other apps that read an OpenRouter key) are connected by it.
+ expect(q("[data-connector-app=goose]")!.dataset.state).toBe("connected");
+ expect(q("[data-connector-provider=openrouter] [data-connector-chip=hermes]")).not.toBeNull();
+ });
+
+ it("a custom endpoint asks for its URL, model and API style, needs no key, and says what a local server needs", async () => {
+ const calls: Call[] = [];
+ await mountApp("/settings/connections", host(calls));
+ await click(await found("[data-connector-provider=custom] [data-connector-provider-action]"));
+ await found("[data-provider-sheet=custom]");
+ await click(q("[data-provider-way=endpoint]")!);
+ expect(qa("[data-provider-field]").map((f) => f.dataset.providerField)).toEqual(["base_url", "model", "wire"]);
+ expect(q("[data-provider-note]")!.textContent).toContain("only reachable from a Space that is allowed to reach that port");
+ expect(q("[data-provider-sheet=custom]")!.textContent).toContain("API key (optional)");
+ // Not ready until the URL and model are there; the key stays empty.
+ const save = () => q("[data-provider-save]") as HTMLButtonElement;
+ expect(save().disabled).toBe(true);
+ type(q("[data-provider-field=base_url] input")!, "http://127.0.0.1:1234/v1");
+ expect(save().disabled).toBe(true);
+ type(q("[data-provider-field=model] input")!, "qwen3-coder");
+ await waitFor(() => expect(save().disabled).toBe(false));
+ await click(save());
+ await waitFor(() => expect(q("[data-connector-provider=custom]")!.dataset.state).toBe("connected"));
+ expect(sets(calls)).toEqual([{ provider: "custom", value: "", env: null, fields: { base_url: "http://127.0.0.1:1234/v1", model: "qwen3-coder", wire: "openai-chat" } }]);
+ expect(q("[data-connector-provider=custom] [data-connector-credential]")!.textContent).toBe("http://127.0.0.1:1234/v1");
+ // Hermes and the apps that can be pointed at an endpoint are connected by it.
+ for (const app of ["opencode", "goose"]) expect(q(`[data-connector-app=${app}]`)!.dataset.state).toBe("connected");
+ expect(q("[data-connector-provider=custom] [data-connector-chip=hermes]")).not.toBeNull();
+ expect(q("[data-connector-app=claude-code]")!.dataset.state).not.toBe("connected");
+ });
+
+ it("Z.AI asks which plan, because the plans bill separately", async () => {
+ const calls: Call[] = [];
+ await mountApp("/settings/connections", host(calls));
+ type(await found("[data-connectors-search]"), "z.ai");
+ await click(await found("[data-connector-provider=zai] [data-connector-provider-action]"));
+ await found("[data-provider-sheet=zai]");
+ await click(q("[data-provider-way=key]")!);
+ expect(q("[data-provider-field=region]")!.textContent).toContain("Plan");
+ expect(q("[data-provider-field=region]")!.textContent).toContain("Global");
+ type(await found("[data-provider-key]"), "zai-key-0123456789");
+ await click(q("[data-provider-save]")!);
+ await waitFor(() => expect(q("[data-connector-provider=zai]")!.dataset.state).toBe("connected"));
+ expect(sets(calls)).toEqual([{ provider: "zai", value: "zai-key-0123456789", env: null, region: "global" }]);
+ expect(q("[data-connector-provider=zai] [data-connector-credential]")!.textContent).toContain("Global");
+ });
+
+ it("Other providers in a sheet opens the choice: the eight, then More providers, searchable", async () => {
+ await mountApp("/settings/connections", host([]));
+ await click(await found("[data-connector-provider=anthropic] [data-connector-provider-action]"));
+ await found("[data-provider-sheet=anthropic]");
+ await click(q("[data-provider-switch]")!);
+ await found("[data-provider-picker]");
+ expect(qa("[data-provider-choice]")).toHaveLength(8);
+ await click(q("[data-provider-picker-more]")!);
+ await waitFor(() => expect(qa("[data-provider-choice]").length).toBeGreaterThan(15));
+ type(q("[data-provider-picker-search]")!, "nvid");
+ await waitFor(() => expect(qa("[data-provider-choice]").map((c) => c.dataset.providerChoice)).toEqual(["nvidia"]));
+ await click(q("[data-provider-choice=nvidia]")!);
+ await found("[data-provider-sheet=nvidia]");
+ });
+
+ it("Disconnect removes it, Needs reconnect reads on the row, and a connected provider from More stays up front", async () => {
+ const calls: Call[] = [];
+ await mountApp("/settings/connections", host(calls, { rejectedKeys: ["OPENAI_API_KEY"] }));
+ await waitFor(() => expect(q("[data-connector-provider=openai]")?.textContent).toContain("Needs reconnect"));
+ expect(q("[data-connector-provider=openai] [data-connector-provider-action]")!.textContent).toBe("Reconnect");
+ // Save a Fireworks key: it joins the list up front.
+ type(await found("[data-connectors-search]"), "fireworks");
+ await click(await found("[data-connectors-more] [data-connector-provider=fireworks] [data-connector-provider-action]"));
+ await click(await found("[data-provider-way=key]"));
+ type(await found("[data-provider-key]"), "fw_0123456789abcdef");
+ await click(q("[data-provider-save]")!);
+ await waitFor(() => expect(q("[data-connectors-providers] [data-connector-provider=fireworks]")?.dataset.state).toBe("connected"));
+ await click(q("[data-connectors-providers] [data-connector-provider=fireworks] [data-connector-provider-action]")!);
+ await waitFor(() => expect(q("[data-connector-provider=fireworks]")?.dataset.state ?? "gone").not.toBe("connected"));
+ expect(calls.some((c) => c.op === "agentKeys.remove" && (c.args as { env: string }).env === "FIREWORKS_API_KEY")).toBe(true);
+ });
+
+ it("says machines, never devices, and has no dot separators", async () => {
+ await mountApp("/settings/connections", host([]));
+ await found("[data-connector-provider=anthropic]");
+ await click(q("[data-connectors-more-toggle]")!);
+ await click(await found("[data-connector-provider=anthropic] [data-connector-provider-action]"));
+ await found("[data-provider-sheet=anthropic]");
+ const text = document.body.textContent!;
+ expect(text).not.toContain("·");
+ expect(text.toLowerCase()).not.toContain("device");
+ });
+});
+
+describe.skipIf(!wasmBuilt)("the Connect card in a Space thread", () => {
+ const path = `/spaces/${encodeURIComponent(DEMO_THREAD_SPACE)}`;
+ const reply = (who: string) => qa("[data-entry]").find((e) => e.querySelector("[data-failure-connect]") && e.textContent?.includes(who));
+
+ it("Hermes isn't connected: Connect opens the same sheet, on a provider Hermes can use, with the others one click away", async () => {
+ const calls: Call[] = [];
+ await mountApp(path, host(calls, { threadAuthFailed: true }));
+ const card = await waitFor(
+ () => {
+ const r = reply("Hermes needs a connected provider");
+ expect(r).toBeTruthy();
+ return r as HTMLElement;
+ },
+ { timeout: 5000 },
+ );
+ expect(card.textContent).toContain("Your Claude subscription sign-in only works in Claude Code");
+ await click(card.querySelector("[data-failure-connect]")!);
+ await found("[data-provider-sheet]");
+ // An API key way, not the Claude sign-in: that is Claude Code's alone.
+ expect(qa("[data-provider-way]").map((w) => w.dataset.providerWay)).not.toContain("app-token");
+ await click(q("[data-provider-switch]")!);
+ await found("[data-provider-picker]");
+ expect(q("[data-provider-picker]")!.textContent).toContain("Providers Hermes can use.");
+ await click(await found("[data-provider-choice=openrouter]"));
+ await found("[data-provider-sheet=openrouter]");
+ // Nothing was written or run for the sign-in itself.
+ expect(calls.filter((c) => c.op === "agents.connect")).toEqual([]);
+ });
+});
diff --git a/apps/cua-spaces-web/src/__tests__/connections.test.tsx b/apps/cua-spaces-web/src/__tests__/connections.test.tsx
index fa83972080..2a40771157 100644
--- a/apps/cua-spaces-web/src/__tests__/connections.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/connections.test.tsx
@@ -101,9 +101,9 @@ describe.skipIf(!wasmBuilt)("the Agents page, On This Mac", () => {
expect(row("codex")!.querySelector("[data-connection-action]")!.textContent).toBe("Sign in");
// Not installed agents get no row.
expect(row("gemini-cli")).toBeNull();
- // Connect on Hermes: opens Settings, Connectors at its row; nothing is connected on the spot.
+ // Connect on Hermes: opens Settings, Connections at its row; nothing is connected on the spot.
fireEvent.click(row("hermes")!.querySelector('[data-connection-action="connect"]')!);
- await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connectors"));
+ await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connections"));
expect((router.state.location.search as { app?: string }).app).toBe("hermes");
const appRow = await waitFor(() => {
const r = document.querySelector<HTMLElement>('[data-connector-app="hermes"]');
diff --git a/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx b/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx
index 99a521383b..6dea191fb8 100644
--- a/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/connectors-redesign.test.tsx
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-// Settings, Connectors: each coding app has Connect (Cua's
-// tools and its sign-in, once) and a chevron to its own page; Providers has
-// Connect or Sign out. Connect on Claude Code asks first, then imports the
+// Settings, Connections: each coding app has Connect (Cua's
+// tools and its sign-in, once) and a chevron to its own page; the
+// Connections list has Connect, Reconnect or Disconnect. Connect on Claude Code asks first, then imports the
// sign-in Claude Code already has (`signIn: true` for Claude Code alone) and
// connects Anthropic too (claude-import.test.tsx walks every state of it).
// Off, the page as it was: switches and Account keys.
@@ -44,9 +44,9 @@ function host(calls: { op: string; args: unknown }[]) {
return { failsCreates: false, listsGhost: false, intercept: (op: string, args: unknown) => (calls.push({ op, args }), undefined) };
}
-describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
- it("lists apps with Connect and a chevron, then Providers; no switches per app", async () => {
- await mountApp("/settings/connectors", host([]));
+describe.skipIf(!wasmBuilt)("Settings, Connections", () => {
+ it("lists the connections, then apps with Connect and a chevron; no switches per app", async () => {
+ await mountApp("/settings/connections", host([]));
const claude = await found("[data-connector-app=claude-code]");
expect(claude.getAttribute("role")).toBe("link");
expect(claude.className).toContain("hover:bg-accent/50");
@@ -54,14 +54,14 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
expect(claude.querySelector("[data-connector-connect]")?.textContent).toBe("Connect");
expect(claude.textContent).toContain("Needs a sign-in to Anthropic.");
expect(qa("[data-connectors-apps] [role=switch]").length).toBe(1); // Set up new apps automatically only
- expect(qa("[data-connector-provider]").map((r) => r.dataset.connectorProvider)).toEqual(["anthropic", "openai", "google", "openrouter", "github"]);
+ expect(qa("[data-connector-provider]").map((r) => r.dataset.connectorProvider)).toEqual(["anthropic", "openai", "openrouter", "google", "xai", "deepseek", "kimi", "custom"]);
expect(q("[data-connector-provider=anthropic]")!.textContent).toContain("Not connected");
- expect(q("[data-connector-provider=openai]")!.textContent).toContain("Sign out");
+ expect(q("[data-connector-provider=openai]")!.textContent).toContain("Disconnect");
expect(document.body.textContent).not.toContain("Account keys");
});
it("lists every agent harness without Show all, installed or not, each with Connect when not connected", async () => {
- await mountApp("/settings/connectors", host([]));
+ await mountApp("/settings/connections", host([]));
await found("[data-connector-app=claude-code]");
const ids = qa("[data-connectors-apps] [data-connector-app]").map((r) => r.dataset.connectorApp);
// Hermes, OpenCode, Goose and the rest are there with Show all still closed.
@@ -71,7 +71,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
const gemini = q("[data-connector-app=gemini-cli]")!;
expect(gemini.dataset.state).toBe("not-connected");
expect(gemini.querySelector("[data-connector-connect]")?.textContent).toBe("Connect");
- expect(gemini.textContent).toContain("Needs an API key for Google.");
+ expect(gemini.textContent).toContain("Needs an API key for Google AI Studio.");
expect(gemini.textContent).not.toContain("Get it");
// The demo has an OpenAI key saved: the apps that read it are connected, and say where they run.
expect(q("[data-connector-app=goose]")!.dataset.state).toBe("connected");
@@ -86,15 +86,19 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
it("Connect on an agent that is not installed here asks for a provider and a key, and connects what it can read", async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
// The demo has an OpenAI key saved; sign out first so nothing reads one.
await click(await found("[data-connector-provider=openai] [data-connector-provider-action='sign-out']"));
await waitFor(() => expect(q("[data-connector-app=opencode]")!.dataset.state).toBe("not-connected"));
await click(q("[data-connector-app=opencode] [data-connector-connect]")!);
- // The sheet for its first provider, with the others one click away.
+ // The sheet for its first provider, with the others one click away in a searchable choice.
await found("[data-provider-sheet=anthropic]");
- expect(qa("[data-provider-other]").map((b) => b.dataset.providerOther)).toEqual(["openai", "google", "openrouter"]);
- await click(q("[data-provider-other=openrouter]")!);
+ await click(q("[data-provider-switch]")!);
+ await found("[data-provider-picker]");
+ expect(qa("[data-provider-choice]").map((b) => b.dataset.providerChoice)).toEqual(["anthropic", "openai", "openrouter", "google", "xai", "deepseek", "kimi", "custom"]);
+ fireEvent.change(q("[data-provider-picker-search]")!, { target: { value: "openr" } });
+ await waitFor(() => expect(qa("[data-provider-choice]").map((b) => b.dataset.providerChoice)).toEqual(["openrouter"]));
+ await click(q("[data-provider-choice=openrouter]")!);
await found("[data-provider-sheet=openrouter]");
await click(q("[data-provider-way=key]")!);
fireEvent.change(await found("[data-provider-key]"), { target: { value: "sk-or-v1-0123456789abcdef" } });
@@ -110,7 +114,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
it("Connect on Claude Code imports its own sign-in once you agree, and connects Anthropic", async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
const btn = await found("[data-connector-app=claude-code] [data-connector-connect]");
await click(btn);
await click(await found("[data-import-confirm]"));
@@ -121,8 +125,10 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
expect(connects).toEqual([{ agents: ["claude-code"], signIn: true }]);
});
- it("a provider without a sign-in of its own asks for a key; Sign out removes it", async () => {
- await mountApp("/settings/connectors", host([]));
+ it("a provider without a sign-in of its own asks for a key; Disconnect removes it", async () => {
+ await mountApp("/settings/connections", host([]));
+ // GitHub is in More providers: search for it, then Connect.
+ fireEvent.change(await found("[data-connectors-search]"), { target: { value: "copilot" } });
await click(await found("[data-connector-provider=github] [data-connector-provider-action]"));
await found("[data-provider-sheet=github]");
expect(qa("[data-provider-way]").map((w) => w.dataset.providerWay)).toEqual(["key"]);
@@ -136,7 +142,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
});
it("the row opens the app's page: switches, its sign-in, and Remove", async () => {
- await mountApp("/settings/connectors", host([]));
+ await mountApp("/settings/connections", host([]));
await click(await found("[data-connector-app=claude-code]"));
await found("[data-connector-detail=claude-code]");
expect(qa("[data-connector-toggle]").map((t) => t.dataset.connectorToggle)).toEqual(["skills", "mcp", "auto"]);
@@ -147,7 +153,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
it("Codex signs in with its own device code: the code shows, then OpenAI is connected", async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
// OpenAI starts connected in the demo with a key; sign out first.
await click(await found("[data-connector-provider=openai] [data-connector-provider-action='sign-out']"));
await waitFor(() => expect(q("[data-connector-app=codex]")!.dataset.state).toBe("not-connected"));
@@ -166,7 +172,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
it("a key exported in your shell can be used; only its name is read first", async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
await click(await found("[data-connector-provider=anthropic] [data-connector-provider-action]"));
const way = await found("[data-provider-way=shell]");
expect(way.textContent).toContain("Use ANTHROPIC_API_KEY from your shell");
@@ -177,7 +183,7 @@ describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
it("an app's page switches one part off and on, leaving the other", async () => {
const calls: { op: string; args: unknown }[] = [];
- await mountApp("/settings/connectors/claude-code", host(calls));
+ await mountApp("/settings/connections/claude-code", host(calls));
await click(await found("[data-connector-toggle=mcp]"));
await waitFor(() => expect(calls.some((c) => c.op === "agents.disconnect")).toBe(true));
expect(calls.find((c) => c.op === "agents.disconnect")!.args).toEqual({ agents: ["claude-code"], signIn: false, skills: false, mcp: true });
diff --git a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx
index 6127ae7792..b7b9ee7382 100644
--- a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx
@@ -316,7 +316,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {
expect(heading()).toBe("Your machines, shared by your team and its agents.");
});
- it("shows no sign-ins or keys: those live in Settings, Connectors", async () => {
+ it("shows no sign-ins or keys: those live in Settings, Connections", async () => {
writeFirstRun({ step: "connect" });
await mount({ agents: (rows) => rows.map((r) => ({ ...r, installed: r.agent === "codex", configured: r.agent === "codex" })) });
await waitFor(() => expect(heading()).toBe("OpenAI Codex can use Cua."));
diff --git a/apps/cua-spaces-web/src/__tests__/needs-reconnect.test.tsx b/apps/cua-spaces-web/src/__tests__/needs-reconnect.test.tsx
index da8e45b941..fd0a4d8f81 100644
--- a/apps/cua-spaces-web/src/__tests__/needs-reconnect.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/needs-reconnect.test.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-// "Connected" must mean valid (CUA-2680): opening Settings, Connectors or the Agents page asks the
+// "Connected" must mean valid (CUA-2680): opening Settings, Connections or the Agents page asks the
// providers whether the saved sign-ins and keys still work; a refused one reads "Needs reconnect" with
// a Reconnect button, on its provider row and on the apps that read it. Reconnecting clears it.
@@ -38,16 +38,16 @@ function host(calls: string[], rejected: string[] = []) {
}
describe.skipIf(!wasmBuilt)("a saved sign-in the provider refuses", () => {
- it("is re-checked when Settings, Connectors opens, and reads Needs reconnect with Reconnect", async () => {
+ it("is re-checked when Settings, Connections opens, and reads Needs reconnect with Reconnect", async () => {
const calls: string[] = [];
- await mountApp("/settings/connectors", host(calls, ["OPENAI_API_KEY"]));
+ await mountApp("/settings/connections", host(calls, ["OPENAI_API_KEY"]));
await waitFor(() => expect(q("[data-connector-provider=openai]")?.textContent).toContain("Needs reconnect"));
expect(calls).toContain("agentKeys.check");
const row = q("[data-connector-provider=openai]")!;
expect(row.dataset.state).toBe("not-connected");
expect(row.querySelector("[data-connector-provider-action]")?.textContent).toBe("Reconnect");
- // Not "Connected", and no Sign out for a credential that does not work.
- expect(row.textContent).not.toContain("Sign out");
+ // Not "Connected", and no Disconnect for a credential that does not work.
+ expect(row.textContent).not.toContain("Disconnect");
expect(row.querySelector("[data-connector-status]")?.textContent).not.toContain("Connected");
});
@@ -59,7 +59,7 @@ describe.skipIf(!wasmBuilt)("a saved sign-in the provider refuses", () => {
it("a key the provider accepts stays Connected", async () => {
const calls: string[] = [];
- await mountApp("/settings/connectors", host(calls));
+ await mountApp("/settings/connections", host(calls));
await waitFor(() => expect(calls).toContain("agentKeys.check"));
await waitFor(() => expect(q("[data-connector-provider=openai]")?.dataset.state).toBe("connected"));
expect(q("[data-connector-provider=openai]")!.textContent).not.toContain("Needs reconnect");
@@ -67,7 +67,7 @@ describe.skipIf(!wasmBuilt)("a saved sign-in the provider refuses", () => {
it("Reconnect saves the key again and the row is Connected", async () => {
const calls: string[] = [];
- await mountApp("/settings/connectors", host(calls, ["OPENAI_API_KEY"]));
+ await mountApp("/settings/connections", host(calls, ["OPENAI_API_KEY"]));
await waitFor(() => expect(q("[data-connector-provider=openai]")?.textContent).toContain("Needs reconnect"));
await click(q("[data-connector-provider=openai] [data-connector-provider-action]")!);
await found("[data-provider-sheet=openai]");
diff --git a/apps/cua-spaces-web/src/__tests__/settings-agents.test.tsx b/apps/cua-spaces-web/src/__tests__/settings-agents.test.tsx
index ef642653bb..43abdcd056 100644
--- a/apps/cua-spaces-web/src/__tests__/settings-agents.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/settings-agents.test.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-// Settings, Connectors: each coding app on this computer with one
+// Settings, Connections: each coding app on this computer with one
// switch (`agents.setup`, `agents.connect` and `agents.disconnect`),
// "Set up new apps automatically", and the sync that sets up a newly
// installed app with a notice and Undo.
@@ -55,9 +55,9 @@ describe("configured agents without binary evidence", () => {
const app = (id: string) => document.querySelector<HTMLElement>(`[data-connector-app="${id}"]`);
-describe.skipIf(!wasmBuilt)("Settings, Connectors", () => {
+describe.skipIf(!wasmBuilt)("Settings, Connections", () => {
it("keeps Set up new apps automatically in the saved state", { timeout: 20_000 }, async () => {
- await mountApp("/settings/connectors", { failsCreates: false, listsGhost: false });
+ await mountApp("/settings/connections", { failsCreates: false, listsGhost: false });
await waitFor(() => expect(document.querySelector("[data-connected-auto]")).not.toBeNull(), { timeout: 8000 });
expect(connectedAppsState().auto).toBeNull();
fireEvent.click(document.querySelector("[data-connected-auto]")!);
@@ -83,7 +83,7 @@ describe.skipIf(!wasmBuilt)("a newly installed coding app", () => {
for (const state of [{ known: seen, off: [], auto: null }, { known: seen, off: ["hermes"], auto: true }]) {
cleanup();
setConnectedAppsState(state);
- const { router } = await mountApp("/settings/connectors", { failsCreates: false, listsGhost: false });
+ const { router } = await mountApp("/settings/connections", { failsCreates: false, listsGhost: false });
await waitFor(() => expect(app("hermes")).not.toBeNull(), { timeout: 8000 });
await router.load();
expect(app("hermes")!.querySelector("[data-connector-connect]")).not.toBeNull();
diff --git a/apps/cua-spaces-web/src/__tests__/settings-tabs.test.tsx b/apps/cua-spaces-web/src/__tests__/settings-tabs.test.tsx
index 3cd99863a5..bcab58433f 100644
--- a/apps/cua-spaces-web/src/__tests__/settings-tabs.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/settings-tabs.test.tsx
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
// Settings' five tabs on the real routes and the wasm core: Account, General,
-// Connectors, Advanced, About. The old addresses (Agents, Experiments) still
+// Connections, Advanced, About. The old addresses (Agents, Experiments) still
// land on the right tab, the old Trusted machines tab lands on Machines, and
// what moved is where the audit put it.
@@ -25,16 +25,16 @@ const tab = (id: string) => document.querySelector<HTMLElement>(`[data-settings-
const labels = () => [...document.querySelectorAll<HTMLElement>('nav[aria-label="Settings"] a')].map((a) => a.textContent);
describe.skipIf(!wasmBuilt)("Settings tabs (real routes, wasm core)", () => {
- it("has Account, General, Connectors, Advanced and About, in that order", async () => {
+ it("has Account, General, Connections, Advanced and About, in that order", async () => {
await mountApp("/settings", host);
await waitFor(() => expect(tab("account")).not.toBeNull());
- expect(labels()).toEqual(["Account", "General", "Connectors", "Advanced", "About"]);
+ expect(labels()).toEqual(["Account", "General", "Connections", "Advanced", "About"]);
});
it.each([
["/settings", "Account"],
["/settings/general", "General"],
- ["/settings/connectors", "Connectors"],
+ ["/settings/connections", "Connections"],
["/settings/advanced", "Advanced"],
["/settings/about", "About"],
])("marks only the tab for %s as selected (%s)", async (path, label) => {
@@ -45,8 +45,9 @@ describe.skipIf(!wasmBuilt)("Settings tabs (real routes, wasm core)", () => {
});
it.each([
- ["/settings/agents", "/settings/connectors", "connectors"],
- ["/settings/connected-apps", "/settings/connectors", "connectors"],
+ ["/settings/agents", "/settings/connections", "connections"],
+ ["/settings/connected-apps", "/settings/connections", "connections"],
+ ["/settings/connectors", "/settings/connections", "connections"],
["/settings/experiments", "/settings/advanced", "advanced"],
])("sends the old %s to %s", async (from, to, id) => {
const { router } = await mountApp(from, host);
@@ -54,6 +55,12 @@ describe.skipIf(!wasmBuilt)("Settings tabs (real routes, wasm core)", () => {
await waitFor(() => expect(tab(id)).not.toBeNull());
});
+ it("sends an old app address under Connectors to the same app under Connections", async () => {
+ const { router } = await mountApp("/settings/connectors/hermes", host);
+ await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connections/hermes"));
+ await waitFor(() => expect(document.querySelector("[data-connector-detail=hermes]")).not.toBeNull());
+ });
+
it("sends the old Trusted machines address to the Machines tab", async () => {
const { router } = await mountApp("/settings/devices", host);
await waitFor(() => expect(router.state.location.pathname).toBe("/machines"));
@@ -70,11 +77,12 @@ describe.skipIf(!wasmBuilt)("Settings tabs (real routes, wasm core)", () => {
expect(text).not.toMatch(/Keyboard shortcuts|Shared links|Storage|Runtimes|Keyvault|AI agents|Welcome/);
});
- it("puts Connectors where Agents was, with the account keys and Terminal", async () => {
- await mountApp("/settings/connectors", host);
+ it("puts Connections where Agents was: the providers, More providers and Terminal", async () => {
+ await mountApp("/settings/connections", host);
await waitFor(() => expect(document.querySelector("[data-connectors-providers]")).not.toBeNull(), { timeout: 8000 });
- const text = tab("connectors")!.textContent!;
- expect(text).toContain("Providers");
+ const text = tab("connections")!.textContent!;
+ expect(text).toContain("Connections");
+ expect(text).toContain("More providers");
expect(document.querySelector("[data-agent-key-add-other]")).not.toBeNull();
expect(text).not.toMatch(/provider key/i);
});
@@ -108,7 +116,7 @@ describe.skipIf(!wasmBuilt)("Settings tabs (real routes, wasm core)", () => {
});
describe.skipIf(!wasmBuilt)("Cmd+K finds Settings tabs", () => {
- it("opens Connectors from the palette", async () => {
+ it("opens Connections from the palette, by its old name too", async () => {
const { router } = await mountApp("/spaces", host);
await waitFor(() => expect(document.querySelector("nav")).not.toBeNull());
act(() => useUiStore.getState().setPaletteOpen(true));
@@ -119,6 +127,6 @@ describe.skipIf(!wasmBuilt)("Cmd+K finds Settings tabs", () => {
});
fireEvent.change(input, { target: { value: "connectors" } });
fireEvent.keyDown(input, { key: "Enter" });
- await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connectors"));
+ await waitFor(() => expect(router.state.location.pathname).toBe("/settings/connections"));
});
});
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-fresh.test.tsx b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-fresh.test.tsx
index c606756852..e7b05213cb 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-fresh.test.tsx
+++ b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-fresh.test.tsx
@@ -50,7 +50,7 @@ function fakeTarget() {
return { target, doc, fire: (t: string) => [...(on[t] ?? [])].forEach((l) => l()), count: () => Object.values(on).reduce((n, s) => n + s.size, 0) };
}
-describe("Settings, Connectors keeps its list fresh", () => {
+describe("Settings, Connections keeps its list fresh", () => {
it("reads when watching starts, on focus, on a visible document and on agents.changed", async () => {
const h = loggedDemo();
const store = new AgentKeysStore(h.adapter);
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-hosts.test.tsx b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-hosts.test.tsx
index 9d83535621..9ee47836b8 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-hosts.test.tsx
+++ b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys-hosts.test.tsx
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
import { agentKeyForm, agentKeysView } from "../agent-keys";
import { testCore, wasmBuilt } from "./testCore";
-/** What Settings, Connectors says about where a saved key stays, per system. */
+/** What Settings, Connections says about where a saved key stays, per system. */
const WORDS = {
macos: {
intro: "Agents in your Spaces need a provider key to run. Keys stay on this Mac in the Keychain, and each one is only given to the agents that use it.",
@@ -22,7 +22,7 @@ const WORDS = {
},
} as const;
-describe.skipIf(!wasmBuilt)("Settings, Connectors says where keys stay in the system's words", () => {
+describe.skipIf(!wasmBuilt)("Settings, Connections says where keys stay in the system's words", () => {
it("has the core say it for each system, and the Mac's words by default", async () => {
const core = await testCore();
const input = { keys: [] };
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys.test.tsx b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys.test.tsx
index 4c887923a6..6b503ee54d 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/agent-keys.test.tsx
+++ b/apps/cua-spaces-web/src/bridge/__tests__/agent-keys.test.tsx
@@ -98,7 +98,7 @@ function mount(core: CoreClient) {
return { hooks, adapter };
}
-describe.skipIf(!wasmBuilt)("Settings → Connectors through the core", () => {
+describe.skipIf(!wasmBuilt)("Settings → Connections through the core", () => {
it("adds, replaces and removes a key through the hook", async () => {
const { hooks, adapter } = mount(await testCore());
await waitFor(() => expect(hooks.keys.view?.rows.map((r) => r.status)).toEqual(["Not set", "•••• 3f9a"]));
@@ -136,7 +136,7 @@ describe.skipIf(!wasmBuilt)("Settings → Connectors through the core", () => {
});
});
-describe("Settings → Connectors without the core", () => {
+describe("Settings → Connections without the core", () => {
it("draws nothing it would have to make up", () => {
const { hooks, adapter } = mount(noCore);
expect(hooks.keys.view).toBeNull();
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/provider-registry.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/provider-registry.test.ts
new file mode 100644
index 0000000000..3cda0282c0
--- /dev/null
+++ b/apps/cua-spaces-web/src/bridge/__tests__/provider-registry.test.ts
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The web app's copy of the registry (generated from the provider files) and
+// the core's view of it say the same, and the key operations carry a plan and
+// a custom endpoint's fields without a value ever coming back.
+
+import { describe, expect, it } from "vitest";
+
+import { connectorsInputOf, providerPicker, providerSheet } from "../connectors";
+import { METHOD_KINDS, PROVIDER_REGISTRY } from "../generated/providers";
+import { agentKeysFromWire, tauriAgentKeysOps, webkitAgentKeysOps } from "../ops/agent-keys";
+import { testCore, wasmBuilt } from "./testCore";
+
+describe.skipIf(!wasmBuilt)("the registry in the web app", () => {
+ it("lists the providers the core lists, in the same order, and no others", async () => {
+ const core = await testCore();
+ const input = connectorsInputOf([], { keys: [] });
+ const picker = providerPicker(core, input, null, "", true)!;
+ expect(picker.items.map((i) => i.provider)).toEqual(PROVIDER_REGISTRY.map((p) => p.id));
+ // Up front is the same eight the core says are the first tier.
+ expect(PROVIDER_REGISTRY.filter((p) => p.tier === "top").map((p) => p.id)).toEqual(providerPicker(core, input, null, "", false)!.items.map((i) => i.provider));
+ });
+
+ it("offers only method kinds from the closed set, and a key way for every provider that takes a key", async () => {
+ const core = await testCore();
+ const input = connectorsInputOf([], { keys: [] });
+ for (const p of PROVIDER_REGISTRY) {
+ const sheet = providerSheet(core, input, p.id)!;
+ for (const w of sheet.ways) expect([...METHOD_KINDS, "api_key"]).toContain(w.kind);
+ if (p.keyEnv) expect(sheet.ways.some((w) => w.id === "key" || w.id === "endpoint")).toBe(true);
+ }
+ });
+});
+
+describe("agent key operations for connections", () => {
+ const WIRE = {
+ keys: [
+ { provider: "zai", env: "GLM_API_KEY", last4: "7d1f", added_ms: 1, region: "coding-global", value: "must-not-pass" },
+ { provider: "custom", env: "CUSTOM_ENDPOINT_API_KEY", last4: "", added_ms: 2, fields: { base_url: "http://127.0.0.1:1234/v1", model: "qwen", "bad key!": "x", wire: "line\nbreak" } },
+ ],
+ providers: [],
+ available: true,
+ };
+
+ it("reads a plan and non-secret fields, drops anything else, never keeps a value", () => {
+ const r = agentKeysFromWire(WIRE);
+ expect(r.keys[0]).toEqual({ provider: "zai", env: "GLM_API_KEY", last4: "7d1f", addedMs: 1, region: "coding-global" });
+ expect(r.keys[1]!.fields).toEqual({ base_url: "http://127.0.0.1:1234/v1", model: "qwen" });
+ expect(JSON.stringify(r)).not.toContain("must-not-pass");
+ });
+
+ it("sends the plan and fields on both hosts, and nothing extra for a plain key", async () => {
+ const seen: { cmd: string; args: unknown }[] = [];
+ const invoke = async <T>(cmd: string, args?: Record<string, unknown>) => (seen.push({ cmd, args: args?.args }), { keys: [], providers: [], available: true } as T);
+ const tauri = tauriAgentKeysOps(invoke);
+ await tauri["agentKeys.set"]({ provider: "zai", value: "k", region: "coding-global" });
+ await tauri["agentKeys.set"]({ provider: "custom", value: "", fields: { base_url: "http://h/v1", model: "m", wire: "openai-chat" } });
+ await tauri["agentKeys.set"]({ provider: "deepseek", value: "k" });
+ await tauri["agentKeys.fromShell"]({ env: "DEEPINFRA_API_KEY", fields: { model: "x/y" } });
+ expect(seen.map((s) => s.args)).toEqual([
+ { provider: "zai", value: "k", region: "coding-global" },
+ { provider: "custom", value: "", fields: { base_url: "http://h/v1", model: "m", wire: "openai-chat" } },
+ { provider: "deepseek", value: "k" },
+ { env: "DEEPINFRA_API_KEY", fields: { model: "x/y" } },
+ ]);
+ const sent: unknown[] = [];
+ const webkit = webkitAgentKeysOps(async <T>(_m: string, args?: Record<string, unknown>) => (sent.push(args), { keys: [], providers: [], available: true } as T));
+ await webkit["agentKeys.set"]({ provider: "zai", value: "k", region: "global" });
+ expect(sent).toEqual([{ provider: "zai", value: "k", region: "global" }]);
+ });
+});
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
index 0900bf05eb..a288bad421 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
@@ -80,6 +80,8 @@ export interface DemoOptions {
/** Claude Code's sign-in on this Mac: imported already (`?demo=claude-signed-in`), imported and run out (`?demo=claude-expired`),
* or none to import (`?demo=claude-none`: Connect finds nothing and offers the ways on). Default: there is one, not imported yet. */
claudeLogin?: "signed-in" | "expired" | "none";
+ /** Which connections are saved: `none` (`?demo=no-keys`, an empty Connections list) or `several` (`?demo=connections`: Anthropic, OpenRouter, a custom endpoint and a DeepSeek key the provider refuses). Default: an OpenAI key. */
+ keys?: "none" | "several";
/** Start with no Spaces (the first-Space empty state). */
noSpaces?: boolean;
/** This many more Spaces on the list, for scale (`?demo=scale-1000`;
@@ -228,6 +230,7 @@ export function demoOptionsFromSearch(search: string): DemoOptions {
noVault: flags.has("novault"),
...(flags.has("signed-in-machines") ? { signedInMachines: true } : {}),
...(flags.has("rejected-key") ? { rejectedKeys: ["OPENAI_API_KEY"] } : {}),
+ ...(flags.has("no-keys") ? { keys: "none" as const } : flags.has("connections") ? { keys: "several" as const, rejectedKeys: ["DEEPSEEK_API_KEY"] } : {}),
...(flags.has("claude-expired") ? { claudeLogin: "expired" as const } : flags.has("claude-signed-in") ? { claudeLogin: "signed-in" as const } : flags.has("claude-none") ? { claudeLogin: "none" as const } : {}),
noSpaces: flags.has("empty"),
...(() => {
@@ -341,7 +344,7 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
// A named allowance is for showing the prompts, which wait for no agent run.
runs: options.usage ? [] : demoRunRecords(now()),
imported: [],
- keyStore: demoKeyStore(now, options.rejectedKeys ?? [], options.claudeLogin),
+ keyStore: demoKeyStore(now, options.rejectedKeys ?? [], options.claudeLogin, options.keys),
readOnlyAgents: options.agentsReadOnly ?? [],
agentSetup: demoAgentSetup(options.onboarded === false || options.agents === "unset", options.agents === "none" ? [] : options.agents === "codex" ? ["codex"] : null),
platform: options.platform ?? MAC_DEMO_PLATFORM,
@@ -988,7 +991,7 @@ export interface DemoState extends DemoLinksStateField, DemoTelemetryState, Demo
agentSetup: AgentSetupRow[];
/** Agents whose sign-in the demo "copied" to Keyvault. */
imported: string[];
- /** Saved keys and sign-ins (Settings, Connectors; Claude Code's Connect adds its token here). */
+ /** Saved keys and sign-ins (Settings, Connections; Claude Code's Connect adds its token here). */
keyStore: DemoKeyStore;
readOnlyAgents: string[];
volume: DemoVolumeState;
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/agent-keys.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/agent-keys.ts
index ac7f4574e3..ca14ccdbc9 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo/agent-keys.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/agent-keys.ts
@@ -2,18 +2,17 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * The demo host's Settings → Connectors: the keys in memory, as the daemon
+ * The demo host's Settings → Connections: the keys in memory, as the daemon
* describes them (never a value). OpenAI starts saved, Anthropic not.
*/
import { HostError } from "../../adapter";
+import { PROVIDER_REGISTRY } from "../../generated/providers";
import type { AgentKeyInfo, AgentKeyProvider, AgentKeysReport } from "../../ops/agent-keys";
import type { DemoHandlers } from "./context";
-const PROVIDERS = [
- { id: "anthropic" as const, label: "Anthropic", env: "ANTHROPIC_API_KEY" },
- { id: "openai" as const, label: "OpenAI", env: "OPENAI_API_KEY" },
-];
+/** The registry's providers that take a key, as the daemon lists them. */
+const PROVIDERS = PROVIDER_REGISTRY.filter((p) => p.keyEnv).map((p) => ({ id: p.id, label: p.name, env: p.keyEnv }));
const providerOf = (env: string): AgentKeyProvider => PROVIDERS.find((p) => p.env === env)?.id ?? "other";
@@ -24,9 +23,19 @@ export interface DemoKeyStore {
rejected: string[];
}
-export const demoKeyStore = (now: () => number, rejected: string[] = [], claude?: "signed-in" | "expired" | "none"): DemoKeyStore => ({
+const DAY = 24 * 3600_000;
+
+/** `keys: "several"`: a few providers connected, one with a key the provider refuses (with `rejected`), a custom endpoint. */
+const SEVERAL = (now: () => number): AgentKeyInfo[] => [
+ { provider: "anthropic", env: "ANTHROPIC_API_KEY", last4: "a91c", addedMs: now() - 9 * DAY },
+ { provider: "openrouter", env: "OPENROUTER_API_KEY", last4: "cdef", addedMs: now() - 4 * DAY },
+ { provider: "deepseek", env: "DEEPSEEK_API_KEY", last4: "9c2e", addedMs: now() - 2 * DAY },
+ { provider: "custom", env: "CUSTOM_ENDPOINT_API_KEY", last4: "", addedMs: now() - DAY, fields: { base_url: "http://192.168.1.20:1234/v1", model: "qwen3-coder", wire: "openai-chat" } },
+];
+
+export const demoKeyStore = (now: () => number, rejected: string[] = [], claude?: "signed-in" | "expired" | "none", keys?: "none" | "several"): DemoKeyStore => ({
keys: [
- { provider: "openai", env: "OPENAI_API_KEY", last4: "3f9a", addedMs: now() - 6 * 24 * 3600_000 },
+ ...(keys === "none" ? [] : keys === "several" ? SEVERAL(now) : [{ provider: "openai", env: "OPENAI_API_KEY", last4: "3f9a", addedMs: now() - 6 * DAY }]),
// The sign-in imported from Claude Code (`?demo=claude-signed-in`), or one that ran out (`?demo=claude-expired`).
...(claude === "signed-in" || claude === "expired"
? [{ provider: "other" as const, env: "CLAUDE_CODE_OAUTH_TOKEN", last4: "", addedMs: now() - 26 * 3600_000, label: "Signed in as [email protected] (Claude Max)", ...(claude === "expired" ? { expired: true } : {}) }]
@@ -56,17 +65,22 @@ export function demoAgentKeysHandlers({
const r = report();
return { ...r, keys: r.keys.map((k) => (store.rejected.includes(k.env) ? { ...k, expired: true } : k)) };
},
- "agentKeys.set": async ({ provider, env, value }) => {
+ "agentKeys.set": async ({ provider, env, value, region, fields }) => {
const name = provider === "other" ? (env ?? "").trim() : PROVIDERS.find((p) => p.id === provider)?.env;
if (!name) throw new HostError(`unknown provider ${provider}`);
// The core's sheet refuses unsafe names before Save; the daemon checks again.
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new HostError(`${name} is not an environment variable name`);
const v = (value ?? "").trim();
- if (!v) throw new HostError("the key is empty");
+ // A custom endpoint needs no key; every other provider does.
+ if (!v && provider !== "custom") throw new HostError("the key is empty");
+ if (provider === "custom" && !(fields?.base_url && fields?.model)) throw new HostError("a custom endpoint needs its base URL and model");
// The Keychain write.
await wait(stepMs / 2);
store.rejected = store.rejected.filter((e) => e !== name);
- store.keys = [...keys().filter((k) => k.env !== name), { provider: providerOf(name), env: name, last4: v.length >= 12 ? v.slice(-4) : "", addedMs: now() }].sort(
+ store.keys = [
+ ...keys().filter((k) => k.env !== name),
+ { provider: providerOf(name), env: name, last4: v.length >= 12 ? v.slice(-4) : "", addedMs: now(), ...(region ? { region } : {}), ...(fields && Object.keys(fields).length ? { fields } : {}) },
+ ].sort(
(a, b) => a.env.localeCompare(b.env),
);
return report();
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/thread.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/thread.ts
index 0bd8372f32..01ee8b2679 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo/thread.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/thread.ts
@@ -372,7 +372,7 @@ function demoConversation(now: number, owner: { id: string; name: string }, opts
message: 'Internal error: Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."}}',
});
const hey = asked("@hermes hey", "hermes", min(1));
- failed(hey, min(1), HERMES, "I can't reach Claude yet. Connect Claude, then try again.", {
+ failed(hey, min(1), HERMES, "Hermes needs a connected provider. Connect one, then try again. Your Claude subscription sign-in only works in Claude Code.", {
class: "needs_connect",
provider: "anthropic",
retryable: true,
diff --git a/apps/cua-spaces-web/src/bridge/agent-keys.ts b/apps/cua-spaces-web/src/bridge/agent-keys.ts
index 9bf4134aab..60deefd29e 100644
--- a/apps/cua-spaces-web/src/bridge/agent-keys.ts
+++ b/apps/cua-spaces-web/src/bridge/agent-keys.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Settings → Connectors: `useAgentKeys()` over `ops/agent-keys.ts`, with every
+ * Settings → Connections: `useAgentKeys()` over `ops/agent-keys.ts`, with every
* word and rule from the app core's `agentKeys.*` (`agent_keys.rs`): the
* rows, the add or replace sheet, which variable names can hold a key and
* the question before removing one.
@@ -17,13 +17,13 @@ import { isUnsupported, type DataAdapter } from "./adapter";
import { BridgeContext } from "./BridgeProvider";
import type { CoreClient } from "./core";
import { hostOs, type HostOs } from "./host-os";
-import type { AgentKeyProvider, AgentKeysReport } from "./ops/agent-keys";
+import type { AgentKeyProvider, AgentKeysReport, KeyChoices } from "./ops/agent-keys";
/* ---- The core's words ------------------------------------------------------------ */
/** What the section shows (`agent_keys::AgentKeysInput`). */
export interface AgentKeysInput {
- keys: { provider: string; env: string; last4: string; addedMs: number; expired?: boolean; label?: string }[];
+ keys: { provider: string; env: string; last4: string; addedMs: number; expired?: boolean; label?: string; region?: string; fields?: Record<string, string> }[];
unavailable?: string | null;
error?: string | null;
}
@@ -83,7 +83,16 @@ export interface AgentKeyConfirm {
}
export const agentKeysInputOf = (report: AgentKeysReport | undefined, error: Error | null): AgentKeysInput => ({
- keys: (report?.keys ?? []).map(({ provider, env, last4, addedMs, expired, label }) => ({ provider, env, last4, addedMs, ...(expired ? { expired: true } : {}), ...(label ? { label } : {}) })),
+ keys: (report?.keys ?? []).map(({ provider, env, last4, addedMs, expired, label, region, fields }) => ({
+ provider,
+ env,
+ last4,
+ addedMs,
+ ...(expired ? { expired: true } : {}),
+ ...(label ? { label } : {}),
+ ...(region ? { region } : {}),
+ ...(fields && Object.keys(fields).length ? { fields } : {}),
+ })),
unavailable: report?.available === false ? (report.unavailable ?? "this machine can't keep keys") : null,
error: error ? error.message : null,
});
@@ -189,7 +198,7 @@ export class AgentKeysStore {
* Reads the list after the providers were asked whether the saved API keys still work
* (`agentKeys.check`: cheap, answers reused for a few minutes, never logged), so a key that was
* revoked reads "Needs reconnect" instead of "Connected". Falls back to the plain list on a host
- * without the check. Opening Settings, Connectors and the Agents page does this.
+ * without the check. Opening Settings, Connections and the Agents page does this.
*/
check(): Promise<void> {
const epoch = this.epoch;
@@ -218,9 +227,9 @@ export class AgentKeysStore {
}
/** Saves a key; the list after it replaces the shown one. Throws the host's words. */
- async save(provider: AgentKeyProvider, value: string, env: string | null): Promise<void> {
+ async save(provider: AgentKeyProvider, value: string, env: string | null, choices: KeyChoices = {}): Promise<void> {
this.epoch++;
- const report = await this.adapter.call("agentKeys.set", { provider, value, env });
+ const report = await this.adapter.call("agentKeys.set", { provider, value, env, ...choices });
this.epoch++;
this.pinned = false;
this.set({ report, error: null, sheet: null });
@@ -249,7 +258,7 @@ export class AgentKeysStore {
this.pinned = true;
this.loaded = true;
const report: AgentKeysReport = {
- keys: input.keys.map((k) => ({ ...k, provider: k.provider === "anthropic" || k.provider === "openai" ? k.provider : "other" })),
+ keys: input.keys.map((k) => ({ ...k })),
providers: [],
available: !input.unavailable,
unavailable: input.unavailable ?? null,
@@ -260,7 +269,7 @@ export class AgentKeysStore {
const stores = new WeakMap<DataAdapter, AgentKeysStore>();
-/** The adapter's one Settings → Connectors store. */
+/** The adapter's one Settings → Connections store. */
export function agentKeysStore(adapter: DataAdapter): AgentKeysStore {
let s = stores.get(adapter);
if (!s) stores.set(adapter, (s = new AgentKeysStore(adapter)));
@@ -279,7 +288,7 @@ export interface AgentKeysHook extends AgentKeysState {
/** The list after the providers were asked whether the saved keys still work. */
check(): Promise<void>;
/** Adds or replaces a key; `env` names an Other key. */
- save(provider: AgentKeyProvider, value: string, env: string | null): Promise<void>;
+ save(provider: AgentKeyProvider, value: string, env: string | null, choices?: KeyChoices): Promise<void>;
remove(env: string): Promise<void>;
openSheet(provider: AgentKeyProvider, env?: string | null): void;
closeSheet(): void;
@@ -321,7 +330,7 @@ export function useAgentKeys({ watch = false }: { watch?: boolean } = {}): Agent
core: ctx.core,
refresh: () => (store ? store.refresh() : Promise.resolve()),
check: () => (store ? store.check() : Promise.resolve()),
- save: (provider, value, env) => need().save(provider, value, env),
+ save: (provider, value, env, choices) => need().save(provider, value, env, choices),
remove: (env) => need().remove(env),
openSheet: (provider, env = null) => store?.openSheet(provider, env),
closeSheet: () => store?.closeSheet(),
diff --git a/apps/cua-spaces-web/src/bridge/connectors.ts b/apps/cua-spaces-web/src/bridge/connectors.ts
index c5c910e8d4..9063ebac22 100644
--- a/apps/cua-spaces-web/src/bridge/connectors.ts
+++ b/apps/cua-spaces-web/src/bridge/connectors.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Settings → Connectors and summoning agents in a Space: the
+ * Settings → Connections and summoning agents in a Space: the
* app core's `connectors.*` and `summon.*` (`connectors.rs`, `summon.rs`)
* over what the host already answers (`agents.setup`, `agentKeys.list`).
* Every word, state and rule is the core's; this file only shapes inputs
@@ -16,7 +16,7 @@ import type { AgentKeysInput, AgentKeyRowView } from "./agent-keys";
type Json = Record<string, unknown>;
-/* ---- Connectors ---------------------------------------------------------------- */
+/* ---- Connections --------------------------------------------------------------- */
export interface ConnectorAppInput {
agent: string;
@@ -36,6 +36,10 @@ export interface ConnectorsInput {
off: string[];
busy: { id: string; step: "connecting" | "signing-in" | "signing-out" }[];
failures: { id: string; line: string }[];
+ /** What is typed in the search of More providers. */
+ query?: string;
+ /** More providers is open (a search opens it too). */
+ moreOpen?: boolean;
}
export interface ConnectorButton {
@@ -54,12 +58,26 @@ export interface ConnectorAppRow {
openLabel: string;
}
+/** An app a connection works with: a chip that opens the app's page. */
+export interface WorkChip {
+ /** The app's setup id (`claude-code`, `codex`, `hermes`). */
+ agent: string;
+ name: string;
+}
+
export interface ConnectorProviderRow {
id: string;
label: string;
+ /** The icon's key (the page draws a mark of the initial when it has none). */
+ icon: string;
+ tier: "top" | "more";
state: "connected" | "not-connected" | "connecting" | "failed";
+ /** "Connected", "Needs reconnect", "Not connected", what is happening, or why it failed. */
status: string;
- detail: string;
+ /** What is saved, when connected ("API key •••• 3f9a"). */
+ credential: string | null;
+ worksWith: WorkChip[];
+ worksWithLabel: string;
button: ConnectorButton;
addedMs: number | null;
signOutEnvs: string[];
@@ -76,7 +94,14 @@ export interface ConnectorsView {
auto: boolean;
providersTitle: string;
providersFooter: string;
+ /** Up front, then any other that is connected or needs reconnecting. */
providers: ConnectorProviderRow[];
+ moreTitle: string;
+ moreSearchLabel: string;
+ /** The searchable list (empty while More providers is closed). */
+ moreProviders: ConnectorProviderRow[];
+ moreCount: number;
+ moreEmpty: string | null;
others: AgentKeyRowView[];
addOtherLabel: string;
otherHelp: string;
@@ -104,37 +129,81 @@ export interface ConnectPlan {
tools: boolean;
appToken: boolean;
device: boolean;
+ /** Open this provider's sheet: the first the app can use, with "Other providers" in it. */
provider: string | null;
tokenProvider: string | null;
}
+export interface FieldOption {
+ id: string;
+ label: string;
+}
+
+/** One field a way asks for besides the key: `region` is the plan or region, the others are `fields`. */
+export interface WayField {
+ id: string;
+ label: string;
+ kind: "text" | "url" | "choice";
+ placeholder: string;
+ required: boolean;
+ options: FieldOption[];
+ value: string;
+}
+
export interface ProviderWay {
- id: "app-token" | "app-device" | "token" | "key" | "shell";
+ id: "app-token" | "app-device" | "token" | "key" | "endpoint" | "shell";
+ /** The method kind from the provider file. */
+ kind: string;
+ method: string;
label: string;
help: string;
button: string;
app: string | null;
env: string | null;
+ /** `required` (a key or token is pasted), `optional` or `none`. */
+ secret: "required" | "optional" | "none";
+ fields: WayField[];
}
export interface ProviderSheetView {
provider: string;
+ icon: string;
title: string;
+ /** "Works with Claude Code, Hermes and OpenCode." */
lede: string;
+ worksWith: WorkChip[];
ways: ProviderWay[];
cancelLabel: string;
keyLabel: string;
keyPlaceholder: string;
keyHelp: string;
- /** The field when the person picks Paste a Claude token. */
tokenLabel: string;
tokenPlaceholder: string;
saveLabel: string;
- keyProvider: "anthropic" | "openai" | "other";
- keyEnv: string | null;
- /** "Or choose another provider", when opened for an app that signs in with more than one. */
- othersLabel: string | null;
- others: { provider: string; label: string }[];
+ /** Read before saving (a server on this machine). */
+ note: string | null;
+ /** "Other providers": opens the provider choice. */
+ switchLabel: string;
+}
+
+export interface ProviderChoice {
+ provider: string;
+ label: string;
+ icon: string;
+ tier: "top" | "more";
+ state: "connected" | "not-connected" | "connecting" | "failed";
+ status: string;
+}
+
+export interface ProviderPickerView {
+ title: string;
+ lede: string;
+ searchLabel: string;
+ items: ProviderChoice[];
+ moreLabel: string | null;
+ moreCount: number;
+ empty: string | null;
+ cancelLabel: string;
}
export interface ConnectorToggle {
@@ -195,6 +264,8 @@ export function connectorsInputOf(
off: extra.off ?? [],
busy: extra.busy ?? [],
failures: extra.failures ?? [],
+ query: extra.query ?? "",
+ moreOpen: extra.moreOpen ?? false,
};
}
@@ -210,11 +281,15 @@ export const providerSheet = (core: CoreClient, input: ConnectorsInput, provider
export const importSheet = (core: CoreClient, os: HostOs = hostOs()): ImportSheetView | null =>
core.tryCall<ImportSheetView>("connectors.importSheet", { hostOs: os }) ?? null;
+export const providerPicker = (core: CoreClient, input: ConnectorsInput, forApp: string | null = null, query = "", expanded = false): ProviderPickerView | null =>
+ core.tryCall<ProviderPickerView>("connectors.providerPicker", { input: input as unknown as Json, forApp, query, expanded }) ?? null;
+
export const appDetail = (core: CoreClient, input: ConnectorsInput, agent: string): AppDetailView | null =>
core.tryCall<AppDetailView | null>("connectors.appDetail", { input: input as unknown as Json, agent }) ?? null;
-export const setupCard = (core: CoreClient, input: ConnectorsInput, agent: string, name: string): SetupCardView | null =>
- core.tryCall<SetupCardView>("connectors.setupCard", { input: input as unknown as Json, agent, name }) ?? null;
+/** The card for an app that isn't connected; `provider` is the one a run said refused it, when it did. */
+export const setupCard = (core: CoreClient, input: ConnectorsInput, agent: string, name: string, provider: string | null = null): SetupCardView | null =>
+ core.tryCall<SetupCardView>("connectors.setupCard", { input: input as unknown as Json, agent, name, provider }) ?? null;
/* ---- Summoning agents in a Space ---------------------------------------------------- */
diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
index 6c3a142e0f..7fd5915233 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -181,11 +181,7 @@
"type": "object",
"properties": {
"provider": {
- "enum": [
- "anthropic",
- "openai",
- "other"
- ]
+ "type": "string"
},
"env": {
"type": "string"
@@ -201,6 +197,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
@@ -217,11 +222,7 @@
"type": "object",
"properties": {
"id": {
- "enum": [
- "anthropic",
- "openai",
- "other"
- ]
+ "type": "string"
},
"label": {
"type": "string"
@@ -9335,6 +9336,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
@@ -9407,6 +9417,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
@@ -9479,6 +9498,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
@@ -9551,6 +9579,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
@@ -9623,6 +9660,15 @@
},
"label": {
"type": "string"
+ },
+ "region": {
+ "type": "string"
+ },
+ "fields": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
},
"required": [
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 6aca58480c..3ca129cfda 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -566,8 +566,8 @@ const NotificationShape = ref(
const AgentKeysShape = ref(
"AgentKeysReport",
obj<AgentKeysReport>()({
- keys: list(object({ provider: oneOf("anthropic", "openai", "other"), env: str, last4: str, addedMs: num, expired: opt(bool), label: opt(str) })),
- providers: list(object({ id: oneOf("anthropic", "openai", "other"), label: str, env: str })),
+ keys: list(object({ provider: str, env: str, last4: str, addedMs: num, expired: opt(bool), label: opt(str), region: opt(str), fields: opt(dict(str)) })),
+ providers: list(object({ id: str, label: str, env: str })),
available: bool,
unavailable: nullable(str),
}),
@@ -1662,7 +1662,7 @@ const WkMachinesShape = ref(
/** The daemon's `agent_keys.*` answer, which `agentKeysFromWire` reads. */
const AgentKeysWire = object({
- keys: list(object({ provider: str, env: str, last4: str, added_ms: num, expired: opt(bool), label: opt(str) })),
+ keys: list(object({ provider: str, env: str, last4: str, added_ms: num, expired: opt(bool), label: opt(str), region: opt(str), fields: opt(dict(str)) })),
providers: list(object({ id: str, env: str, label: opt(str) })),
available: bool,
unavailable: optNull(str),
diff --git a/apps/cua-spaces-web/src/bridge/generated/providers.ts b/apps/cua-spaces-web/src/bridge/generated/providers.ts
new file mode 100644
index 0000000000..a9d892f945
--- /dev/null
+++ b/apps/cua-spaces-web/src/bridge/generated/providers.ts
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// Generated by `cargo run -p cua-connections --bin cua-connections-gen` from
+// libs/cua/crates/cua-connections/providers/*.toml. Do not edit.
+
+export interface ProviderEntry {
+ id: string;
+ name: string;
+ icon: string;
+ tier: "top" | "more";
+ aliases: string[];
+ /** The variable a key for it is saved as. */
+ keyEnv: string;
+}
+
+/** The providers a person can see, in rank order. */
+export const PROVIDER_REGISTRY: ProviderEntry[] = [
+ { id: "anthropic", name: "Anthropic", icon: "anthropic", tier: "top", aliases: [], keyEnv: "ANTHROPIC_API_KEY" },
+ { id: "openai", name: "OpenAI", icon: "openai", tier: "top", aliases: [], keyEnv: "OPENAI_API_KEY" },
+ { id: "openrouter", name: "OpenRouter", icon: "openrouter", tier: "top", aliases: [], keyEnv: "OPENROUTER_API_KEY" },
+ { id: "google", name: "Google AI Studio", icon: "google", tier: "top", aliases: ["gemini", "google ai", "aistudio"], keyEnv: "GEMINI_API_KEY" },
+ { id: "xai", name: "xAI", icon: "xai", tier: "top", aliases: ["grok"], keyEnv: "XAI_API_KEY" },
+ { id: "deepseek", name: "DeepSeek", icon: "deepseek", tier: "top", aliases: [], keyEnv: "DEEPSEEK_API_KEY" },
+ { id: "kimi", name: "Kimi (Moonshot)", icon: "kimi", tier: "top", aliases: ["moonshot", "kimi code"], keyEnv: "KIMI_API_KEY" },
+ { id: "github", name: "GitHub Copilot", icon: "github", tier: "more", aliases: ["copilot", "github copilot cli"], keyEnv: "COPILOT_GITHUB_TOKEN" },
+ { id: "huggingface", name: "Hugging Face", icon: "huggingface", tier: "more", aliases: ["hf"], keyEnv: "HF_TOKEN" },
+ { id: "zai", name: "Z.AI (GLM)", icon: "zai", tier: "more", aliases: ["glm", "zhipu", "z.ai"], keyEnv: "GLM_API_KEY" },
+ { id: "fireworks", name: "Fireworks AI", icon: "fireworks", tier: "more", aliases: ["fw"], keyEnv: "FIREWORKS_API_KEY" },
+ { id: "nvidia", name: "NVIDIA NIM", icon: "nvidia", tier: "more", aliases: ["nim", "nemotron", "build.nvidia.com"], keyEnv: "NVIDIA_API_KEY" },
+ { id: "ollama-cloud", name: "Ollama Cloud", icon: "ollama-cloud", tier: "more", aliases: ["ollama"], keyEnv: "OLLAMA_API_KEY" },
+ { id: "deepinfra", name: "DeepInfra", icon: "deepinfra", tier: "more", aliases: ["deep infra"], keyEnv: "DEEPINFRA_API_KEY" },
+ { id: "novita", name: "Novita AI", icon: "novita", tier: "more", aliases: ["novitaai"], keyEnv: "NOVITA_API_KEY" },
+ { id: "nebius-token-factory", name: "Nebius Token Factory", icon: "nebius-token-factory", tier: "more", aliases: ["nebius"], keyEnv: "NEBIUS_API_KEY" },
+ { id: "gmi", name: "GMI Cloud", icon: "gmi", tier: "more", aliases: ["gmicloud"], keyEnv: "GMI_API_KEY" },
+ { id: "upstage", name: "Upstage Solar", icon: "upstage", tier: "more", aliases: ["solar"], keyEnv: "UPSTAGE_API_KEY" },
+ { id: "arcee", name: "Arcee AI", icon: "arcee", tier: "more", aliases: ["trinity"], keyEnv: "ARCEEAI_API_KEY" },
+ { id: "ai-gateway", name: "Vercel AI Gateway", icon: "ai-gateway", tier: "more", aliases: ["vercel"], keyEnv: "AI_GATEWAY_API_KEY" },
+ { id: "opencode-zen", name: "OpenCode Zen", icon: "opencode-zen", tier: "more", aliases: ["zen"], keyEnv: "OPENCODE_ZEN_API_KEY" },
+ { id: "opencode-go", name: "OpenCode Go", icon: "opencode-go", tier: "more", aliases: ["go"], keyEnv: "OPENCODE_GO_API_KEY" },
+ { id: "kilocode", name: "Kilo Code", icon: "kilocode", tier: "more", aliases: ["kilo"], keyEnv: "KILOCODE_API_KEY" },
+ { id: "xiaomi", name: "Xiaomi MiMo", icon: "xiaomi", tier: "more", aliases: ["mimo"], keyEnv: "XIAOMI_API_KEY" },
+ { id: "stepfun", name: "StepFun", icon: "stepfun", tier: "more", aliases: ["step"], keyEnv: "STEPFUN_API_KEY" },
+ { id: "minimax", name: "MiniMax", icon: "minimax", tier: "more", aliases: ["mini-max"], keyEnv: "MINIMAX_API_KEY" },
+ { id: "alibaba", name: "Qwen Cloud (Alibaba)", icon: "alibaba", tier: "more", aliases: ["qwen", "dashscope", "alibaba cloud"], keyEnv: "DASHSCOPE_API_KEY" },
+ { id: "custom", name: "Custom endpoint", icon: "custom", tier: "top", aliases: ["openai compatible", "lm studio", "ollama", "vllm", "llama.cpp", "litellm", "local server", "gateway", "proxy"], keyEnv: "CUSTOM_ENDPOINT_API_KEY" },
+];
+
+/** The kinds of way to connect a provider (a closed set). */
+export const METHOD_KINDS = ["api_key", "import_login", "device_code", "browser_oauth", "subscription_login", "adc", "local_server", "custom_endpoint"] as const;
diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.ts
index ce26442129..f2820e11a2 100644
--- a/apps/cua-spaces-web/src/bridge/index.ts
+++ b/apps/cua-spaces-web/src/bridge/index.ts
@@ -68,7 +68,7 @@ export {
type AgentKeysInput,
type AgentKeysView,
} from "./agent-keys";
-export type { AgentKeyInfo, AgentKeyProvider, AgentKeysReport } from "./ops/agent-keys";
+export type { AgentKeyInfo, AgentKeyProvider, AgentKeysReport, KeyChoices } from "./ops/agent-keys";
export { connectionRows, useConnections, type ConnectionsHook, type ConnectionReport, type ConnectionRow, type ConnectionRowView, type ConnectResult } from "./connections";
export {
DEFAULT_SETTINGS,
diff --git a/apps/cua-spaces-web/src/bridge/ops/agent-keys.ts b/apps/cua-spaces-web/src/bridge/ops/agent-keys.ts
index f8d7a37f0b..524ab54b06 100644
--- a/apps/cua-spaces-web/src/bridge/ops/agent-keys.ts
+++ b/apps/cua-spaces-web/src/bridge/ops/agent-keys.ts
@@ -2,8 +2,8 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Settings → Connectors: the provider keys agents get (Anthropic, OpenAI and
- * other keys by variable name). The cua daemon keeps them in the Keychain
+ * Settings → Connections: the provider keys agents get (one per provider of
+ * the registry, and other keys by variable name). The cua daemon keeps them in the Keychain
* (`cua_spaces::agents::keys`) and gives each one only to the runs whose
* harness reads it. Each operation is one of the daemon's app methods over
* `SpaceService.CallSpaceTool` (`agent_keys.list`, `agent_keys.set`,
@@ -26,8 +26,8 @@
import type { OpCoverage } from "../coverage";
import type { OpArgs, OpResult } from "../protocol";
-/** `anthropic` and `openai` have their own rows; anything else is `other`. */
-export type AgentKeyProvider = "anthropic" | "openai" | "other";
+/** A provider id of the registry (`anthropic`, `deepseek`, `custom`, ...), or `other` for a key saved by variable name. */
+export type AgentKeyProvider = string;
/** A stored key as the daemon describes it (`keys::KeyInfo`). Never its value. */
export interface AgentKeyInfo {
@@ -42,6 +42,18 @@ export interface AgentKeyInfo {
expired?: boolean;
/** A copied sign-in's name ("Signed in as [email protected] (Claude Max)"); never a value. */
label?: string;
+ /** The plan or region chosen for it (Z.AI), when the provider has them. */
+ region?: string;
+ /** Non-secret values saved with it: a custom endpoint's `base_url`, `model` and `wire`, or a `model`. */
+ fields?: Record<string, string>;
+}
+
+/** The non-secret choices a connection carries (`agentKeys.set`, `agentKeys.fromShell`). */
+export interface KeyChoices {
+ /** A plan or region the provider lists. */
+ region?: string | null;
+ /** `model`, and for a custom endpoint `base_url` and `wire`. */
+ fields?: Record<string, string>;
}
/** A provider row (`keys::Provider`). */
@@ -73,13 +85,13 @@ declare module "../protocol" {
*/
"agentKeys.check": { args: Record<string, never>; result: AgentKeysReport };
/** Adds or replaces a key; `env` names an `other` key. Answers the list after. */
- "agentKeys.set": { args: { provider: AgentKeyProvider; env?: string | null; value: string }; result: AgentKeysReport };
+ "agentKeys.set": { args: { provider: AgentKeyProvider; env?: string | null; value: string } & KeyChoices; result: AgentKeysReport };
/** Removes the key named `env`. Answers the list after. */
"agentKeys.remove": { args: { env: string }; result: AgentKeysReport };
/** Which provider keys your login shell has set (names only; never a value). */
"agentKeys.shell": { args: Record<string, never>; result: { names: string[] } };
/** Saves the key `env` from your login shell (the value goes straight to the store). Answers the list after. */
- "agentKeys.fromShell": { args: { env: string }; result: AgentKeysReport };
+ "agentKeys.fromShell": { args: { env: string } & KeyChoices; result: AgentKeysReport };
}
}
@@ -128,7 +140,13 @@ const PROVIDERS: AgentKeyProviderRow[] = [
const str = (v: unknown) => (typeof v === "string" ? v : "");
/** A sign-in's name: one short line of text, else none. */
const label = (v: unknown): string => (typeof v === "string" && v.length <= 160 && !/[\u0000-\u001f]/.test(v) ? v.trim() : "");
-const providerOf = (v: unknown): AgentKeyProvider => (v === "anthropic" || v === "openai" ? v : "other");
+const providerOf = (v: unknown): AgentKeyProvider => (typeof v === "string" && /^[a-z0-9-]{1,40}$/.test(v) ? v : "other");
+/** A short plain line, else none (a region id, a field value). */
+const line = (v: unknown): string => (typeof v === "string" && v.length <= 512 && !/[\u0000-\u001f]/.test(v) ? v.trim() : "");
+const fieldsOf = (v: unknown): Record<string, string> => {
+ if (!v || typeof v !== "object" || Array.isArray(v)) return {};
+ return Object.fromEntries(Object.entries(v as Record<string, unknown>).flatMap(([k, x]) => (/^[a-z_]{1,24}$/.test(k) && line(x) ? [[k, line(x)]] : [])));
+};
/** The daemon's `KeysReport` (snake_case) as the page reads it. Drops anything
* that looks like a value, so a host that answered one would not show it. */
@@ -140,7 +158,7 @@ export function agentKeysFromWire(raw: unknown): AgentKeysReport {
const env = str(r.env);
if (!env) return [];
const added = r.added_ms ?? r.addedMs;
- return [{ provider: providerOf(r.provider), env, last4: str(r.last4).slice(-4), addedMs: typeof added === "number" ? added : 0, ...(r.expired === true ? { expired: true } : {}), ...(label(r.label) ? { label: label(r.label) } : {}) }];
+ return [{ provider: providerOf(r.provider), env, last4: str(r.last4).slice(-4), addedMs: typeof added === "number" ? added : 0, ...(r.expired === true ? { expired: true } : {}), ...(label(r.label) ? { label: label(r.label) } : {}), ...(line(r.region) ? { region: line(r.region) } : {}), ...(Object.keys(fieldsOf(r.fields)).length ? { fields: fieldsOf(r.fields) } : {}) }];
});
const providers = (Array.isArray(o.providers) ? o.providers : []).flatMap((p): AgentKeyProviderRow[] => {
const r = (p ?? {}) as Record<string, unknown>;
@@ -156,8 +174,12 @@ export function agentKeysFromWire(raw: unknown): AgentKeysReport {
}
/** The arguments `agent_keys.set` takes. */
-const setArgs = ({ provider, env, value }: OpArgs<"agentKeys.set">) =>
- provider === "other" ? { provider, env: (env ?? "").trim(), value } : { provider, value };
+const choicesOf = ({ region, fields }: KeyChoices) => ({
+ ...(region ? { region } : {}),
+ ...(fields && Object.keys(fields).length ? { fields } : {}),
+});
+const setArgs = ({ provider, env, value, region, fields }: OpArgs<"agentKeys.set">) =>
+ provider === "other" ? { provider, env: (env ?? "").trim(), value, ...choicesOf({ region, fields }) } : { provider, value, ...choicesOf({ region, fields }) };
type Handlers = { [K in AgentKeysOp]: (args: OpArgs<K>) => Promise<OpResult<K>> };
type Invoke = <T>(cmd: string, args?: Record<string, unknown>) => Promise<T>;
@@ -179,7 +201,7 @@ export function tauriAgentKeysOps(invoke: Invoke): Handlers {
"agentKeys.set": (args) => tool("agentKeys.set", setArgs(args)),
"agentKeys.remove": ({ env }) => tool("agentKeys.remove", { env }),
"agentKeys.shell": async () => shellNamesFromWire(await invoke<unknown>("agents_tool", { tool: AGENT_KEYS_METHODS["agentKeys.shell"], args: {} })),
- "agentKeys.fromShell": ({ env }) => tool("agentKeys.fromShell", { env }),
+ "agentKeys.fromShell": ({ env, region, fields }) => tool("agentKeys.fromShell", { env, ...choicesOf({ region, fields }) }),
};
}
@@ -192,6 +214,6 @@ export function webkitAgentKeysOps(request: Request): Handlers {
"agentKeys.set": (args) => call("agentKeys.set", setArgs(args)),
"agentKeys.remove": ({ env }) => call("agentKeys.remove", { env }),
"agentKeys.shell": async () => shellNamesFromWire(await request<unknown>("agentKeys.shell", {})),
- "agentKeys.fromShell": ({ env }) => call("agentKeys.fromShell", { env }),
+ "agentKeys.fromShell": ({ env, region, fields }) => call("agentKeys.fromShell", { env, ...choicesOf({ region, fields }) }),
};
}
diff --git a/apps/cua-spaces-web/src/bridge/parity-agent-keys.ts b/apps/cua-spaces-web/src/bridge/parity-agent-keys.ts
index a67ca0ce40..784422125b 100644
--- a/apps/cua-spaces-web/src/bridge/parity-agent-keys.ts
+++ b/apps/cua-spaces-web/src/bridge/parity-agent-keys.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * The parity replay for Settings → Connectors (`agent-keys`): the core calls the
+ * The parity replay for Settings → Connections (`agent-keys`): the core calls the
* section makes go through the bridge's own functions (`agent-keys.ts`), and
* the states they reach are recorded for the Playwright harness to put on
* the real screen (`window.__cuaParity.showAgentKeys`). See `parity.ts`.
@@ -54,7 +54,7 @@ export function agentKeysParityMethods(core: CoreClient, record: (c: AgentKeysCh
}
export interface AgentKeysParityHandle {
- /** Settings → Connectors for this input, with a sheet or a Remove question open. */
+ /** Settings → Connections for this input, with a sheet or a Remove question open. */
showAgentKeys(input: AgentKeysInput, open?: { sheet?: { provider: AgentKeyProvider; env: string | null } | null; removing?: string | null }): void;
}
diff --git a/apps/cua-spaces-web/src/components/agents/agent-chat.tsx b/apps/cua-spaces-web/src/components/agents/agent-chat.tsx
index e7bfa5dc96..8cf4a164d8 100644
--- a/apps/cua-spaces-web/src/components/agents/agent-chat.tsx
+++ b/apps/cua-spaces-web/src/components/agents/agent-chat.tsx
@@ -459,8 +459,8 @@ export function AgentsEmpty({ onStart, onConnect }: { onStart: () => void; onCon
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- // Connecting an app is its switch in Settings, Connectors: this opens it at that app.
- const connect = (agent: string) => void navigate({ to: "/settings/connectors", search: { app: agent } });
+ // Connecting an app is its switch in Settings, Connections: this opens it at that app.
+ const connect = (agent: string) => void navigate({ to: "/settings/connections", search: { app: agent } });
return (
<div data-agents-empty="" className="flex min-w-0 flex-1 items-center justify-center">
<div className="w-[min(520px,100%)] px-6">
diff --git a/apps/cua-spaces-web/src/components/agents/agents-empty.tsx b/apps/cua-spaces-web/src/components/agents/agents-empty.tsx
index dbdf311aa2..0cbe814608 100644
--- a/apps/cua-spaces-web/src/components/agents/agents-empty.tsx
+++ b/apps/cua-spaces-web/src/components/agents/agents-empty.tsx
@@ -21,7 +21,7 @@ export function nameList(names: string[]): string {
/**
* The Agents page before any run. It says what to do next, by what is true
* on this computer: coding apps found but Cua not in them yet (their marks
- * and a button to Settings, Connectors, where each has its switch); Cua already in them (the first prompts to
+ * and a button to Settings, Connections, where each has its switch); Cua already in them (the first prompts to
* try); or no coding app found.
*/
export function AgentsEmpty() {
@@ -47,8 +47,8 @@ export function AgentsEmpty() {
const todo = installed.filter((r) => !r.configured);
const state = installed.length === 0 ? "none" : ready.length === 0 ? "setup" : "ready";
- // Connecting is its switch in Settings, Connectors: open it at the first app waiting for Cua.
- const openConnectors = (agent?: string) => void navigate({ to: "/settings/connectors", search: { app: agent } });
+ // Connecting is its switch in Settings, Connections: open it at the first app waiting for Cua.
+ const openConnectors = (agent?: string) => void navigate({ to: "/settings/connections", search: { app: agent } });
return (
<div className="mx-auto flex w-full max-w-xl flex-col items-center pt-8 text-center" data-agents-empty={state}>
diff --git a/apps/cua-spaces-web/src/components/ask-first/ask-box.tsx b/apps/cua-spaces-web/src/components/ask-first/ask-box.tsx
index a0227ecbab..9dc584611e 100644
--- a/apps/cua-spaces-web/src/components/ask-first/ask-box.tsx
+++ b/apps/cua-spaces-web/src/components/ask-first/ask-box.tsx
@@ -178,7 +178,7 @@ export function AskBox({
<ChevronDownIcon className="size-4 text-muted-foreground" />
</button>
}
- footer="It works on the new computer, signed in with the key you saved in Settings → Connectors."
+ footer="It works on the new computer, signed in with the key you saved in Settings → Connections."
>
{TASK_AGENTS.map((a) => (
<PickerRow key={a.id} icon={<AppMark agent={a.id} size={28} />} title={a.name} note={agentNote(a.id)} selected={a.id === agent} onSelect={() => onAgent(a.id)} />
diff --git a/apps/cua-spaces-web/src/components/ask-first/task-view.tsx b/apps/cua-spaces-web/src/components/ask-first/task-view.tsx
index c66991556e..bcdabd5148 100644
--- a/apps/cua-spaces-web/src/components/ask-first/task-view.tsx
+++ b/apps/cua-spaces-web/src/components/ask-first/task-view.tsx
@@ -288,7 +288,7 @@ export function StartFailed({ error, name, agent, host, onRetry }: { error: stri
const view = startErrorView(error, name);
const { core } = useBridge();
const connectors = useConnectors();
- // "Connect <app>" in place of Add your key: Settings, Connectors' Connect, here; then it starts again by itself.
+ // "Connect <app>" in place of Add your key: Settings, Connections' Connect, here; then it starts again by itself.
const setupId = TASK_AGENTS.find((a) => a.id === agent)?.setupId ?? agent ?? "";
const card = view.action === "add-key" ? setupCard(core, connectors.input, setupId, name) : null;
const [connecting, setConnecting] = useState(false);
diff --git a/apps/cua-spaces-web/src/components/settings/connectors/app-detail.tsx b/apps/cua-spaces-web/src/components/settings/connections/app-detail.tsx
similarity index 94%
rename from apps/cua-spaces-web/src/components/settings/connectors/app-detail.tsx
rename to apps/cua-spaces-web/src/components/settings/connections/app-detail.tsx
index 8a00ed34f7..2dbcd014ba 100644
--- a/apps/cua-spaces-web/src/components/settings/connectors/app-detail.tsx
+++ b/apps/cua-spaces-web/src/components/settings/connections/app-detail.tsx
@@ -16,7 +16,7 @@ import { BY_HAND } from "@/lib/connected-apps";
import { cn } from "@/lib/utils";
/**
- * One coding app's page (Settings, Connectors, the row's chevron): Connect
+ * One coding app's page (Settings, Connections, the row's chevron): Connect
* while it isn't, the separate switches (Cua skills, Cua tools, Keep it set
* up), which provider it signs in with and how, Sign in or Sign out, the
* settings file, adding Cua by hand, and Remove. The core's
@@ -27,7 +27,7 @@ export function ConnectorAppPage({ agent }: { agent: string }) {
const { hereName } = useThisAndOthers();
const d = c.detail(agent);
const back = (
- <Link to="/settings/connectors" className="-ml-1 mb-4 inline-flex items-center gap-0.5 rounded-lg px-1 py-0.5 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60" data-connector-back="">
+ <Link to="/settings/connections" className="-ml-1 mb-4 inline-flex items-center gap-0.5 rounded-lg px-1 py-0.5 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60" data-connector-back="">
<ChevronLeftIcon className="size-4" /> {d?.backLabel ?? "Connectors"}
</Link>
);
diff --git a/apps/cua-spaces-web/src/components/settings/connectors/connectors-page.tsx b/apps/cua-spaces-web/src/components/settings/connections/connectors-page.tsx
similarity index 70%
rename from apps/cua-spaces-web/src/components/settings/connectors/connectors-page.tsx
rename to apps/cua-spaces-web/src/components/settings/connections/connectors-page.tsx
index f7664debec..a7bb0129cc 100644
--- a/apps/cua-spaces-web/src/components/settings/connectors/connectors-page.tsx
+++ b/apps/cua-spaces-web/src/components/settings/connections/connectors-page.tsx
@@ -5,7 +5,7 @@ import { useNavigate } from "@tanstack/react-router";
import { CheckIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, Loader2Icon, TriangleAlertIcon } from "lucide-react";
import { lazy, Suspense, useEffect, useState, type KeyboardEvent, type MouseEvent } from "react";
-import { useAgentKeys, useBridge, useKeysRecheck, type ConnectorAppRow, type ConnectorProviderRow } from "@/bridge";
+import { useAgentKeys, useBridge, useKeysRecheck, type ConnectorAppRow, type ConnectorProviderRow, type WorkChip } from "@/bridge";
import { OtherMachineBlock, useThisAndOthers } from "@/components/agents/other-machine-block";
import { HarnessMark } from "@/components/agents/harness-mark";
import { KeySheet } from "@/components/agents/key-sheet";
@@ -13,6 +13,8 @@ import { SettingsGroup, SettingsRow } from "@/components/settings-group";
import { ConfirmDialog } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { GroupedAction, GroupedRow } from "@/components/ui/grouped";
+import { Input } from "@/components/ui/input";
+import { ProviderMark } from "@/components/settings/connections/provider-mark";
import { Switch } from "@/components/ui/switch";
import { toastError } from "@/components/ui/toast";
import { useConnectors, type Connectors } from "@/hooks/use-connectors";
@@ -23,11 +25,11 @@ import { cn } from "@/lib/utils";
const DriverSettingsCard = lazy(() => import("@/components/volume/driver-card").then((m) => ({ default: m.DriverSettingsCard })));
/**
- * Settings, Connectors: Coding apps, each with Connect (Cua's
- * tools and the app's sign-in, once) and a chevron to its own page; then
- * Providers, each with Connect (the provider's sign-in where there is one
- * for this, else a key) or Sign out. Every word and state is the core's
- * (`connectors.view`).
+ * Settings, Connections: the providers (each with its state, the apps it
+ * works with and Connect, Reconnect or Disconnect), then More providers with
+ * a search; Coding apps, each with Connect (Cua's tools and the app's
+ * sign-in, once) and a chevron to its own page. Every word and state is the
+ * core's (`connectors.view`).
*/
export function ConnectorsRedesign({ focusApp }: { focusApp?: string }) {
const c = useConnectors();
@@ -51,7 +53,7 @@ export function ConnectorsRedesign({ focusApp }: { focusApp?: string }) {
}, [Boolean(view), focusApp]); // eslint-disable-line react-hooks/exhaustive-deps
if (!view || c.apps.rows === null) return <div className="mb-8 h-48" aria-busy="true" />;
- const open = (agent: string) => void navigate({ to: "/settings/connectors/$app", params: { app: agent } });
+ const open = (agent: string) => void navigate({ to: "/settings/connections/$app", params: { app: agent } });
const confirm = keys.removing ? keys.removeConfirmOf(keys.removing) : null;
return (
@@ -63,6 +65,71 @@ export function ConnectorsRedesign({ focusApp }: { focusApp?: string }) {
</div>
) : null}
+ <SettingsGroup title={view.providersTitle} footer={view.providersFooter} data-connectors-providers="">
+ {view.providers.map((p) => (
+ <ProviderRow key={p.id} row={p} addedLabel={view.addedLabel} c={c} onOpenApp={open} />
+ ))}
+ </SettingsGroup>
+
+ <SettingsGroup title={view.moreTitle} data-connectors-more="">
+ <GroupedRow className="gap-2">
+ <Input
+ type="search"
+ data-connectors-search=""
+ aria-label={view.moreSearchLabel}
+ placeholder={view.moreSearchLabel}
+ value={c.input.query ?? ""}
+ autoComplete="off"
+ spellCheck={false}
+ onChange={(e) => c.searchMore(e.currentTarget.value)}
+ className="h-8 flex-1"
+ />
+ {c.input.moreOpen || (c.input.query ?? "").trim() ? (
+ <Button size="sm" variant="ghost" data-connectors-more-toggle="" onClick={() => c.searchMore("", false)}>
+ Hide
+ </Button>
+ ) : (
+ <Button size="sm" variant="outline" data-connectors-more-toggle="" onClick={() => c.searchMore("", true)}>
+ Show all {view.moreCount}
+ </Button>
+ )}
+ </GroupedRow>
+ {view.moreProviders.map((p) => (
+ <ProviderRow key={p.id} row={p} addedLabel={view.addedLabel} c={c} onOpenApp={open} />
+ ))}
+ {view.moreEmpty ? (
+ <GroupedRow className="text-muted-foreground" data-connectors-more-empty="">
+ {view.moreEmpty}
+ </GroupedRow>
+ ) : null}
+ {view.others.map((r) => (
+ <GroupedRow key={r.env} data-agent-key-row={r.env}>
+ <div className="min-w-0 flex-1">
+ <div className="truncate font-mono text-[12px]">{r.title}</div>
+ <div className="truncate text-xs text-muted-foreground">{r.detail}</div>
+ </div>
+ <span className="font-mono text-[12px] text-muted-foreground">{r.status}</span>
+ <Button size="sm" variant="outline" disabled={!view.canEdit} onClick={() => keys.openSheet("other", r.env)}>
+ {r.actionLabel}
+ </Button>
+ {r.removeLabel ? (
+ <Button size="sm" variant="ghost" disabled={!view.canEdit} onClick={() => keys.askRemove(r.env)}>
+ {r.removeLabel}
+ </Button>
+ ) : null}
+ </GroupedRow>
+ ))}
+ <SettingsRow
+ label={view.addOtherLabel}
+ description={view.otherHelp}
+ control={
+ <Button size="sm" variant="outline" disabled={!view.canEdit} onClick={() => keys.openSheet("other")} data-agent-key-add-other="">
+ Add key
+ </Button>
+ }
+ />
+ </SettingsGroup>
+
<SettingsGroup
title={view.appsTitle}
data-connectors-apps=""
@@ -127,38 +194,6 @@ export function ConnectorsRedesign({ focusApp }: { focusApp?: string }) {
{otherOpen ? <OtherMachineBlock /> : null}
</SettingsGroup>
- <SettingsGroup title={view.providersTitle} footer={view.providersFooter} data-connectors-providers="">
- {view.providers.map((p) => (
- <ProviderRow key={p.id} row={p} addedLabel={view.addedLabel} c={c} />
- ))}
- {view.others.map((r) => (
- <GroupedRow key={r.env} data-agent-key-row={r.env}>
- <div className="min-w-0 flex-1">
- <div className="truncate font-mono text-[12px]">{r.title}</div>
- <div className="truncate text-xs text-muted-foreground">{r.detail}</div>
- </div>
- <span className="font-mono text-[12px] text-muted-foreground">{r.status}</span>
- <Button size="sm" variant="outline" disabled={!view.canEdit} onClick={() => keys.openSheet("other", r.env)}>
- {r.actionLabel}
- </Button>
- {r.removeLabel ? (
- <Button size="sm" variant="ghost" disabled={!view.canEdit} onClick={() => keys.askRemove(r.env)}>
- {r.removeLabel}
- </Button>
- ) : null}
- </GroupedRow>
- ))}
- <SettingsRow
- label={view.addOtherLabel}
- description={view.otherHelp}
- control={
- <Button size="sm" variant="outline" disabled={!view.canEdit} onClick={() => keys.openSheet("other")} data-agent-key-add-other="">
- Add key
- </Button>
- }
- />
- </SettingsGroup>
-
{keys.sheet ? <KeySheet key={`${keys.sheet.provider}:${keys.sheet.env ?? ""}`} keys={keys} provider={keys.sheet.provider} env={keys.sheet.env} /> : null}
<ConfirmDialog
open={confirm !== null}
@@ -225,30 +260,70 @@ function AppRow({ row, lit, onOpen, onConnect }: { row: ConnectorAppRow; lit: bo
);
}
-function ProviderRow({ row, addedLabel, c }: { row: ConnectorProviderRow; addedLabel: string; c: Connectors }) {
+/** How many of the apps a connection works with show as chips; the rest are a count. */
+const CHIPS_SHOWN = 4;
+
+function ProviderRow({ row, addedLabel, c, onOpenApp }: { row: ConnectorProviderRow; addedLabel: string; c: Connectors; onOpenApp: (agent: string) => void }) {
const connected = row.state === "connected";
+ const needsReconnect = row.status === "Needs reconnect";
return (
- <GroupedRow data-connector-provider={row.id} data-state={row.state} className="min-h-12">
+ <GroupedRow data-connector-provider={row.id} data-state={row.state} className="min-h-14 items-start py-3">
+ <ProviderMark id={row.id} name={row.label} />
<div className="min-w-0 flex-1">
<div className="truncate">{row.label}</div>
- <div className="truncate text-xs text-muted-foreground">{row.detail}</div>
+ {row.credential ? (
+ <div className="truncate text-xs text-muted-foreground" data-connector-credential="">
+ {row.credential}
+ </div>
+ ) : null}
+ {row.worksWith.length ? <WorkChips chips={row.worksWith} label={row.worksWithLabel} onOpen={onOpenApp} /> : null}
</div>
- <div className="flex shrink-0 flex-col items-end">
- <span className={cn("flex items-center gap-1.5 text-[13px]", connected ? "" : row.state === "failed" ? "text-destructive" : "text-muted-foreground")} data-connector-status="">
- {row.state === "connecting" ? <Loader2Icon className="size-3.5 animate-spin" /> : connected ? <CheckIcon className="size-3.5 text-success" /> : null}
+ <div className="flex shrink-0 flex-col items-end gap-1.5">
+ <span
+ className={cn("flex items-center gap-1.5 text-[13px]", connected ? "" : row.state === "failed" || needsReconnect ? "text-destructive" : "text-muted-foreground")}
+ data-connector-status=""
+ >
+ {row.state === "connecting" ? <Loader2Icon className="size-3.5 animate-spin" /> : connected ? <CheckIcon className="size-3.5 text-success" /> : needsReconnect ? <TriangleAlertIcon className="size-3.5" /> : null}
{row.status}
</span>
{row.addedMs !== null ? <span className="text-[11px] text-muted-foreground">{addedText(addedLabel, row.addedMs)}</span> : null}
+ <Button
+ size="sm"
+ variant={connected ? "ghost" : "outline"}
+ disabled={!row.button.enabled}
+ data-connector-provider-action={row.button.id}
+ onClick={() => (row.button.id === "sign-out" ? void c.signOut(row.id) : c.openProvider(row.id))}
+ >
+ {row.button.label}
+ </Button>
</div>
- <Button
- size="sm"
- variant={connected ? "ghost" : "outline"}
- disabled={!row.button.enabled}
- data-connector-provider-action={row.button.id}
- onClick={() => (row.button.id === "sign-out" ? void c.signOut(row.id) : c.openProvider(row.id))}
- >
- {row.button.label}
- </Button>
</GroupedRow>
);
}
+
+/** The apps a connection works with, each a small button to that app's page. */
+function WorkChips({ chips, label, onOpen }: { chips: WorkChip[]; label: string; onOpen: (agent: string) => void }) {
+ const shown = chips.slice(0, CHIPS_SHOWN);
+ const rest = chips.length - shown.length;
+ return (
+ <div className="mt-1.5 flex flex-wrap items-center gap-1" data-connector-works-with="">
+ <span className="mr-0.5 text-xs text-muted-foreground">{label}</span>
+ {shown.map((chip) => (
+ <button
+ key={chip.agent}
+ type="button"
+ data-connector-chip={chip.agent}
+ onClick={() => onOpen(chip.agent)}
+ className="cursor-default rounded-lg bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60"
+ >
+ {chip.name}
+ </button>
+ ))}
+ {rest > 0 ? (
+ <span className="px-0.5 text-[11px] text-muted-foreground" title={chips.slice(CHIPS_SHOWN).map((x) => x.name).join(", ")} data-connector-chips-more="">
+ and {rest} more
+ </span>
+ ) : null}
+ </div>
+ );
+}
diff --git a/apps/cua-spaces-web/src/components/settings/connections/provider-mark.tsx b/apps/cua-spaces-web/src/components/settings/connections/provider-mark.tsx
new file mode 100644
index 0000000000..87d9047212
--- /dev/null
+++ b/apps/cua-spaces-web/src/components/settings/connections/provider-mark.tsx
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { HarnessMark } from "@/components/agents/harness-mark";
+
+/** The providers whose maker's mark Cua already ships with an app, keyed by the app's id. */
+const MARK_OF: Record<string, string> = {
+ anthropic: "claude-code",
+ openai: "codex",
+ google: "gemini-cli",
+ github: "copilot-cli",
+};
+
+/** A provider in a small tile: its maker's mark where there is one, else a neutral tile with its initial. */
+export function ProviderMark({ id, name, large }: { id: string; name: string; large?: boolean }) {
+ return (
+ <span data-provider-mark={id} className="contents">
+ <HarnessMark agent={MARK_OF[id] ?? `provider:${id}`} name={name} large={large} />
+ </span>
+ );
+}
diff --git a/apps/cua-spaces-web/src/components/settings/connectors/provider-sheet.tsx b/apps/cua-spaces-web/src/components/settings/connections/provider-sheet.tsx
similarity index 53%
rename from apps/cua-spaces-web/src/components/settings/connectors/provider-sheet.tsx
rename to apps/cua-spaces-web/src/components/settings/connections/provider-sheet.tsx
index bcea072b8f..d2bc23b4bb 100644
--- a/apps/cua-spaces-web/src/components/settings/connectors/provider-sheet.tsx
+++ b/apps/cua-spaces-web/src/components/settings/connections/provider-sheet.tsx
@@ -1,23 +1,30 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-import { CheckIcon, ChevronLeftIcon, ChevronRightIcon, CopyIcon, KeyRoundIcon, Loader2Icon, LogInIcon, SmartphoneIcon, TerminalIcon } from "lucide-react";
+import { CheckIcon, ChevronLeftIcon, ChevronRightIcon, CopyIcon, KeyRoundIcon, Loader2Icon, LogInIcon, ServerIcon, SmartphoneIcon, TerminalIcon } from "lucide-react";
import { useEffect, useState } from "react";
-import { importSheet, useBridge, type ProviderWay } from "@/bridge";
+import { importSheet, useBridge, type ProviderWay, type WayField } from "@/bridge";
+import { ProviderMark } from "@/components/settings/connections/provider-mark";
import { Button } from "@/components/ui/button";
import { Dialog, DialogDescription, DialogPopup, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
+import { Select } from "@/components/ui/select";
import { useSession } from "@/bridge";
import { closeDeviceSignIn, closeImport, useConnectors, useDeviceSignIn, useImporting, useProviderSheetOpen, useSheetWay } from "@/hooks/use-connectors";
-const ICON = { "app-token": LogInIcon, "app-device": SmartphoneIcon, token: KeyRoundIcon, key: KeyRoundIcon, shell: TerminalIcon } as const;
+const ICON = { "app-token": LogInIcon, "app-device": SmartphoneIcon, token: KeyRoundIcon, key: KeyRoundIcon, endpoint: ServerIcon, shell: TerminalIcon } as const;
+
+/** Ways that ask for something typed (a key, a token, a URL) open a form; the others run at once. */
+const hasForm = (w: ProviderWay) => w.id === "key" || w.id === "token" || w.id === "endpoint" || (w.id === "shell" && w.fields.length > 0);
/**
* "Connect <provider>": the ways the core offers (`connectors.providerSheet`),
- * one row each, then the key field when Paste an API key is picked. Opened
- * from Providers, from an app's page, and from an app's Connect when the app
- * has no sign-in command of its own. Mounted once, beside Share.
+ * one row each and only those that apply, then the form for the way picked (a
+ * key, a plan, a model, a server's URL). Opened from the Connections list,
+ * from an app's page, from a Space's Connect card, and from an app's Connect;
+ * "Other providers" opens the searchable provider choice. Mounted once,
+ * beside Share.
*/
export function ProviderSheetHost() {
const device = useDeviceSignIn();
@@ -25,7 +32,14 @@ export function ProviderSheetHost() {
const importing = useImporting();
if (importing) return <ImportSheet />;
if (device) return <DeviceCodeSheet />;
- return open ? <ProviderSheet /> : null;
+ return open ? <SheetOrPicker /> : null;
+}
+
+/** The provider's sheet, or the provider choice when no provider is picked yet. */
+function SheetOrPicker() {
+ const c = useConnectors();
+ if (c.picker) return <ProviderPicker />;
+ return <ProviderSheet />;
}
/**
@@ -185,87 +199,234 @@ function DeviceCodeSheet() {
);
}
+/** The searchable provider choice: the first tier, then every provider by search or "More providers". */
+function ProviderPicker() {
+ const c = useConnectors();
+ const v = c.picker;
+ if (!v) return null;
+ return (
+ <Dialog open onOpenChange={(o) => !o && c.closeProvider()}>
+ <DialogPopup data-provider-picker="" className="top-[12vh] w-[min(520px,calc(100vw-2rem))]">
+ <div className="px-6 pt-5 pb-5">
+ <DialogTitle className="text-[15px] font-semibold">{v.title}</DialogTitle>
+ {v.lede ? <DialogDescription className="mt-1 text-[13px] text-muted-foreground">{v.lede}</DialogDescription> : null}
+ <Input
+ type="search"
+ autoFocus
+ data-provider-picker-search=""
+ aria-label={v.searchLabel}
+ placeholder={v.searchLabel}
+ autoComplete="off"
+ spellCheck={false}
+ className="mt-3 h-8"
+ onChange={(e) => c.searchPicker(e.currentTarget.value)}
+ />
+ <div className="mt-2 max-h-[min(50vh,360px)] overflow-y-auto" data-provider-picker-list="">
+ {v.items.map((i) => (
+ <button
+ key={i.provider}
+ type="button"
+ data-provider-choice={i.provider}
+ onClick={() => c.openProvider(i.provider, c.sheetApp)}
+ className="-mx-2 flex w-[calc(100%+1rem)] cursor-default items-center gap-3 rounded-lg px-2 py-2 text-left outline-none hover:bg-accent focus-visible:bg-accent"
+ >
+ <ProviderMark id={i.provider} name={i.label} />
+ <span className="min-w-0 flex-1 truncate text-[13px]">{i.label}</span>
+ <span className={i.state === "connected" ? "flex items-center gap-1 text-xs" : "text-xs text-muted-foreground"}>
+ {i.state === "connected" ? <CheckIcon className="size-3 text-success" /> : null}
+ {i.status}
+ </span>
+ <ChevronRightIcon className="size-3.5 shrink-0 text-muted-foreground/60" />
+ </button>
+ ))}
+ {v.empty ? (
+ <p className="px-1 py-3 text-[13px] text-muted-foreground" data-provider-picker-empty="">
+ {v.empty}
+ </p>
+ ) : null}
+ {v.moreLabel ? (
+ <button
+ type="button"
+ data-provider-picker-more=""
+ onClick={() => c.searchPicker("", true)}
+ className="-mx-2 flex w-[calc(100%+1rem)] cursor-default items-center gap-3 rounded-lg px-2 py-2 text-left text-[13px] text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent"
+ >
+ <span className="min-w-0 flex-1">
+ {v.moreLabel} ({v.moreCount})
+ </span>
+ <ChevronRightIcon className="size-3.5 shrink-0 text-muted-foreground/60" />
+ </button>
+ ) : null}
+ </div>
+ <div className="mt-4 flex justify-end">
+ <Button variant="outline" onClick={() => c.closeProvider()}>
+ {v.cancelLabel}
+ </Button>
+ </div>
+ </div>
+ </DialogPopup>
+ </Dialog>
+ );
+}
+
+/** What the person typed for a way: the key (never kept past Save) and each field. */
+interface Filled {
+ value: string;
+ fields: Record<string, string>;
+}
+
+const startFilled = (way: ProviderWay): Filled => ({ value: "", fields: Object.fromEntries(way.fields.map((f) => [f.id, f.value])) });
+
+/** A way's form is ready when its key (if one is required) and every required field are filled. */
+function ready(way: ProviderWay, filled: Filled): boolean {
+ if (way.secret === "required" && !filled.value.trim()) return false;
+ return way.fields.every((f) => !f.required || (filled.fields[f.id] ?? "").trim() !== "");
+}
+
+/** The plan or region goes as `region`; everything else as a field. */
+function choicesOf(way: ProviderWay, filled: Filled) {
+ const region = way.fields.some((f) => f.id === "region") ? filled.fields.region : undefined;
+ const fields = Object.fromEntries(Object.entries(filled.fields).filter(([k, v]) => k !== "region" && v.trim() !== ""));
+ return { ...(region ? { region } : {}), ...(Object.keys(fields).length ? { fields } : {}) };
+}
+
+function FieldInput({ field, value, onChange }: { field: WayField; value: string; onChange: (v: string) => void }) {
+ return (
+ <label className="mt-3 block" data-provider-field={field.id}>
+ <span className="mb-1 block text-xs font-medium">{field.label}</span>
+ {field.kind === "choice" ? (
+ <Select value={value} options={field.options.map((o) => ({ value: o.id, label: o.label }))} onValueChange={onChange} aria-label={field.label} className="w-full" />
+ ) : (
+ <Input
+ value={value}
+ placeholder={field.placeholder}
+ autoComplete="off"
+ spellCheck={false}
+ inputMode={field.kind === "url" ? "url" : undefined}
+ className={field.kind === "url" ? "font-mono" : undefined}
+ onChange={(e) => onChange(e.currentTarget.value)}
+ />
+ )}
+ </label>
+ );
+}
+
function ProviderSheet() {
const c = useConnectors();
const v = c.sheet;
- const [keyWay, setKeyWay] = useState<ProviderWay | null>(null);
- const [value, setValue] = useState("");
+ const [way, setWay] = useState<ProviderWay | null>(null);
+ const [filled, setFilled] = useState<Filled>({ value: "", fields: {} });
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const startWay = useSheetWay();
+ const open = (w: ProviderWay) => {
+ setWay(w);
+ setFilled(startFilled(w));
+ setError(null);
+ };
// Sent here from "nothing found" to paste a token or a key: open straight on that field.
useEffect(() => {
- if (startWay && v) setKeyWay(v.ways.find((w) => w.id === startWay) ?? null);
+ const w = startWay && v ? v.ways.find((x) => x.id === startWay) : null;
+ if (w) open(w);
}, [startWay, v?.provider]); // eslint-disable-line react-hooks/exhaustive-deps
const close = () => {
- setKeyWay(null);
- setValue("");
+ setWay(null);
+ setFilled({ value: "", fields: {} });
setError(null);
c.closeProvider();
};
if (!v) return null;
- const run = async (way: ProviderWay, typed?: string) => {
+ const run = async (w: ProviderWay, typed?: string) => {
setBusy(true);
setError(null);
- const ok = await c.runWay(way, typed);
+ const ok = await c.runWay(w, typed, choicesOf(w, filled));
setBusy(false);
if (ok) close();
- else if (way.id === "key" || way.id === "token") setError(way.id === "token" ? "Couldn't save the token. Check it and try again." : "Couldn't save the key. Check it and try again.");
+ else if (w.id === "key" || w.id === "token" || w.id === "endpoint") {
+ setError(w.id === "token" ? "Couldn't save the token. Check it and try again." : w.id === "endpoint" ? "Couldn't save the endpoint. Check it and try again." : "Couldn't save the key. Check it and try again.");
+ }
};
+ const switcher = (
+ <Button type="button" variant="ghost" className="mr-auto text-muted-foreground" data-provider-switch="" disabled={busy} onClick={() => c.openProvider(null, c.sheetApp)}>
+ {v.switchLabel}
+ </Button>
+ );
return (
<Dialog open onOpenChange={(o) => !o && close()}>
<DialogPopup data-provider-sheet={v.provider} className="top-[12vh] w-[min(520px,calc(100vw-2rem))]">
<div className="px-6 pt-5 pb-5">
- {keyWay ? (
+ {way ? (
<form
onSubmit={(e) => {
e.preventDefault();
- if (value.trim()) void run(keyWay, value);
+ if (ready(way, filled) && !busy) void run(way, filled.value);
}}
>
<DialogTitle className="flex items-center gap-1.5 text-[15px] font-semibold">
<button
type="button"
aria-label="Back"
- onClick={() => setKeyWay(null)}
+ onClick={() => setWay(null)}
className="-ml-1.5 inline-flex size-6 cursor-default items-center justify-center rounded-lg text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60"
>
<ChevronLeftIcon className="size-4" />
</button>
{v.title}
</DialogTitle>
- <DialogDescription className="mt-1 text-[13px] text-muted-foreground">{keyWay.help}</DialogDescription>
- <label className="mt-4 block">
- <span className="mb-1 block text-xs font-medium">{keyWay.id === "token" ? v.tokenLabel : v.keyLabel}</span>
- <Input
- type="password"
- autoFocus
- data-provider-key=""
- value={value}
- placeholder={keyWay.id === "token" ? v.tokenPlaceholder : v.keyPlaceholder}
- autoComplete="off"
- spellCheck={false}
- className="font-mono"
- onChange={(e) => setValue(e.currentTarget.value)}
- />
- </label>
- <p className="mt-1.5 text-xs text-muted-foreground">{v.keyHelp}</p>
+ <DialogDescription className="mt-1 text-[13px] text-muted-foreground">{way.help}</DialogDescription>
+ {way.fields.map((f) => (
+ <FieldInput key={f.id} field={f} value={filled.fields[f.id] ?? ""} onChange={(x) => setFilled((p) => ({ ...p, fields: { ...p.fields, [f.id]: x } }))} />
+ ))}
+ {way.secret !== "none" ? (
+ <label className="mt-3 block">
+ <span className="mb-1 block text-xs font-medium">
+ {way.id === "token" ? v.tokenLabel : v.keyLabel}
+ {way.secret === "optional" ? " (optional)" : ""}
+ </span>
+ <Input
+ type="password"
+ autoFocus={way.fields.length === 0}
+ data-provider-key=""
+ value={filled.value}
+ placeholder={way.id === "token" ? v.tokenPlaceholder : v.keyPlaceholder}
+ autoComplete="off"
+ spellCheck={false}
+ className="font-mono"
+ onChange={(e) => {
+ const typed = e.currentTarget.value;
+ setFilled((p) => ({ ...p, value: typed }));
+ }}
+ />
+ </label>
+ ) : null}
+ {way.secret !== "none" ? <p className="mt-1.5 text-xs text-muted-foreground">{v.keyHelp}</p> : null}
+ {v.note && way.id === "endpoint" ? (
+ <p className="mt-2 text-xs text-muted-foreground" data-provider-note="">
+ {v.note}
+ </p>
+ ) : null}
{error ? <p className="mt-2 text-[13px] text-destructive">{error}</p> : null}
<div className="mt-4 flex justify-end gap-2">
+ {switcher}
<Button type="button" variant="outline" onClick={close}>
{v.cancelLabel}
</Button>
- <Button type="submit" disabled={busy || !value.trim()} data-provider-save="">
+ <Button type="submit" disabled={busy || !ready(way, filled)} data-provider-save="">
{v.saveLabel}
</Button>
</div>
</form>
) : (
<>
- <DialogTitle className="text-[15px] font-semibold" data-provider-sheet-title="">
- {v.title}
- </DialogTitle>
- <DialogDescription className="mt-1 text-[13px] text-muted-foreground">{v.lede}</DialogDescription>
+ <div className="flex items-center gap-3">
+ <ProviderMark id={v.provider} name={v.title.replace(/^Connect /, "")} large />
+ <div className="min-w-0 flex-1">
+ <DialogTitle className="text-[15px] font-semibold" data-provider-sheet-title="">
+ {v.title}
+ </DialogTitle>
+ {v.lede ? <DialogDescription className="mt-0.5 text-[13px] text-muted-foreground">{v.lede}</DialogDescription> : null}
+ </div>
+ </div>
<div className="mt-3">
{v.ways.map((w) => {
const Icon = ICON[w.id];
@@ -275,7 +436,7 @@ function ProviderSheet() {
type="button"
data-provider-way={w.id}
disabled={busy}
- onClick={() => (w.id === "key" || w.id === "token" ? setKeyWay(w) : void run(w))}
+ onClick={() => (hasForm(w) ? open(w) : void run(w))}
className="-mx-2 flex w-[calc(100%+1rem)] cursor-default items-center gap-3 rounded-lg px-2 py-2.5 text-left outline-none hover:bg-accent focus-visible:bg-accent disabled:opacity-50"
>
<span className="flex size-7 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground">
@@ -290,19 +451,8 @@ function ProviderSheet() {
);
})}
</div>
- {v.others.length ? (
- <div data-provider-others="" className="mt-3">
- <p className="text-xs text-muted-foreground">{v.othersLabel}</p>
- <div className="mt-1.5 flex flex-wrap gap-1.5">
- {v.others.map((o) => (
- <Button key={o.provider} size="sm" variant="outline" disabled={busy} data-provider-other={o.provider} onClick={() => c.openProvider(o.provider, c.sheetApp)}>
- {o.label}
- </Button>
- ))}
- </div>
- </div>
- ) : null}
- <div className="mt-4 flex justify-end">
+ <div className="mt-4 flex justify-end gap-2">
+ {switcher}
<Button variant="outline" onClick={close}>
{v.cancelLabel}
</Button>
diff --git a/apps/cua-spaces-web/src/components/shell/command-palette.tsx b/apps/cua-spaces-web/src/components/shell/command-palette.tsx
index 5bb4236eaa..ed45cfd6a3 100644
--- a/apps/cua-spaces-web/src/components/shell/command-palette.tsx
+++ b/apps/cua-spaces-web/src/components/shell/command-palette.tsx
@@ -139,7 +139,7 @@ function PaletteBody({ onClose }: { onClose: () => void }) {
id: `settings:${t.to}`,
group: "Go to",
label: `Settings: ${t.label}`,
- keywords: t.to === "/settings/connectors" ? "preferences options connected apps coding agents" : "preferences options",
+ keywords: t.to === "/settings/connections" ? "preferences options connectors providers keys sign in connected apps coding agents" : "preferences options",
icon: icon(SettingsIcon),
run: () => void navigate({ to: t.to }),
})),
diff --git a/apps/cua-spaces-web/src/components/space-sheets.tsx b/apps/cua-spaces-web/src/components/space-sheets.tsx
index ba3316ecd3..ffdff5bb88 100644
--- a/apps/cua-spaces-web/src/components/space-sheets.tsx
+++ b/apps/cua-spaces-web/src/components/space-sheets.tsx
@@ -4,7 +4,7 @@
import { lazy, Suspense } from "react";
import { useShareSheet, useTeleport } from "@/bridge";
-import { ProviderSheetHost } from "@/components/settings/connectors/provider-sheet";
+import { ProviderSheetHost } from "@/components/settings/connections/provider-sheet";
const TeleportDialog = lazy(() => import("./teleport/teleport-dialog"));
const ShareSheet = lazy(() => import("./share-sheet"));
diff --git a/apps/cua-spaces-web/src/components/space-thread/failure-note.tsx b/apps/cua-spaces-web/src/components/space-thread/failure-note.tsx
index 638bd80ed3..1ca0ddd841 100644
--- a/apps/cua-spaces-web/src/components/space-thread/failure-note.tsx
+++ b/apps/cua-spaces-web/src/components/space-thread/failure-note.tsx
@@ -3,18 +3,17 @@
import { CheckIcon, ChevronRightIcon, CopyIcon, Loader2Icon, PlugIcon, RotateCcwIcon } from "lucide-react";
import { useEffect, useState } from "react";
-import { Link } from "@tanstack/react-router";
-import { useAgentKeys, type ThreadFailure } from "@/bridge";
+import { connectPlan, useAgentKeys, useBridge, type ThreadFailure } from "@/bridge";
import { Button } from "@/components/ui/button";
import { useConnectors } from "@/hooks/use-connectors";
import { cn } from "@/lib/utils";
-/** The Connectors app page that gives a harness its sign-in. */
+/** The Connections app that gives a harness its sign-in. */
const HARNESS_APP: Record<string, string> = { "claude-code": "claude-code", "openai-codex": "codex", hermes: "hermes" };
const PROVIDER_APP: Record<string, string> = { anthropic: "claude-code", openai: "codex" };
-/** The Connectors app a failed agent's Connect opens: its own harness first, else the provider's. */
+/** The Connections app a failed agent's Connect is for: its own harness first, else the provider's. */
export function failureApp(harness: string, provider: string | null): string | null {
return HARNESS_APP[harness] ?? (provider ? (PROVIDER_APP[provider] ?? null) : null);
}
@@ -51,6 +50,7 @@ export function FailureNote({
function ConnectActions({ harness, provider, taskText, onRetry }: { harness: string; provider: string | null; taskText: string | null; onRetry?: (text: string) => Promise<void> }) {
const c = useConnectors();
+ const { core } = useBridge();
// The agent was refused its credential: Settings reads the saved list again, which says it needs a reconnect.
const keys = useAgentKeys();
useEffect(() => {
@@ -59,12 +59,20 @@ function ConnectActions({ harness, provider, taskText, onRetry }: { harness: str
}, []); // eslint-disable-line react-hooks/exhaustive-deps
const app = failureApp(harness, provider);
const row = app ? c.view?.apps.find((a) => a.agent === app) : undefined;
- const connected = row?.state === "connected";
- // The same word as the Connectors row: Reconnect when the saved sign-in ran out or was refused.
- const label = row?.button?.label === "Reconnect" ? "Reconnect" : "Connect";
+ const providerRow = provider ? [...(c.view?.providers ?? []), ...(c.view?.moreProviders ?? [])].find((p) => p.id === provider) : undefined;
+ const connected = row?.state === "connected" && providerRow?.state !== "not-connected";
+ // The same word as the Connections row: Reconnect when the saved sign-in or key ran out or was refused.
+ const label = row?.button?.label === "Reconnect" || providerRow?.status === "Needs reconnect" ? "Reconnect" : "Connect";
+ // The same sheet as Settings, on the provider that refused it: an app with a sign-in of its own
+ // (Claude Code, Codex) goes through its own Connect; any other app opens the provider's sheet.
+ const connect = () => {
+ const plan = app ? connectPlan(core, c.input, app) : null;
+ if (app && plan && (plan.appToken || plan.device)) void c.connectApp(app);
+ else c.openProvider(provider ?? plan?.provider ?? null, app);
+ };
return (
<>
- <Button size="sm" variant="outline" data-failure-connect="" render={app ? <Link to="/settings/connectors/$app" params={{ app }} /> : <Link to="/settings/connectors" />}>
+ <Button size="sm" variant="outline" data-failure-connect="" onClick={connect}>
<PlugIcon /> {label}
</Button>
<RetryButton taskText={taskText} onRetry={onRetry} enabled={connected} />
diff --git a/apps/cua-spaces-web/src/components/space-thread/profile-card.tsx b/apps/cua-spaces-web/src/components/space-thread/profile-card.tsx
index 2320f0b18d..1d2881e026 100644
--- a/apps/cua-spaces-web/src/components/space-thread/profile-card.tsx
+++ b/apps/cua-spaces-web/src/components/space-thread/profile-card.tsx
@@ -279,7 +279,7 @@ export function AgentCard({ identity: i, agent, roster, onRemove, onDone }: { id
</Button>
) : null}
{v.settingsLabel && v.app ? (
- <Button size="sm" variant="ghost" data-card-settings="" render={<Link to="/settings/connectors/$app" params={{ app: v.app }} />}>
+ <Button size="sm" variant="ghost" data-card-settings="" render={<Link to="/settings/connections/$app" params={{ app: v.app }} />}>
{v.settingsLabel}
</Button>
) : null}
diff --git a/apps/cua-spaces-web/src/components/space-thread/summon.tsx b/apps/cua-spaces-web/src/components/space-thread/summon.tsx
index 7af56cea2f..3874c847e7 100644
--- a/apps/cua-spaces-web/src/components/space-thread/summon.tsx
+++ b/apps/cua-spaces-web/src/components/space-thread/summon.tsx
@@ -8,7 +8,7 @@
* the message wakes it), and, when one can't be woken, shows why under the
* message with Connect. Once Connect finishes the message goes again by
* itself. Which agents, what each step is and every word are the core's
- * (`summon.*`); Connect is Settings, Connectors' (`useConnectors`).
+ * (`summon.*`); Connect is Settings, Connections' (`useConnectors`).
*
* The notes are this device's: they are about its own sign-ins, so they
* aren't posted to the thread for everyone.
@@ -274,7 +274,7 @@ export function WakeNoteView({
</Button>
) : null}
{c.openLabel ? (
- <Button size="sm" variant="ghost" className="text-muted-foreground" render={<Link to="/settings/connectors/$app" params={{ app: c.app }} />} data-wake-open="">
+ <Button size="sm" variant="ghost" className="text-muted-foreground" render={<Link to="/settings/connections/$app" params={{ app: c.app }} />} data-wake-open="">
{c.openLabel}
</Button>
) : null}
diff --git a/apps/cua-spaces-web/src/hooks/use-connected-apps.ts b/apps/cua-spaces-web/src/hooks/use-connected-apps.ts
index 05f38ac92b..2bf29a7a20 100644
--- a/apps/cua-spaces-web/src/hooks/use-connected-apps.ts
+++ b/apps/cua-spaces-web/src/hooks/use-connected-apps.ts
@@ -87,7 +87,7 @@ export interface ConnectedApps {
reload(): Promise<void>;
}
-/** Settings, Connectors. */
+/** Settings, Connections. */
export function useConnectedApps(): ConnectedApps {
const { data } = useBridge();
const app = useConnectedAppsState();
diff --git a/apps/cua-spaces-web/src/hooks/use-connectors.ts b/apps/cua-spaces-web/src/hooks/use-connectors.ts
index e38f413888..d8340e4a7b 100644
--- a/apps/cua-spaces-web/src/hooks/use-connectors.ts
+++ b/apps/cua-spaces-web/src/hooks/use-connectors.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * Connect, as Settings → Connectors, an app's page, a Space's
+ * Connect, as Settings → Connections, an app's page, a Space's
* "isn't connected yet" note and Ask first share it: one place that knows
* which connects are running, what failed, and which provider sheet is
* open. The steps and words are the core's (`connectors.*`); the host
@@ -26,12 +26,15 @@ import {
connectorsInputOf,
connectorsView,
connectPlan,
+ providerPicker,
providerSheet,
useAgentKeys,
useBridge,
type AppDetailView,
type ConnectorsInput,
type ConnectorsView,
+ type KeyChoices,
+ type ProviderPickerView,
type ProviderSheetView,
type ProviderWay,
} from "@/bridge";
@@ -43,8 +46,11 @@ type Step = ConnectorsInput["busy"][number]["step"];
interface ConnectState {
busy: ConnectorsInput["busy"];
failures: ConnectorsInput["failures"];
- /** The provider sheet open now, and what opened it (an app's Connect continues there). */
- sheet: { provider: string; forApp: string | null; way?: "token" | "key" } | null;
+ /** The provider sheet open now (`provider: null`: the provider choice), and what opened it (an app's Connect continues there). */
+ sheet: { provider: string | null; forApp: string | null; way?: "token" | "key"; query: string; expanded: boolean } | null;
+ /** What is typed in the search of More providers on the page, and whether it is open. */
+ query: string;
+ moreOpen: boolean;
/** Provider keys your login shell has set (names), read when a sheet opens. */
shellKeys: string[];
/** A device-code sign-in waiting for its code to be entered. */
@@ -53,7 +59,7 @@ interface ConnectState {
importing: { app: string; phase: "consent" | "reading" | "not-found"; line: string | null } | null;
}
-const useConnectState = create<ConnectState>(() => ({ busy: [], failures: [], sheet: null, shellKeys: [], device: null, importing: null }));
+const useConnectState = create<ConnectState>(() => ({ busy: [], failures: [], sheet: null, query: "", moreOpen: false, shellKeys: [], device: null, importing: null }));
const set = useConnectState.setState;
const start = (id: string, step: Step) =>
@@ -91,7 +97,7 @@ export const closeDeviceSignIn = () => set({ device: null });
/** Tests start clean. */
export function resetConnectState(): void {
pendingImport = null;
- set({ busy: [], failures: [], sheet: null, shellKeys: [], device: null, importing: null });
+ set({ busy: [], failures: [], sheet: null, query: "", moreOpen: false, shellKeys: [], device: null, importing: null });
}
const message = (e: unknown) => (e instanceof Error ? e.message : String(e));
@@ -106,16 +112,23 @@ export interface Connectors {
detail(agent: string): AppDetailView | null;
/** The provider sheet open now. */
sheet: ProviderSheetView | null;
- /** The app it was opened for (its other providers are offered in it). */
+ /** The provider choice open now (the sheet's "Other providers", or an app that takes several). */
+ picker: ProviderPickerView | null;
+ /** The app it was opened for (the choice lists the providers it can use). */
sheetApp: string | null;
/** One Connect for an app: Cua's tools, then its sign-in (its token command, or the provider's sheet). */
connectApp(agent: string): Promise<ConnectOutcome>;
- openProvider(provider: string, forApp?: string | null, way?: "token" | "key"): void;
+ /** Opens a provider's sheet (`null`: the provider choice). */
+ openProvider(provider: string | null, forApp?: string | null, way?: "token" | "key"): void;
+ /** Searches the provider choice, or lists all of it. */
+ searchPicker(query: string, expanded?: boolean): void;
+ /** Searches More providers on the page, or opens or closes it. */
+ searchMore(query: string, open?: boolean): void;
/** Reads the sign-in the app already has, once the person agreed in the import sheet. */
confirmImport(): Promise<boolean>;
closeProvider(): void;
- /** Runs one of the sheet's ways (`key` with the pasted value). */
- runWay(way: ProviderWay, value?: string): Promise<boolean>;
+ /** Runs one of the sheet's ways: a pasted `value` for a key, token or endpoint, with its `choices` (a plan, a model, a URL). */
+ runWay(way: ProviderWay, value?: string, choices?: KeyChoices): Promise<boolean>;
signOut(provider: string): Promise<void>;
/** An app page's switch: Cua's skills, its MCP server, or keeping it set up. */
setToggle(agent: string, id: "skills" | "mcp" | "auto", on: boolean): Promise<void>;
@@ -130,9 +143,18 @@ export function useConnectors(): Connectors {
const keys = useAgentKeys({ watch: true });
const app = useConnectedAppsState();
const st = useConnectState();
- const input = connectorsInputOf(apps.rows, keys.input, { auto: app.auto === true, off: app.off, busy: st.busy, failures: st.failures, shellKeys: st.shellKeys });
+ const input = connectorsInputOf(apps.rows, keys.input, {
+ auto: app.auto === true,
+ off: app.off,
+ busy: st.busy,
+ failures: st.failures,
+ shellKeys: st.shellKeys,
+ query: st.query,
+ moreOpen: st.moreOpen,
+ });
const view = connectorsView(core, input);
- const sheet = st.sheet ? providerSheet(core, input, st.sheet.provider, undefined, st.sheet.forApp) : null;
+ const sheet = st.sheet?.provider ? providerSheet(core, input, st.sheet.provider, undefined, st.sheet.forApp) : null;
+ const picker = st.sheet && !st.sheet.provider ? providerPicker(core, input, st.sheet.forApp, st.sheet.query, st.sheet.expanded) : null;
const reload = useCallback(async () => {
await Promise.all([apps.reload(), keys.refresh()]);
@@ -204,7 +226,7 @@ export function useConnectors(): Connectors {
}
}
if (plan.provider) {
- set({ sheet: { provider: plan.provider, forApp: agent } });
+ set({ sheet: { provider: plan.provider, forApp: agent, query: "", expanded: false } });
return "sheet";
}
return "connected";
@@ -261,9 +283,9 @@ export function useConnectors(): Connectors {
}, [core, data, input, reload]);
const runWay = useCallback(
- async (way: ProviderWay, value?: string): Promise<boolean> => {
+ async (way: ProviderWay, value?: string, choices: KeyChoices = {}): Promise<boolean> => {
const open = useConnectState.getState().sheet;
- if (!data || !open || !sheet) return false;
+ if (!data || !open?.provider || !sheet) return false;
const id = `provider:${open.provider}`;
try {
if (way.id === "app-token" && way.app) {
@@ -275,12 +297,18 @@ export function useConnectors(): Connectors {
return await runDevice(way.app, open.provider);
} else if (way.id === "shell" && way.env) {
start(id, "connecting");
- await data.call("agentKeys.fromShell", { env: way.env });
+ await data.call("agentKeys.fromShell", { env: way.env, ...choices });
await keys.refresh();
set({ sheet: null });
- } else if ((way.id === "key" || way.id === "token") && value?.trim()) {
+ } else if (way.id === "token" && value?.trim()) {
+ // A token from `claude setup-token`: the daemon saves it as the sign-in it is, not as a key.
start(id, "connecting");
- await keys.save(sheet.keyProvider, value.trim(), sheet.keyEnv);
+ await keys.save(open.provider, value.trim(), null);
+ set({ sheet: null });
+ } else if ((way.id === "key" && value?.trim()) || (way.id === "endpoint" && (value?.trim() || way.secret === "optional"))) {
+ // Saving never waits on the provider: the check runs later, in the background.
+ start(id, "connecting");
+ await keys.save(open.provider, (value ?? "").trim(), null, choices);
set({ sheet: null });
} else {
return false;
@@ -362,11 +390,12 @@ export function useConnectors(): Connectors {
view,
detail: (agent) => appDetail(core, input, agent),
sheet,
+ picker,
sheetApp: st.sheet?.forApp ?? null,
connectApp,
confirmImport,
openProvider: (provider, forApp = null, way) => {
- set({ sheet: { provider, forApp, ...(way ? { way } : {}) } });
+ set({ sheet: { provider, forApp, ...(way ? { way } : {}), query: "", expanded: false } });
// Which keys your shell has (names only), for "Use … from your shell".
void data
?.call("agentKeys.shell", {})
@@ -374,6 +403,8 @@ export function useConnectors(): Connectors {
.catch(() => set({ shellKeys: [] }));
},
closeProvider: () => set({ sheet: null }),
+ searchPicker: (query, expanded = false) => set((s) => (s.sheet ? { sheet: { ...s.sheet, query, expanded: expanded || s.sheet.expanded } } : {})),
+ searchMore: (query, open) => set((s) => ({ query, moreOpen: open ?? (s.moreOpen || query.trim() !== "") })),
runWay,
signOut,
setToggle,
diff --git a/apps/cua-spaces-web/src/lib/agent-keys.ts b/apps/cua-spaces-web/src/lib/agent-keys.ts
index 19d0b4b4b6..1334242603 100644
--- a/apps/cua-spaces-web/src/lib/agent-keys.ts
+++ b/apps/cua-spaces-web/src/lib/agent-keys.ts
@@ -5,6 +5,6 @@
export const addedText = (label: string, ms: number, locale?: string, timeZone?: string) =>
`${label} ${new Date(ms).toLocaleDateString(locale ?? "en-US", { month: "short", day: "numeric", year: "numeric", timeZone })}`;
-/** Whether an agent's error is a missing provider key, which Settings, Connectors fixes. */
+/** Whether an agent's error is a missing provider key, which Settings, Connections fixes. */
export const needsAgentKey = (error: string | null | undefined): boolean =>
- Boolean(error && /Settings → Agents|Settings → Connected apps|Settings → Connectors|Authentication required|has no credential/i.test(error));
+ Boolean(error && /Settings → Agents|Settings → Connected apps|Settings → Connections|Authentication required|has no credential/i.test(error));
diff --git a/apps/cua-spaces-web/src/lib/mentions.ts b/apps/cua-spaces-web/src/lib/mentions.ts
index 270b918992..ef74628362 100644
--- a/apps/cua-spaces-web/src/lib/mentions.ts
+++ b/apps/cua-spaces-web/src/lib/mentions.ts
@@ -17,7 +17,7 @@ export interface MentionCandidate {
kind: "agent" | "person";
/** An agent's kind (`claude-code`), for its mark when it isn't in the Space yet. */
harness?: string;
- /** Under the name for an agent not in the Space yet ("Starts in this Space", "Not connected yet"). */
+ /** Under the name for an agent not in the Space yet ("Starts in this Space", "Not connected"). */
detail?: string;
/** Listed but not pickable (`@everyone` for someone who can't give tasks); `detail` says why. */
disabled?: boolean;
diff --git a/apps/cua-spaces-web/src/lib/settings-tabs.ts b/apps/cua-spaces-web/src/lib/settings-tabs.ts
index c8a678bbc2..a88d024f34 100644
--- a/apps/cua-spaces-web/src/lib/settings-tabs.ts
+++ b/apps/cua-spaces-web/src/lib/settings-tabs.ts
@@ -5,7 +5,7 @@
export const SETTINGS_TABS = [
{ to: "/settings", label: "Account", exact: true },
{ to: "/settings/general", label: "General", exact: false },
- { to: "/settings/connectors", label: "Connectors", exact: false },
+ { to: "/settings/connections", label: "Connections", exact: false },
{ to: "/settings/advanced", label: "Advanced", exact: false },
{ to: "/settings/about", label: "About", exact: false },
] as const;
diff --git a/apps/cua-spaces-web/src/routeTree.gen.ts b/apps/cua-spaces-web/src/routeTree.gen.ts
index 7ed1e834c7..daeb9ff93d 100644
--- a/apps/cua-spaces-web/src/routeTree.gen.ts
+++ b/apps/cua-spaces-web/src/routeTree.gen.ts
@@ -27,6 +27,7 @@ import { Route as SettingsAboutRouteImport } from './routes/settings/about'
import { Route as SettingsAdvancedRouteImport } from './routes/settings/advanced'
import { Route as SettingsAgentsRouteImport } from './routes/settings/agents'
import { Route as SettingsConnectedAppsRouteImport } from './routes/settings/connected-apps'
+import { Route as SettingsConnectionsRouteImport } from './routes/settings/connections'
import { Route as SettingsConnectorsRouteImport } from './routes/settings/connectors'
import { Route as SettingsDevicesRouteImport } from './routes/settings/devices'
import { Route as SettingsExperimentsRouteImport } from './routes/settings/experiments'
@@ -34,6 +35,7 @@ import { Route as SettingsGeneralRouteImport } from './routes/settings/general'
import { Route as SpacesIndexRouteImport } from './routes/spaces/index'
import { Route as SpacesSpaceIdRouteImport } from './routes/spaces/$spaceId'
import { Route as VolumeIndexRouteImport } from './routes/volume/index'
+import { Route as SettingsConnectionsAppRouteImport } from './routes/settings/connections.$app'
import { Route as SettingsConnectorsAppRouteImport } from './routes/settings/connectors.$app'
const IndexRoute = IndexRouteImport.update({
@@ -111,6 +113,11 @@ const SettingsConnectedAppsRoute = SettingsConnectedAppsRouteImport.update({
path: '/connected-apps',
getParentRoute: () => SettingsRouteRoute,
} as any)
+const SettingsConnectionsRoute = SettingsConnectionsRouteImport.update({
+ id: '/connections',
+ path: '/connections',
+ getParentRoute: () => SettingsRouteRoute,
+} as any)
const SettingsConnectorsRoute = SettingsConnectorsRouteImport.update({
id: '/connectors',
path: '/connectors',
@@ -146,6 +153,11 @@ const VolumeIndexRoute = VolumeIndexRouteImport.update({
path: '/volume/',
getParentRoute: () => rootRouteImport,
} as any)
+const SettingsConnectionsAppRoute = SettingsConnectionsAppRouteImport.update({
+ id: '/$app',
+ path: '/$app',
+ getParentRoute: () => SettingsConnectionsRoute,
+} as any)
const SettingsConnectorsAppRoute = SettingsConnectorsAppRouteImport.update({
id: '/$app',
path: '/$app',
@@ -161,6 +173,7 @@ export interface FileRoutesByFullPath {
'/settings/advanced': typeof SettingsAdvancedRoute
'/settings/agents': typeof SettingsAgentsRoute
'/settings/connected-apps': typeof SettingsConnectedAppsRoute
+ '/settings/connections': typeof SettingsConnectionsRouteWithChildren
'/settings/connectors': typeof SettingsConnectorsRouteWithChildren
'/settings/devices': typeof SettingsDevicesRoute
'/settings/experiments': typeof SettingsExperimentsRoute
@@ -175,6 +188,7 @@ export interface FileRoutesByFullPath {
'/settings/': typeof SettingsIndexRoute
'/spaces/': typeof SpacesIndexRoute
'/volume/': typeof VolumeIndexRoute
+ '/settings/connections/$app': typeof SettingsConnectionsAppRoute
'/settings/connectors/$app': typeof SettingsConnectorsAppRoute
}
export interface FileRoutesByTo {
@@ -185,6 +199,7 @@ export interface FileRoutesByTo {
'/settings/advanced': typeof SettingsAdvancedRoute
'/settings/agents': typeof SettingsAgentsRoute
'/settings/connected-apps': typeof SettingsConnectedAppsRoute
+ '/settings/connections': typeof SettingsConnectionsRouteWithChildren
'/settings/connectors': typeof SettingsConnectorsRouteWithChildren
'/settings/devices': typeof SettingsDevicesRoute
'/settings/experiments': typeof SettingsExperimentsRoute
@@ -199,6 +214,7 @@ export interface FileRoutesByTo {
'/settings': typeof SettingsIndexRoute
'/spaces': typeof SpacesIndexRoute
'/volume': typeof VolumeIndexRoute
+ '/settings/connections/$app': typeof SettingsConnectionsAppRoute
'/settings/connectors/$app': typeof SettingsConnectorsAppRoute
}
export interface FileRoutesById {
@@ -211,6 +227,7 @@ export interface FileRoutesById {
'/settings/advanced': typeof SettingsAdvancedRoute
'/settings/agents': typeof SettingsAgentsRoute
'/settings/connected-apps': typeof SettingsConnectedAppsRoute
+ '/settings/connections': typeof SettingsConnectionsRouteWithChildren
'/settings/connectors': typeof SettingsConnectorsRouteWithChildren
'/settings/devices': typeof SettingsDevicesRoute
'/settings/experiments': typeof SettingsExperimentsRoute
@@ -225,6 +242,7 @@ export interface FileRoutesById {
'/settings/': typeof SettingsIndexRoute
'/spaces/': typeof SpacesIndexRoute
'/volume/': typeof VolumeIndexRoute
+ '/settings/connections/$app': typeof SettingsConnectionsAppRoute
'/settings/connectors/$app': typeof SettingsConnectorsAppRoute
}
export interface FileRouteTypes {
@@ -238,6 +256,7 @@ export interface FileRouteTypes {
| '/settings/advanced'
| '/settings/agents'
| '/settings/connected-apps'
+ | '/settings/connections'
| '/settings/connectors'
| '/settings/devices'
| '/settings/experiments'
@@ -252,6 +271,7 @@ export interface FileRouteTypes {
| '/settings/'
| '/spaces/'
| '/volume/'
+ | '/settings/connections/$app'
| '/settings/connectors/$app'
fileRoutesByTo: FileRoutesByTo
to:
@@ -262,6 +282,7 @@ export interface FileRouteTypes {
| '/settings/advanced'
| '/settings/agents'
| '/settings/connected-apps'
+ | '/settings/connections'
| '/settings/connectors'
| '/settings/devices'
| '/settings/experiments'
@@ -276,6 +297,7 @@ export interface FileRouteTypes {
| '/settings'
| '/spaces'
| '/volume'
+ | '/settings/connections/$app'
| '/settings/connectors/$app'
id:
| '__root__'
@@ -287,6 +309,7 @@ export interface FileRouteTypes {
| '/settings/advanced'
| '/settings/agents'
| '/settings/connected-apps'
+ | '/settings/connections'
| '/settings/connectors'
| '/settings/devices'
| '/settings/experiments'
@@ -301,6 +324,7 @@ export interface FileRouteTypes {
| '/settings/'
| '/spaces/'
| '/volume/'
+ | '/settings/connections/$app'
| '/settings/connectors/$app'
fileRoutesById: FileRoutesById
}
@@ -427,6 +451,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsConnectedAppsRouteImport
parentRoute: typeof SettingsRouteRoute
}
+ '/settings/connections': {
+ id: '/settings/connections'
+ path: '/connections'
+ fullPath: '/settings/connections'
+ preLoaderRoute: typeof SettingsConnectionsRouteImport
+ parentRoute: typeof SettingsRouteRoute
+ }
'/settings/connectors': {
id: '/settings/connectors'
path: '/connectors'
@@ -476,6 +507,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof VolumeIndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/settings/connections/$app': {
+ id: '/settings/connections/$app'
+ path: '/$app'
+ fullPath: '/settings/connections/$app'
+ preLoaderRoute: typeof SettingsConnectionsAppRouteImport
+ parentRoute: typeof SettingsConnectionsRoute
+ }
'/settings/connectors/$app': {
id: '/settings/connectors/$app'
path: '/$app'
@@ -486,6 +524,17 @@ declare module '@tanstack/react-router' {
}
}
+interface SettingsConnectionsRouteChildren {
+ SettingsConnectionsAppRoute: typeof SettingsConnectionsAppRoute
+}
+
+const SettingsConnectionsRouteChildren: SettingsConnectionsRouteChildren = {
+ SettingsConnectionsAppRoute: SettingsConnectionsAppRoute,
+}
+
+const SettingsConnectionsRouteWithChildren =
+ SettingsConnectionsRoute._addFileChildren(SettingsConnectionsRouteChildren)
+
interface SettingsConnectorsRouteChildren {
SettingsConnectorsAppRoute: typeof SettingsConnectorsAppRoute
}
@@ -502,6 +551,7 @@ interface SettingsRouteRouteChildren {
SettingsAdvancedRoute: typeof SettingsAdvancedRoute
SettingsAgentsRoute: typeof SettingsAgentsRoute
SettingsConnectedAppsRoute: typeof SettingsConnectedAppsRoute
+ SettingsConnectionsRoute: typeof SettingsConnectionsRouteWithChildren
SettingsConnectorsRoute: typeof SettingsConnectorsRouteWithChildren
SettingsDevicesRoute: typeof SettingsDevicesRoute
SettingsExperimentsRoute: typeof SettingsExperimentsRoute
@@ -514,6 +564,7 @@ const SettingsRouteRouteChildren: SettingsRouteRouteChildren = {
SettingsAdvancedRoute: SettingsAdvancedRoute,
SettingsAgentsRoute: SettingsAgentsRoute,
SettingsConnectedAppsRoute: SettingsConnectedAppsRoute,
+ SettingsConnectionsRoute: SettingsConnectionsRouteWithChildren,
SettingsConnectorsRoute: SettingsConnectorsRouteWithChildren,
SettingsDevicesRoute: SettingsDevicesRoute,
SettingsExperimentsRoute: SettingsExperimentsRoute,
diff --git a/apps/cua-spaces-web/src/routes/agents/all.tsx b/apps/cua-spaces-web/src/routes/agents/all.tsx
index e19aa00e49..0342cf7659 100644
--- a/apps/cua-spaces-web/src/routes/agents/all.tsx
+++ b/apps/cua-spaces-web/src/routes/agents/all.tsx
@@ -51,10 +51,10 @@ export const Route = createFileRoute("/agents/all")({
}),
});
-/** Settings → Connectors, where agents get their provider keys. */
+/** Settings → Connections, where agents get their provider keys. */
function AgentKeysLink({ size }: { size?: "sm" }) {
return (
- <Button variant="outline" size={size} render={<Link to="/settings/connectors" />} data-agent-keys-link>
+ <Button variant="outline" size={size} render={<Link to="/settings/connections" />} data-agent-keys-link>
<KeyRoundIcon /> Add a provider key
</Button>
);
@@ -70,11 +70,11 @@ function useNow(ms = 30_000): number {
return now;
}
-/** Settings, Connectors: where Cua is switched on for each coding app. */
+/** Settings, Connections: where Cua is switched on for each coding app. */
function ConnectedAppsLink() {
const navigate = useNavigate();
return (
- <Button variant="outline" onClick={() => void navigate({ to: "/settings/connectors" as "/settings" })} data-connected-apps-link>
+ <Button variant="outline" onClick={() => void navigate({ to: "/settings/connections" as "/settings" })} data-connected-apps-link>
<SettingsIcon /> Connectors
</Button>
);
@@ -166,7 +166,7 @@ function Overview({ data, onSelect, connections }: { data: AgentsData; onSelect:
{connections.rows.length > 0 ? (
<Block title="On This Mac" count={connections.rows.length} id="connections">
{connections.rows.map((c) => (
- <ConnectionListRow key={c.id} row={c} busy={connections.busy === c.id} note={connections.notes[c.id] ?? null} onAct={(a) => (a === "connect" ? void navigate({ to: "/settings/connectors", search: { app: c.id } }) : void connections.act(c.id, a))} />
+ <ConnectionListRow key={c.id} row={c} busy={connections.busy === c.id} note={connections.notes[c.id] ?? null} onAct={(a) => (a === "connect" ? void navigate({ to: "/settings/connections", search: { app: c.id } }) : void connections.act(c.id, a))} />
))}
</Block>
) : null}
diff --git a/apps/cua-spaces-web/src/routes/onboarding/index.tsx b/apps/cua-spaces-web/src/routes/onboarding/index.tsx
index 9f3c46d66c..24738c04cb 100644
--- a/apps/cua-spaces-web/src/routes/onboarding/index.tsx
+++ b/apps/cua-spaces-web/src/routes/onboarding/index.tsx
@@ -282,7 +282,7 @@ function OtherMachineRow() {
* 2 · Let your coding apps use Cua: one question, asked once. It names the
* coding apps found on this computer; Set up adds Cua to all of them, Not now
* moves on. Later installs are set up the same way, with a notice and Undo
- * (Settings, Connectors). Which apps there are, and what Connect does for
+ * (Settings, Connections). Which apps there are, and what Connect does for
* each, is still the app core's (`firstRun.view`).
*/
function Connect({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {
diff --git a/apps/cua-spaces-web/src/routes/settings/agents.tsx b/apps/cua-spaces-web/src/routes/settings/agents.tsx
index d1654e526b..b4ed255110 100644
--- a/apps/cua-spaces-web/src/routes/settings/agents.tsx
+++ b/apps/cua-spaces-web/src/routes/settings/agents.tsx
@@ -6,6 +6,6 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
/** Settings, Agents became Connectors. */
export const Route = createFileRoute("/settings/agents")({
beforeLoad: () => {
- throw redirect({ to: "/settings/connectors", replace: true });
+ throw redirect({ to: "/settings/connections", replace: true });
},
});
diff --git a/apps/cua-spaces-web/src/routes/settings/connected-apps.tsx b/apps/cua-spaces-web/src/routes/settings/connected-apps.tsx
index 04319a3167..b551cd4991 100644
--- a/apps/cua-spaces-web/src/routes/settings/connected-apps.tsx
+++ b/apps/cua-spaces-web/src/routes/settings/connected-apps.tsx
@@ -6,6 +6,6 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
/** Settings, Connected apps became Connectors. Kept for old links and builds (CUA-2381). */
export const Route = createFileRoute("/settings/connected-apps")({
beforeLoad: () => {
- throw redirect({ to: "/settings/connectors", replace: true });
+ throw redirect({ to: "/settings/connections", replace: true });
},
});
diff --git a/apps/cua-spaces-web/src/routes/settings/connections.$app.tsx b/apps/cua-spaces-web/src/routes/settings/connections.$app.tsx
new file mode 100644
index 0000000000..73442bc2af
--- /dev/null
+++ b/apps/cua-spaces-web/src/routes/settings/connections.$app.tsx
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { createFileRoute } from "@tanstack/react-router";
+
+import { ConnectorAppPage } from "@/components/settings/connections/app-detail";
+
+/** One coding app's page under Connectors. */
+export const Route = createFileRoute("/settings/connections/$app")({
+ component: AppPage,
+});
+
+function AppPage() {
+ const { app } = Route.useParams();
+ return <ConnectorAppPage agent={app} />;
+}
diff --git a/apps/cua-spaces-web/src/routes/settings/connections.tsx b/apps/cua-spaces-web/src/routes/settings/connections.tsx
new file mode 100644
index 0000000000..955983e6c5
--- /dev/null
+++ b/apps/cua-spaces-web/src/routes/settings/connections.tsx
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { createFileRoute, Outlet, useMatch } from "@tanstack/react-router";
+
+import { useCliInstall, useSettings } from "@/bridge";
+import { CliSettingsSection } from "@/components/settings/cli-section";
+import { ConnectorsRedesign } from "@/components/settings/connections/connectors-page";
+import { useQuiet } from "@/hooks/use-quiet";
+
+/** `app` is a coding app to bring into view (the Agents page's Connect). */
+export const Route = createFileRoute("/settings/connections")({
+ component: ConnectorsPage,
+ validateSearch: (s: Record<string, unknown>): { app?: string } => ({ app: typeof s.app === "string" ? s.app : undefined }),
+});
+
+/**
+ * Settings, Connections (was Connectors, and Agents before): the providers connected once for every app that can use them, the coding apps Cua works with, and Cua in Terminal.
+ * Its parts come from separate host reads; the page draws once they have answered, not one by one with the page jumping at each (CUA-1951).
+ */
+function ConnectorsPage() {
+ // An app's own page (`/settings/connections/<app>`) draws in place of the list.
+ const child = useMatch({ from: "/settings/connections/$app", shouldThrow: false });
+ if (child) return <Outlet />;
+ return <Redesign />;
+}
+
+/** The connections, then coding apps with Connect and their pages. */
+function Redesign() {
+ const { app } = Route.useSearch();
+ const { data } = useSettings();
+ const cli = useCliInstall();
+ const settled = useQuiet(`${data?.cli ? 1 : 0}|${cli.state.plan ? 1 : 0}`);
+ if (!settled) return <div className="h-96" aria-busy="true" />;
+ return (
+ <div data-settings-tab="connections">
+ <ConnectorsRedesign focusApp={app} />
+ <CliSettingsSection />
+ </div>
+ );
+}
diff --git a/apps/cua-spaces-web/src/routes/settings/connectors.$app.tsx b/apps/cua-spaces-web/src/routes/settings/connectors.$app.tsx
index 76b3b80117..da2a671a15 100644
--- a/apps/cua-spaces-web/src/routes/settings/connectors.$app.tsx
+++ b/apps/cua-spaces-web/src/routes/settings/connectors.$app.tsx
@@ -3,14 +3,5 @@
import { createFileRoute } from "@tanstack/react-router";
-import { ConnectorAppPage } from "@/components/settings/connectors/app-detail";
-
-/** One coding app's page under Connectors. */
-export const Route = createFileRoute("/settings/connectors/$app")({
- component: AppPage,
-});
-
-function AppPage() {
- const { app } = Route.useParams();
- return <ConnectorAppPage agent={app} />;
-}
+/** An old app address under Connectors: the parent route (`connectors.tsx`) sends it to the same app under Connections. */
+export const Route = createFileRoute("/settings/connectors/$app")({});
diff --git a/apps/cua-spaces-web/src/routes/settings/connectors.tsx b/apps/cua-spaces-web/src/routes/settings/connectors.tsx
index 2dbd8fd7f2..efb88656b3 100644
--- a/apps/cua-spaces-web/src/routes/settings/connectors.tsx
+++ b/apps/cua-spaces-web/src/routes/settings/connectors.tsx
@@ -1,41 +1,14 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-import { createFileRoute, Outlet, useMatch } from "@tanstack/react-router";
+import { createFileRoute, redirect } from "@tanstack/react-router";
-import { useCliInstall, useSettings } from "@/bridge";
-import { CliSettingsSection } from "@/components/settings/cli-section";
-import { ConnectorsRedesign } from "@/components/settings/connectors/connectors-page";
-import { useQuiet } from "@/hooks/use-quiet";
-
-/** `app` is a coding app to bring into view (the Agents page's Connect). */
+/** Settings, Connections is now Connections: an old address (a bookmark, an older link) lands there, on the same app's page when it named one. */
export const Route = createFileRoute("/settings/connectors")({
- component: ConnectorsPage,
validateSearch: (s: Record<string, unknown>): { app?: string } => ({ app: typeof s.app === "string" ? s.app : undefined }),
+ beforeLoad: ({ search, location }) => {
+ const page = /^\/settings\/connectors\/([^/]+)\/?$/.exec(location.pathname)?.[1];
+ if (page) throw redirect({ to: "/settings/connections/$app", params: { app: decodeURIComponent(page) }, replace: true });
+ throw redirect({ to: "/settings/connections", search: { app: search.app }, replace: true });
+ },
});
-
-/**
- * Settings, Connectors (was Connectors, Agents): the coding apps Cua works with, the account keys they use, and Cua in Terminal.
- * Its parts come from separate host reads; the page draws once they have answered, not one by one with the page jumping at each (CUA-1951).
- */
-function ConnectorsPage() {
- // An app's own page (`/settings/connectors/<app>`) draws in place of the list.
- const child = useMatch({ from: "/settings/connectors/$app", shouldThrow: false });
- if (child) return <Outlet />;
- return <Redesign />;
-}
-
-/** Coding apps with Connect and their pages, then Providers. */
-function Redesign() {
- const { app } = Route.useSearch();
- const { data } = useSettings();
- const cli = useCliInstall();
- const settled = useQuiet(`${data?.cli ? 1 : 0}|${cli.state.plan ? 1 : 0}`);
- if (!settled) return <div className="h-96" aria-busy="true" />;
- return (
- <div data-settings-tab="connectors">
- <ConnectorsRedesign focusApp={app} />
- <CliSettingsSection />
- </div>
- );
-}
diff --git a/apps/cua-spaces/core-wasm/Cargo.lock b/apps/cua-spaces/core-wasm/Cargo.lock
index e1e1e8c85f..7787e0e78a 100644
--- a/apps/cua-spaces/core-wasm/Cargo.lock
+++ b/apps/cua-spaces/core-wasm/Cargo.lock
@@ -14,6 +14,15 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml",
+]
+
[[package]]
name = "cua-create-failure"
version = "0.9.0"
@@ -33,6 +42,7 @@ dependencies = [
name = "cua-spaces-app-core"
version = "0.9.0"
dependencies = [
+ "cua-connections",
"cua-create-failure",
"cua-home",
"serde",
@@ -49,6 +59,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "equivalent"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
+
[[package]]
name = "futures-core"
version = "0.3.34"
@@ -73,6 +89,22 @@ dependencies = [
"slab",
]
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "indexmap"
+version = "2.14.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
[[package]]
name = "itoa"
version = "1.0.18"
@@ -181,6 +213,15 @@ dependencies = [
"zmij",
]
+[[package]]
+name = "serde_spanned"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
+dependencies = [
+ "serde_core",
+]
+
[[package]]
name = "slab"
version = "0.4.12"
@@ -209,6 +250,45 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "toml"
+version = "1.1.8+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_parser",
+ "toml_writer",
+ "winnow",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "1.1.2+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.1.5+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
+dependencies = [
+ "winnow",
+]
+
+[[package]]
+name = "toml_writer"
+version = "1.1.3+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
+
[[package]]
name = "unicode-ident"
version = "1.0.26"
@@ -275,6 +355,12 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "winnow"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
+
[[package]]
name = "zmij"
version = "1.0.23"
diff --git a/apps/cua-spaces/src-tauri/Cargo.lock b/apps/cua-spaces/src-tauri/Cargo.lock
index a0d45ed36a..e6a91acedd 100644
--- a/apps/cua-spaces/src-tauri/Cargo.lock
+++ b/apps/cua-spaces/src-tauri/Cargo.lock
@@ -1729,6 +1729,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1810,6 +1811,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.4+spec-1.1.0",
+]
+
[[package]]
name = "cua-create-failure"
version = "0.9.0"
@@ -2285,6 +2295,7 @@ name = "cua-spaces-app-core"
version = "0.9.0"
dependencies = [
"async-trait",
+ "cua-connections",
"cua-create-failure",
"cua-home",
"cua-keyvault",
diff --git a/docs/content/docs/cua-cli/reference/cli/agents.mdx b/docs/content/docs/cua-cli/reference/cli/agents.mdx
index fe5eeef33a..a1df4d3f6c 100644
--- a/docs/content/docs/cua-cli/reference/cli/agents.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/agents.mdx
@@ -1,6 +1,6 @@
---
title: "Agents, MCP and skills"
-description: "Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded skills."
+description: "Agents in a Space, connecting your AI agents and the AI providers they use, the stdio MCP server, and recorded skills."
---
{/*
@@ -31,7 +31,7 @@ description: "Agents in a Space, connecting your AI agents, the stdio MCP server
| [`cua agent schedule disable`](#cua-agent-schedule-disable) | Turn a schedule off. |
| [`cua agent sessions`](#cua-agent-sessions) | Durable sessions: agents your machines keep alive (`run --durable`). |
| [`cua agent harnesses`](#cua-agent-harnesses) | The harnesses: readiness, installs, key variables, limits. |
-| [`cua agent keys`](#cua-agent-keys) | The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connectors). |
+| [`cua agent keys`](#cua-agent-keys) | The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connections). |
| [`cua agent keys ls`](#cua-agent-keys-ls) | List the saved keys (never their values). |
| [`cua agent keys set`](#cua-agent-keys-set) | Add or replace a key, read from stdin. |
| [`cua agent keys check`](#cua-agent-keys-check) | Ask each provider whether the saved API keys still work (a cheap read-only request; nothing is sent that is not a key's own request). |
@@ -65,6 +65,11 @@ description: "Agents in a Space, connecting your AI agents, the stdio MCP server
| [`cua connect status`](#cua-connect-status) | Whether each agent is really connected: installed and its version, signed in, Cua's MCP entry present and answering, and its sign-in copied to Keyvault. |
| [`cua connect remove`](#cua-connect-remove) | Remove the Cua Spaces skills and MCP entries cua added (nothing else). |
| [`cua connect update`](#cua-connect-update) | Refresh installed cua skills and managed MCP entries to this version. |
+| [`cua connections`](#cua-connections) | The AI providers connected once for every app that can use them: list, add (a key from stdin), test, remove. |
+| [`cua connections list`](#cua-connections-list) | List the providers with their state (Connected, Needs reconnect, Not connected) and the apps each works with. |
+| [`cua connections add`](#cua-connections-add) | Connect a provider. |
+| [`cua connections test`](#cua-connections-test) | Ask each provider whether its saved key still works (a read-only request on the provider's own host, bounded in time; offline is not a failure). |
+| [`cua connections remove`](#cua-connections-remove) | Disconnect a provider: remove what is saved for it. |
| [`cua agents`](#cua-agents) | Deprecated alias of `connect`. |
| [`cua agents detect`](#cua-agents-detect) | List supported AI coding agents and which are installed (read-only). |
| [`cua agents setup`](#cua-agents-setup) | Install the default cua skills and configure the cua MCP server. |
@@ -514,7 +519,7 @@ cua --json agent harnesses
### `cua agent keys`
-The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connectors). Values are read from stdin and never printed.
+The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connections). Values are read from stdin and never printed.
```text output
cua agent keys [OPTIONS] [COMMAND]
@@ -1068,7 +1073,7 @@ cua connect setup [OPTIONS]
| <span id="cua-connect-setup--yes"></span>`--yes` | `-y` | boolean | `false` | Answer yes to every prompt. |
| <span id="cua-connect-setup--force"></span>`--force` | | boolean | `false` | Replace skill folders cua did not write (the old one is backed up). |
| <span id="cua-connect-setup--cua-driver"></span>`--cua-driver` | | boolean | `false` | Set up background computer-use instead: the cua-driver skill and the cua-driver MCP server (`cua-driver mcp`). --mcp-command then names the cua-driver binary. |
-| <span id="cua-connect-setup--sign-in"></span>`--sign-in` | | boolean | `false` | Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connectors). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed. |
+| <span id="cua-connect-setup--sign-in"></span>`--sign-in` | | boolean | `false` | Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connections). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed. |
**Examples**
@@ -1154,6 +1159,113 @@ cua connect update [OPTIONS]
cua connect update
```
+## `cua connections`
+
+The AI providers connected once for every app that can use them: list, add (a key from stdin), test, remove. What Cua Spaces shows in Settings, Connections. (`cua connect` connects your coding apps to Cua.).
+
+```text output
+cua connections [OPTIONS] <COMMAND>
+```
+
+**Examples**
+
+```bash test="cli-shape" id="ref-cua-connections"
+cua connections list
+cua connections add deepseek
+cua connections test
+cua connections remove deepseek
+```
+
+### `cua connections list`
+
+List the providers with their state (Connected, Needs reconnect, Not connected) and the apps each works with. Never prints a key.
+
+```text output
+cua connections list [OPTIONS]
+```
+
+| Flag | Type | Default | Description |
+| --- | --- | --- | --- |
+| <span id="cua-connections-list--all"></span>`--all` | boolean | `false` | Also list every provider that is not connected (by default: the ones up front and the ones with something saved). |
+
+**Examples**
+
+```bash test="cli-shape" id="ref-cua-connections-list"
+cua connections list
+cua connections list --all
+cua --json connections list
+```
+
+### `cua connections add`
+
+Connect a provider. The key is read from stdin (pipe it in; a terminal is refused so it isn't echoed). Saving never waits on the provider: `cua connections test` asks it afterwards.
+
+.
+
+The provider is one of the ids `cua connections list --all` prints. Pipe the key in: `pbpaste | cua connections add deepseek`. Sign-ins another app made on this machine are imported with `cua connect setup <app> --sign-in`.
+
+```text output
+cua connections add [OPTIONS] <PROVIDER>
+```
+
+| Argument | Type | Default | Description |
+| --- | --- | --- | --- |
+| `<PROVIDER>` | string | required | The provider id (`cua connections list --all`). |
+
+| Flag | Type | Default | Description |
+| --- | --- | --- | --- |
+| <span id="cua-connections-add--method"></span>`--method` | string | | How: `key` (an API key from stdin; the default) or `endpoint` (a custom endpoint: its base URL, model and API style; a key is optional). |
+| <span id="cua-connections-add--region"></span>`--region` | string | | The plan or region, for a provider that has them (Z.AI: global, cn, coding-global, coding-cn). |
+| <span id="cua-connections-add--model"></span>`--model` | string | | The model to use, for a provider with no default model or to choose another. |
+| <span id="cua-connections-add--base-url"></span>`--base-url` | string | | A custom endpoint's base URL. |
+| <span id="cua-connections-add--wire"></span>`--wire` | string | | A custom endpoint's API style: openai-chat (default), openai-responses or anthropic. |
+
+**Examples**
+
+```bash test="cli-shape" id="ref-cua-connections-add"
+cua connections add deepseek
+cua connections add zai --region coding-global
+cua connections add deepinfra --model meta-llama/Meta-Llama-3.1-70B-Instruct
+cua connections add custom --base-url http://host:1234/v1 --model qwen
+```
+
+### `cua connections test`
+
+Ask each provider whether its saved key still works (a read-only request on the provider's own host, bounded in time; offline is not a failure). A key the provider refuses is listed as Needs reconnect.
+
+```text output
+cua connections test [OPTIONS] [PROVIDER]
+```
+
+| Argument | Type | Default | Description |
+| --- | --- | --- | --- |
+| `<PROVIDER>` | string | optional | Only this provider. |
+
+**Examples**
+
+```bash test="cli-shape" id="ref-cua-connections-test"
+cua connections test
+cua connections test openrouter
+```
+
+### `cua connections remove`
+
+Disconnect a provider: remove what is saved for it.
+
+```text output
+cua connections remove [OPTIONS] <PROVIDER>
+```
+
+| Argument | Type | Default | Description |
+| --- | --- | --- | --- |
+| `<PROVIDER>` | string | required | |
+
+**Examples**
+
+```bash test="cli-shape" id="ref-cua-connections-remove"
+cua connections remove deepseek
+```
+
## `cua agents`
Deprecated alias of `connect`.
@@ -1193,7 +1305,7 @@ cua agents setup [OPTIONS]
| <span id="cua-agents-setup--yes"></span>`--yes` | `-y` | boolean | `false` | Answer yes to every prompt. |
| <span id="cua-agents-setup--force"></span>`--force` | | boolean | `false` | Replace skill folders cua did not write (the old one is backed up). |
| <span id="cua-agents-setup--cua-driver"></span>`--cua-driver` | | boolean | `false` | Set up background computer-use instead: the cua-driver skill and the cua-driver MCP server (`cua-driver mcp`). --mcp-command then names the cua-driver binary. |
-| <span id="cua-agents-setup--sign-in"></span>`--sign-in` | | boolean | `false` | Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connectors). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed. |
+| <span id="cua-agents-setup--sign-in"></span>`--sign-in` | | boolean | `false` | Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connections). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed. |
**Examples**
diff --git a/docs/content/docs/cua-cli/reference/cli/index.mdx b/docs/content/docs/cua-cli/reference/cli/index.mdx
index af06526d57..819eec1bbd 100644
--- a/docs/content/docs/cua-cli/reference/cli/index.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/index.mdx
@@ -77,7 +77,7 @@ One-shot computer actions (screenshot, click, type, windows) against a selected
### Agents, MCP and skills
-Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded skills. [Reference](/cua-cli/reference/cli/agents).
+Agents in a Space, connecting your AI agents and the AI providers they use, the stdio MCP server, and recorded skills. [Reference](/cua-cli/reference/cli/agents).
| Command | Description | Subcommands |
| --- | --- | --- |
@@ -85,6 +85,7 @@ Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded
| <span id="cua-thread"></span><span id="cua-thread-join"></span><span id="cua-thread-inbox"></span><span id="cua-thread-post"></span><span id="cua-thread-read"></span>[`cua thread`](/cua-cli/reference/cli/agents#cua-thread) | A Space's thread, as the agent this computer joined with `cua join`: say who you are, read your inbox, post. | [`join`](/cua-cli/reference/cli/agents#cua-thread-join), [`inbox`](/cua-cli/reference/cli/agents#cua-thread-inbox), [`post`](/cua-cli/reference/cli/agents#cua-thread-post), [`read`](/cua-cli/reference/cli/agents#cua-thread-read) |
| <span id="cua-join"></span>[`cua join`](/cua-cli/reference/cli/agents#cua-join) | Join a Space as an agent on this computer, with the code from a "Join my Cua Space" link. | |
| <span id="cua-connect"></span><span id="cua-connect-detect"></span><span id="cua-connect-setup"></span><span id="cua-connect-status"></span><span id="cua-connect-remove"></span><span id="cua-connect-update"></span>[`cua connect`](/cua-cli/reference/cli/agents#cua-connect) | Connect the AI agents on this computer to Cua: install the cua skills and configure the cua MCP server. | [`detect`](/cua-cli/reference/cli/agents#cua-connect-detect), [`setup`](/cua-cli/reference/cli/agents#cua-connect-setup), [`status`](/cua-cli/reference/cli/agents#cua-connect-status), [`remove`](/cua-cli/reference/cli/agents#cua-connect-remove), [`update`](/cua-cli/reference/cli/agents#cua-connect-update) |
+| <span id="cua-connections"></span><span id="cua-connections-list"></span><span id="cua-connections-add"></span><span id="cua-connections-test"></span><span id="cua-connections-remove"></span>[`cua connections`](/cua-cli/reference/cli/agents#cua-connections) | The AI providers connected once for every app that can use them: list, add (a key from stdin), test, remove. | [`list`](/cua-cli/reference/cli/agents#cua-connections-list), [`add`](/cua-cli/reference/cli/agents#cua-connections-add), [`test`](/cua-cli/reference/cli/agents#cua-connections-test), [`remove`](/cua-cli/reference/cli/agents#cua-connections-remove) |
| <span id="cua-agents"></span><span id="cua-agents-detect"></span><span id="cua-agents-setup"></span><span id="cua-agents-status"></span><span id="cua-agents-remove"></span><span id="cua-agents-update"></span>[`cua agents`](/cua-cli/reference/cli/agents#cua-agents) | Deprecated alias of `connect`. | [`detect`](/cua-cli/reference/cli/agents#cua-agents-detect), [`setup`](/cua-cli/reference/cli/agents#cua-agents-setup), [`status`](/cua-cli/reference/cli/agents#cua-agents-status), [`remove`](/cua-cli/reference/cli/agents#cua-agents-remove), [`update`](/cua-cli/reference/cli/agents#cua-agents-update) |
| <span id="cua-mcp"></span>[`cua mcp`](/cua-cli/reference/cli/agents#cua-mcp) | Stdio MCP server exposing sandboxes, computer control and skills. | |
| <span id="cua-skills"></span><span id="cua-skills-list"></span><span id="cua-skills-read"></span><span id="cua-skills-replay"></span><span id="cua-skills-delete"></span><span id="cua-skills-clean"></span><span id="cua-skills-record"></span>[`cua skills`](/cua-cli/reference/cli/agents#cua-skills) | Recorded demonstrations (skills) for agents. | [`list`](/cua-cli/reference/cli/agents#cua-skills-list), [`read`](/cua-cli/reference/cli/agents#cua-skills-read), [`replay`](/cua-cli/reference/cli/agents#cua-skills-replay), [`delete`](/cua-cli/reference/cli/agents#cua-skills-delete), [`clean`](/cua-cli/reference/cli/agents#cua-skills-clean), [`record`](/cua-cli/reference/cli/agents#cua-skills-record) |
diff --git a/docs/content/docs/cua-cli/reference/index.mdx b/docs/content/docs/cua-cli/reference/index.mdx
index e631b08cd7..c2603ca15e 100644
--- a/docs/content/docs/cua-cli/reference/index.mdx
+++ b/docs/content/docs/cua-cli/reference/index.mdx
@@ -20,7 +20,7 @@ description: "Every cua command and every cua MCP tool, generated from the CLI d
| [Sandboxes](/cua-cli/reference/cli/sandboxes) | Create, reach and delete sandboxes; local runtimes, disk cleanup and the sandbox viewer. |
| [Images and your cloud](/cua-cli/reference/cli/images-and-clouds) | Pull, build, push and publish images, and the cloud account you link for machines. |
| [Computer actions](/cua-cli/reference/cli/computer-actions) | One-shot computer actions (screenshot, click, type, windows) against a selected target, and their recorded trajectories. |
-| [Agents, MCP and skills](/cua-cli/reference/cli/agents) | Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded skills. |
+| [Agents, MCP and skills](/cua-cli/reference/cli/agents) | Agents in a Space, connecting your AI agents and the AI providers they use, the stdio MCP server, and recorded skills. |
| [Account and setup](/cua-cli/reference/cli/account-and-setup) | Sign in and out, user defaults, the cua daemon, health checks and usage telemetry. |
| [Your pool](/cua-cli/reference/cli/pool) | Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --share spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them. |
| [Benchmarks](/cua-cli/reference/cli/bench) | Spaces performance benchmarks: list them, run one in Spaces of its own (result.json and samples.csv in the bench-result v1 format), and check a run against a committed baseline. |
diff --git a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
index fe982f7986..7fb6e395f2 100644
--- a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
+++ b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx
@@ -31,6 +31,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`
| `cua_agent_used_space` | `tool_group` (`shell`, `files`, `computer`, `services`, `agents` or `other`) | First success and agent retention: an AI agent's tool call acted inside a Space and worked. At most one per install per UTC day. |
| `cua_agent_signin_imported` | `harness` (`hermes`, `claude-code`, `codex` or `other`), `via` (`claude_login_keychain`, `claude_login_file`, `device_code`, `token` or `other`) | One-click Connect: an agent's sign-in was copied into Keyvault on This Mac, and the way it was made. Never the sign-in, the account or the provider. |
| `cua_agent_signin_refused` | `harness`, `reason` (`not_signed_in`, `cancelled`, `not_yet`, `failed` or `other`) | One-click Connect: why a sign-in could not be copied. Never the error text or the account. |
+| `cua_connection_changed` | `provider` (a provider id from the Connections registry, a fixed list, or `other`), `method` (`api_key`, `import_login`, `device_code`, `browser_oauth`, `subscription_login`, `adc`, `local_server`, `custom_endpoint` or `other`), `action` (`connect`, `reconnect`, `remove`, `check`), `outcome` (`ok`, `failed`, `cancelled`, `needs_reconnect`) | Which providers people connect and how, how often a connect fails, and how often a saved key stops working. Never a key, a URL, an account or error text. |
| `cua_agent_run_started` | `harness` (cua-agents id or `other`), `location`, `entry` (`spaces_tool`, `cli`, `sdk`, `persistent`, `routine`), `outcome`, `error_kind` | Agent runs started, and failed starts. |
| `cua_agent_run_completed` | `harness`, `location`, `entry`, `outcome`, `error_kind`, `duration_bucket` | First agent run, and how reliably runs finish. Once per run. |
| `cua_agent_join_phase` | `phase` (`posted`, `dispatch_picked`, `host_prepared`, `guest_spawned`, `install_done`, `runner_started`, `agent_spawned`, `acp_initialized`, `acp_authenticated`, `session_ready`, `turn_started`, `first_token`, `turn_ended` or `failed`), `harness`, `runtime`, `cold`, `ms_since_post`, `run` (a per-install salted hash, never the run id), `tool` (`install_done` only), `failure` (`failed` only: `auth`, `install`, `timeout` or `other`) | How long an agent takes to join a Space and answer, step by step, and where joins fail. Never the message, the Space or the account. |
diff --git a/docs/content/docs/spaces/guides/connect-your-agent.mdx b/docs/content/docs/spaces/guides/connect-your-agent.mdx
index 64f628e9e8..3b0a802cf5 100644
--- a/docs/content/docs/spaces/guides/connect-your-agent.mdx
+++ b/docs/content/docs/spaces/guides/connect-your-agent.mdx
@@ -47,7 +47,7 @@ and Cua never reads or copies it. On another computer, sign in to Codex there
An agent that Cua runs in a Space uses the provider keys saved on the computer
that hosts the Space: the **OpenAI key** for Codex and the **Anthropic key** for
-Claude Code. Add them on **Pick your agent** or in **Settings, Connectors**. They stay
+Claude Code. Add them on **Pick your agent** or in **Settings, Connections**. They stay
in this computer's Keychain (Credential Manager on Windows).
### Claude Code and your Claude plan
@@ -194,7 +194,7 @@ An agent can also start other agents inside a Space, as long-lived threads.
Runs live in the guest (`~/.spaces-agents/<run_id>/`) and survive the client
going away. Host credential files are never copied into the Space: an API
key reaches a run only as env you name for that run (`env_from_host`), or as
-a key saved in Settings → Connectors for that harness.
+a key saved in Settings → Connections for that harness.
In TypeScript a run is a thread:
@@ -276,7 +276,7 @@ and the Swift tab is from [Cua Bots](/spaces/examples/cua-bots).
## Agent keys
Claude Code, Codex and the other harnesses need a provider key to run. Add it
-once in **Cua Spaces, Settings, Connectors**, and every agent you start in a Space
+once in **Cua Spaces, Settings, Connections**, and every agent you start in a Space
gets the key it needs.
- **Anthropic** (`ANTHROPIC_API_KEY`): Claude Code and other agents that use Claude.
@@ -315,7 +315,7 @@ from the daemon's environment) wins over a saved one.
`agent_capabilities` counts saved keys: a harness whose key is saved reports
`auth: ok`. A run with no key fails before anything is installed, and the error
-says to add the key in Settings, Connectors or to set it for the Cua daemon.
+says to add the key in Settings, Connections or to set it for the Cua daemon.
### Where the keys are kept
diff --git a/docs/content/docs/spaces/guides/connections.mdx b/docs/content/docs/spaces/guides/connections.mdx
new file mode 100644
index 0000000000..0d20681b21
--- /dev/null
+++ b/docs/content/docs/spaces/guides/connections.mdx
@@ -0,0 +1,126 @@
+---
+title: Connections
+description: 'Connect an AI provider once in Cua Spaces and every app that can use it works: the providers, how to connect each one, and which apps receive what.'
+---
+
+A connection is a provider you have signed in to or given a key for: Anthropic,
+OpenAI, OpenRouter and the rest. Connect it once in **Settings, Connections**
+(called Connectors before) and every app that can use it works, in every Space,
+with nothing to set up inside the Space.
+
+## Connect a provider
+
+Open **Settings, Connections**. Each row is one provider, with its state and the
+apps it works with:
+
+- **Connected**: Cua has a key or sign-in for it and last saw it work.
+- **Needs reconnect**: the provider refused the key or sign-in, or it ran out.
+ Press **Reconnect** and connect it again.
+- **Not connected**: press **Connect**.
+
+The sheet shows only the ways that apply on this machine. For Anthropic that
+can be your Claude sign-in (found on this machine, for Claude Code only) or an
+API key. For OpenAI it is an API key, or your ChatGPT sign-in for Codex.
+Every other provider takes an API key. Anthropic, OpenAI, OpenRouter, Google
+AI Studio, xAI, DeepSeek, Kimi and Custom endpoint are up front; the rest are
+under **More providers**, which you can search by name.
+
+Saving never waits on the provider. Cua checks a key in the background and only
+marks it **Needs reconnect** when the provider says it is invalid.
+
+From the terminal:
+
+```bash skip="no-runner"
+cua connections list
+printf %s "$DEEPSEEK_API_KEY" | cua connections add deepseek
+cua connections test
+cua connections remove deepseek
+```
+
+Keys are read from standard input and are never printed. `cua connect` is
+unchanged: it still connects your coding apps to Cua.
+
+## Which apps get what
+
+A key goes to the apps that can use it and to no others. The sign-ins are
+narrower still: your Claude sign-in only ever goes to Claude Code, and your
+ChatGPT sign-in only to Codex. Other apps use an API key for the same provider.
+
+| App | Receives |
+| --- | --- |
+| Claude Code | Anthropic only: an API key or your Claude sign-in. |
+| Codex | OpenAI only: an API key or your ChatGPT sign-in. |
+| Gemini CLI, Antigravity | Google AI Studio key. |
+| OpenCode, Goose, Pi, OpenClaw | The keys of Anthropic, OpenAI, OpenRouter and (except OpenClaw) Google AI Studio, and for any other provider that serves the API they speak, its base URL and default model. |
+| Hermes | Any connected provider. |
+
+A key reaches a run as an environment variable of that run only, written to a
+file in the run's folder that only the run can read and removed from the event
+log. Nothing is written to the Space image or its Volume.
+
+### Hermes
+
+Hermes picks a provider by its own order when it is not told which, and can
+borrow the sign-ins of other command line tools it finds. Cua tells it instead:
+each run gets a generated Hermes configuration that names the provider you
+connected (Anthropic first, then OpenAI, OpenRouter and the rest), lists the
+other connected providers as fallbacks, and turns off borrowing sign-ins. If
+Hermes cannot reach its provider, the run fails and the thread shows the
+**Connect** card for it.
+
+### A server on your own machine
+
+Use **Custom endpoint** with the server's base URL, for example LM Studio or
+Ollama. A Space that is isolated from your machine cannot reach a server on it,
+and Cua does not change that for you: allow the port for that Space in its
+network settings first. The key is optional.
+
+## Providers
+
+The table is generated from the provider files in the Cua repository, so it is
+always current. Providers whose terms for third-party apps are still being
+checked, and providers Cua has not run end to end yet, are not listed.
+
+{/* providers:start (generated by cua-connections-gen) */}
+
+| Provider | How to connect | Works with |
+| --- | --- | --- |
+| Anthropic | Your sign-in on this machine, A pasted Claude token, API key | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code |
+| OpenAI | Plan sign-in, API key | Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code |
+| OpenRouter | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Google AI Studio | API key | Gemini CLI, Antigravity, OpenCode, Goose, Pi, Hermes |
+| xAI | API key | Codex, OpenCode, Goose, Pi, Hermes, OpenClaw |
+| DeepSeek | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Kimi (Moonshot) | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| GitHub Copilot | API key | GitHub Copilot CLI |
+| Hugging Face | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Z.AI (GLM) | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Fireworks AI | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| NVIDIA NIM | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Ollama Cloud | API key | Hermes |
+| DeepInfra | API key | Hermes |
+| Novita AI | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Nebius Token Factory | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| GMI Cloud | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Upstage Solar | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Arcee AI | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Vercel AI Gateway | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| OpenCode Zen | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| OpenCode Go | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| Kilo Code | API key | Hermes |
+| Xiaomi MiMo | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| StepFun | API key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+| MiniMax | API key | Hermes |
+| Qwen Cloud (Alibaba) | API key | Hermes |
+| Custom endpoint | Base URL and key | OpenCode, Goose, Pi, Hermes, OpenClaw |
+
+{/* providers:end */}
+
+## Adding or hiding a provider
+
+Each provider is one small file in
+`libs/cua/crates/cua-connections/providers`. The generator turns the files into
+the tables the app, the CLI and this page read, and a test fails when any of
+them is out of date. Another test compares the provider names, variables and
+base URLs with the Hermes release Cua installs; `providers/README.md` in that
+folder says how to move that pin.
diff --git a/docs/content/docs/spaces/meta.json b/docs/content/docs/spaces/meta.json
index c7d9f70e7c..1398793c01 100644
--- a/docs/content/docs/spaces/meta.json
+++ b/docs/content/docs/spaces/meta.json
@@ -14,6 +14,7 @@
"guides/add-a-computer",
"guides/bring-your-own-compute",
"guides/connect-a-cloud",
+ "guides/connections",
"---Teams and sharing---",
"guides/teams",
"guides/share-a-space",
diff --git a/docs/content/docs/spaces/reference/agents.mdx b/docs/content/docs/spaces/reference/agents.mdx
index f54e4fdb22..2a5a43d175 100644
--- a/docs/content/docs/spaces/reference/agents.mdx
+++ b/docs/content/docs/spaces/reference/agents.mdx
@@ -29,7 +29,7 @@ Run coding agents inside a Space.
Start a coding agent in the Space.
-Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connectors) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.
+Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connections) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.
| | |
| --- | --- |
@@ -49,7 +49,7 @@ Installs the harness if needed (pinned, checksum-verified), gives it the Space's
| `branch` | `string` | none | Branch or tag for `repo`. |
| `cwd` | `string` | none | Working directory in the Space. Default: the run's own. |
| `env` | `map of string` | `{}` | More environment for the agent, for example `{"HERMES_HOME": "/home/cua/bot"}`. Stored 0600 in the run and redacted from its output; name provider keys in `env_from_host` instead, so their values never pass through the conversation. |
-| `env_from_host` | `string[]` | `[]` | Provider key variables to forward from this server's environment (or from the keys saved in Cua Spaces, Settings → Connectors), for example ["ANTHROPIC_API_KEY"]. Names only; values never pass through the conversation. Saved keys the harness reads are added without being named. |
+| `env_from_host` | `string[]` | `[]` | Provider key variables to forward from this server's environment (or from the keys saved in Cua Spaces, Settings → Connections), for example ["ANTHROPIC_API_KEY"]. Names only; values never pass through the conversation. Saved keys the harness reads are added without being named. |
| `exit_when_idle` | `boolean` | `false` | Stop (resumably) once the prompt is answered. Default false. |
| `files` | `string[]` | `[]` | Host files attached to the first prompt (absolute paths on this server's computer, at most 8 MiB each). |
| `home` | `string` | none | Run as this persistent agent: its home in the Cua Volume (`agents/<home>/`) is restored into the Space first and saved after every turn, the harness keeps its memory there, and the agent gets the `cua` bridge (notify_user, the drive). Creates the persistent agent (this harness, this Space) when it does not exist yet. Default: a one-off run whose state lives only in the Space. |
@@ -291,7 +291,7 @@ No parameters.
#### Result
-JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connectors) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.
+JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connections) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.
#### Errors
diff --git a/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock b/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock
index 00dd5a1c6d..b08744c5df 100644
--- a/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock
+++ b/examples/openkoalabot-example-tauri/src-tauri/Cargo.lock
@@ -1720,6 +1720,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1801,6 +1802,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.4+spec-1.1.0",
+]
+
[[package]]
name = "cua-create-failure"
version = "0.9.0"
diff --git a/examples/streaming/rust/Cargo.lock b/examples/streaming/rust/Cargo.lock
index cbe6d472c6..af61bd563f 100644
--- a/examples/streaming/rust/Cargo.lock
+++ b/examples/streaming/rust/Cargo.lock
@@ -1324,6 +1324,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1418,6 +1419,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.8+spec-1.1.0",
+]
+
[[package]]
name = "cua-contrib"
version = "0.9.0"
@@ -2798,7 +2808,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
- "windows-core 0.58.0",
+ "windows-core",
]
[[package]]
@@ -4687,9 +4697,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
@@ -5232,6 +5242,21 @@ dependencies = [
"winnow 0.7.15",
]
+[[package]]
+name = "toml"
+version = "1.1.8+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime 1.1.2+spec-1.1.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 1.0.4",
+]
+
[[package]]
name = "toml_datetime"
version = "0.7.5+spec-1.1.0"
@@ -5243,9 +5268,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "1.1.1+spec-1.1.0"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [
"serde_core",
]
@@ -5257,7 +5282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
dependencies = [
"indexmap",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
@@ -5265,18 +5290,18 @@ dependencies = [
[[package]]
name = "toml_parser"
-version = "1.1.3+spec-1.1.0"
+version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [
"winnow 1.0.4",
]
[[package]]
name = "toml_writer"
-version = "1.1.2+spec-1.1.0"
+version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "tonic"
@@ -5570,7 +5595,7 @@ dependencies = [
"serde",
"tempfile",
"textwrap",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_internal_macros",
"uniffi_meta",
"uniffi_pipeline",
@@ -5615,7 +5640,7 @@ dependencies = [
"quote",
"serde",
"syn 2.0.119",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_meta",
]
@@ -6001,7 +6026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
dependencies = [
"windows-collections",
- "windows-core 0.61.2",
+ "windows-core",
"windows-future",
"windows-link 0.1.3",
"windows-numerics",
@@ -6013,20 +6038,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
dependencies = [
- "windows-core 0.61.2",
-]
-
-[[package]]
-name = "windows-core"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
-dependencies = [
- "windows-implement 0.58.0",
- "windows-interface 0.58.0",
- "windows-result 0.2.0",
- "windows-strings 0.1.0",
- "windows-targets 0.52.6",
+ "windows-core",
]
[[package]]
@@ -6035,11 +6047,11 @@ version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
dependencies = [
- "windows-implement 0.60.2",
- "windows-interface 0.59.3",
+ "windows-implement",
+ "windows-interface",
"windows-link 0.1.3",
- "windows-result 0.3.4",
- "windows-strings 0.4.2",
+ "windows-result",
+ "windows-strings",
]
[[package]]
@@ -6048,22 +6060,11 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
dependencies = [
- "windows-core 0.61.2",
+ "windows-core",
"windows-link 0.1.3",
"windows-threading",
]
-[[package]]
-name = "windows-implement"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.119",
-]
-
[[package]]
name = "windows-implement"
version = "0.60.2"
@@ -6075,17 +6076,6 @@ dependencies = [
"syn 2.0.119",
]
-[[package]]
-name = "windows-interface"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.119",
-]
-
[[package]]
name = "windows-interface"
version = "0.59.3"
@@ -6115,19 +6105,10 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
- "windows-core 0.61.2",
+ "windows-core",
"windows-link 0.1.3",
]
-[[package]]
-name = "windows-result"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
-dependencies = [
- "windows-targets 0.52.6",
-]
-
[[package]]
name = "windows-result"
version = "0.3.4"
@@ -6137,16 +6118,6 @@ dependencies = [
"windows-link 0.1.3",
]
-[[package]]
-name = "windows-strings"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
-dependencies = [
- "windows-result 0.2.0",
- "windows-targets 0.52.6",
-]
-
[[package]]
name = "windows-strings"
version = "0.4.2"
diff --git a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
index 058b5d1409..e49a1c3d39 100644
--- a/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
+++ b/libs/cua-spacesd/tests/spaces-e2e/Cargo.lock
@@ -2075,6 +2075,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -2184,6 +2185,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.8+spec-1.1.0",
+]
+
[[package]]
name = "cua-contrib"
version = "0.9.0"
@@ -7523,9 +7533,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
@@ -8225,6 +8235,21 @@ dependencies = [
"winnow 0.7.15",
]
+[[package]]
+name = "toml"
+version = "1.1.8+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime 1.1.2+spec-1.1.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 1.0.4",
+]
+
[[package]]
name = "toml_datetime"
version = "0.7.5+spec-1.1.0"
@@ -8236,9 +8261,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "1.1.1+spec-1.1.0"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [
"serde_core",
]
@@ -8250,7 +8275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
dependencies = [
"indexmap",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
@@ -8258,18 +8283,18 @@ dependencies = [
[[package]]
name = "toml_parser"
-version = "1.1.3+spec-1.1.0"
+version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [
"winnow 1.0.4",
]
[[package]]
name = "toml_writer"
-version = "1.1.2+spec-1.1.0"
+version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "tonic"
@@ -8666,7 +8691,7 @@ dependencies = [
"serde",
"tempfile",
"textwrap",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_internal_macros",
"uniffi_meta",
"uniffi_pipeline",
@@ -8712,7 +8737,7 @@ dependencies = [
"quote",
"serde",
"syn 2.0.119",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_meta",
]
diff --git a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
index a7e4a84989..f8f0413a74 100644
--- a/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
+++ b/libs/cua-spacesd/tests/teleport-e2e/Cargo.lock
@@ -1354,6 +1354,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1383,6 +1384,15 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.8+spec-1.1.0",
+]
+
[[package]]
name = "cua-cursor-motion"
version = "0.38.0"
@@ -5501,9 +5511,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
@@ -5824,7 +5834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
- "getrandom 0.3.4",
+ "getrandom 0.4.3",
"once_cell",
"rustix",
"windows-sys 0.61.2",
@@ -6095,6 +6105,21 @@ dependencies = [
"winnow 0.7.15",
]
+[[package]]
+name = "toml"
+version = "1.1.8+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime 1.1.2+spec-1.1.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 1.0.4",
+]
+
[[package]]
name = "toml_datetime"
version = "0.7.5+spec-1.1.0"
@@ -6106,9 +6131,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "1.1.1+spec-1.1.0"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [
"serde_core",
]
@@ -6120,7 +6145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
dependencies = [
"indexmap",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
@@ -6128,18 +6153,18 @@ dependencies = [
[[package]]
name = "toml_parser"
-version = "1.1.3+spec-1.1.0"
+version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [
"winnow 1.0.4",
]
[[package]]
name = "toml_writer"
-version = "1.1.2+spec-1.1.0"
+version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "tonic"
@@ -6491,7 +6516,7 @@ dependencies = [
"serde",
"tempfile",
"textwrap",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_internal_macros",
"uniffi_meta",
"uniffi_pipeline",
@@ -6537,7 +6562,7 @@ dependencies = [
"quote",
"serde",
"syn 2.0.119",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_meta",
]
diff --git a/libs/cua/Cargo.lock b/libs/cua/Cargo.lock
index b56b6ccbbe..dcf38890c2 100644
--- a/libs/cua/Cargo.lock
+++ b/libs/cua/Cargo.lock
@@ -2343,6 +2343,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -2599,6 +2600,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.6+spec-1.1.0",
+]
+
[[package]]
name = "cua-contrib"
version = "0.9.0"
@@ -3197,6 +3207,7 @@ dependencies = [
"cua-agent-setup",
"cua-agents",
"cua-auth",
+ "cua-connections",
"cua-create-failure",
"cua-home",
"cua-keyvault",
@@ -3457,6 +3468,7 @@ dependencies = [
name = "cua-telemetry"
version = "0.9.0"
dependencies = [
+ "cua-connections",
"hex",
"rand 0.9.5",
"serde",
diff --git a/libs/cua/Cargo.toml b/libs/cua/Cargo.toml
index e3c5242a46..a9f98cf469 100644
--- a/libs/cua/Cargo.toml
+++ b/libs/cua/Cargo.toml
@@ -51,6 +51,9 @@ members = [
"crates/cua-spaces-cli",
# Hotspot (reverse-SOCKS) tunnel protocol shared with cua-spacesd.
"crates/cua-hotspot",
+ # The provider registry (Settings, Connections): one TOML file per provider,
+ # the generated tables and the per-app delivery rules.
+ "crates/cua-connections",
# Sealed delivery to a pinned machine key (S1), shared with cua-spacesd
# (the guest that decrypts).
"crates/cua-machine-seal",
@@ -215,6 +218,7 @@ cua-create-failure = { path = "crates/cua-create-failure", version = "0.9.0" } #
cua-spaces = { path = "crates/cua-spaces", version = "0.9.0" } # x-release-please-version
cua-spaces-contract = { path = "crates/cua-spaces-contract", version = "0.9.0" } # x-release-please-version
cua-hotspot = { path = "crates/cua-hotspot", version = "0.9.0" } # x-release-please-version
+cua-connections = { path = "crates/cua-connections", version = "0.9.0" } # x-release-please-version
cua-share = { path = "crates/cua-share", version = "0.9.0" } # x-release-please-version
cua-compat = { path = "crates/cua-compat", version = "0.9.0" } # x-release-please-version
cua-media-protocol = { path = "crates/cua-media-protocol" }
diff --git a/libs/cua/crates/cua-agent-setup/src/signin.rs b/libs/cua/crates/cua-agent-setup/src/signin.rs
index 473a999745..8f6b772344 100644
--- a/libs/cua/crates/cua-agent-setup/src/signin.rs
+++ b/libs/cua/crates/cua-agent-setup/src/signin.rs
@@ -8,7 +8,7 @@
//! |---|---|---|
//! | Codex | `$CODEX_HOME/auth.json` (`tokens`, `OPENAI_API_KEY`); with keyring storage, `codex login status`'s exit code | a sign-in made for Cua: `codex login --device-auth` in a folder Cua owns ([`DeviceSignIn`]), as `CODEX_AUTH_JSON`; never your own `auth.json` |
//! | Claude Code | `claude auth status` (exit 0, `authMethod`), else `.credentials.json` / `.claude.json` | the access token of the sign-in Claude Code already has ([`crate::claude_login`]: the Keychain item `Claude Code-credentials` or `<config dir>/.credentials.json`, who it is from `.claude.json`), as `CLAUDE_CODE_OAUTH_TOKEN`; never the refresh token, and Claude Code's own files and Keychain item are only read |
-//! | Hermes | `$HERMES_HOME/.env` provider keys, `auth.json` `providers` (whether a key is there; never its value) | nothing: it uses the providers connected in Settings, Connectors |
+//! | Hermes | `$HERMES_HOME/.env` provider keys, `auth.json` `providers` (whether a key is there; never its value) | nothing: it uses the providers connected in Settings, Connections |
//! | Cursor | `~/.config/cursor/auth.json`, `~/.cursor/auth.json`, `CURSOR_API_KEY`; else unknown | nothing (no supported export) |
//! | OpenClaw | legacy `auth-profiles.json`; else unknown (profiles are in SQLite) | nothing yet |
//! | T3 Code | uses the agents it controls | nothing (it uses Codex's and Claude's own) |
@@ -582,11 +582,11 @@ fn hermes_check(env: &HostEnv) -> Check {
}
}
-/// Hermes uses the provider keys connected in Settings, Connectors; its own
+/// Hermes uses the provider keys connected in Settings, Connections; its own
/// `.env` is never copied.
fn hermes_copy() -> Result<SignInCopy, CopyRefusal> {
Err(CopyRefusal::NotYet(
- "Connected. Hermes uses your Anthropic or OpenAI connection: connect one in Settings, Connectors.".into(),
+ "Connected. Hermes uses your Anthropic or OpenAI connection: connect one in Settings, Connections.".into(),
))
}
diff --git a/libs/cua/crates/cua-agents/Cargo.toml b/libs/cua/crates/cua-agents/Cargo.toml
index d1051e29ef..c6fe30f0fa 100644
--- a/libs/cua/crates/cua-agents/Cargo.toml
+++ b/libs/cua/crates/cua-agents/Cargo.toml
@@ -12,6 +12,8 @@ repository.workspace = true
cua-spacesd-client.workspace = true
cua-proto = { workspace = true, features = ["client"] }
cua-agent-setup.workspace = true
+# What each app reads from saved connections (the generated provider tables).
+cua-connections.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
diff --git a/libs/cua/crates/cua-agents/src/durable.rs b/libs/cua/crates/cua-agents/src/durable.rs
index ec26a90bc4..56921a1ea3 100644
--- a/libs/cua/crates/cua-agents/src/durable.rs
+++ b/libs/cua/crates/cua-agents/src/durable.rs
@@ -423,13 +423,14 @@ pub fn durable_driver_spec(
}
e
});
- let mut launch = harness::launch_with_home(
+ let mut launch = harness::launch_with_config(
h,
endpoint.as_ref(),
opts.model.as_deref(),
run_dir,
&cwd,
None,
+ opts.hermes_config.as_deref(),
)?;
if d.guard {
launch.env.extend(guard_env(h));
diff --git a/libs/cua/crates/cua-agents/src/failure.rs b/libs/cua/crates/cua-agents/src/failure.rs
index 2cb445ef9a..dc1bf63724 100644
--- a/libs/cua/crates/cua-agents/src/failure.rs
+++ b/libs/cua/crates/cua-agents/src/failure.rs
@@ -27,7 +27,7 @@ pub enum FailureClass {
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Failure {
pub class: FailureClass,
- /// For `needs_connect`: `anthropic` or `openai` (the Connectors row),
+ /// For `needs_connect`: a provider id of the Connections list (`anthropic`, `openrouter`),
/// when the harness has one.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,
@@ -197,13 +197,7 @@ fn provider_for(harness: &str, text: &str) -> Option<String> {
{
return Some(p.into());
}
- let from_text = if t.contains("anthropic") || t.contains("claude") {
- Some("anthropic")
- } else if t.contains("openai") || t.contains("chatgpt") || t.contains("codex") {
- Some("openai")
- } else {
- None
- };
+ let from_text = provider_named(&t);
let own = crate::harness::harness(harness).and_then(|h| h.connect_provider());
match harness {
"claude-code" => Some("anthropic".into()),
@@ -212,6 +206,38 @@ fn provider_for(harness: &str, text: &str) -> Option<String> {
}
}
+/// The connectable provider a lower-cased `t` names first: by id, name, Hermes
+/// id or an alias of four letters or more (so a model id further on, such as
+/// `anthropic/claude-sonnet-5` in an OpenRouter error, does not win).
+fn provider_named(t: &str) -> Option<&'static str> {
+ let mut best: Option<(usize, &'static str)> = None;
+ for p in cua_connections::visible() {
+ let names = std::iter::once(p.id.to_string())
+ .chain(std::iter::once(p.name.to_ascii_lowercase()))
+ .chain((!p.hermes_id.is_empty()).then(|| p.hermes_id.to_string()))
+ .chain(
+ p.aliases
+ .iter()
+ .filter(|a| a.len() >= 4)
+ .map(|a| a.to_ascii_lowercase()),
+ )
+ .chain(match p.id {
+ // Words an error of these providers uses for them.
+ "anthropic" => vec!["claude".to_string()],
+ "openai" => vec!["chatgpt".to_string(), "codex".to_string()],
+ _ => vec![],
+ });
+ for n in names {
+ if let Some(at) = t.find(&n)
+ && best.is_none_or(|(b, _)| at < b)
+ {
+ best = Some((at, p.id));
+ }
+ }
+ }
+ best.map(|(_, id)| id)
+}
+
/// Classifies `text`, the error of a turn or start of `harness`.
pub fn classify(harness: &str, text: &str) -> Failure {
let message = cap(text);
@@ -250,13 +276,22 @@ fn refused(text: &str) -> bool {
.any(|m| t.contains(m))
}
+/// The one short word for a failed agent in a list: Needs reconnect when the provider refused a
+/// credential that was there, Not connected when there was none, Stopped for any other failure.
+/// The same words as the Connections states.
+pub fn status_word(f: &Failure) -> &'static str {
+ match f.class {
+ FailureClass::NeedsConnect if refused(&f.message) => "Needs reconnect",
+ FailureClass::NeedsConnect => "Not connected",
+ FailureClass::Error => "Stopped",
+ }
+}
+
/// A provider's name for a person.
fn provider_label(provider: Option<&str>) -> &'static str {
- match provider {
- Some("anthropic") => "Anthropic",
- Some("openai") => "OpenAI",
- _ => "The provider",
- }
+ provider
+ .and_then(cua_connections::provider)
+ .map_or("The provider", |p| p.name)
}
/// What a person reads instead of the raw error, in plain words from the
@@ -275,7 +310,7 @@ pub fn plain(f: &Failure, harness: &str) -> String {
provider_label(p)
),
// The subscription sign-ins are Claude Code's and Codex's alone.
- ("hermes", _) => "Hermes needs an Anthropic API key or another provider. Your Claude subscription sign-in only works in Claude Code.".into(),
+ ("hermes", _) => "Hermes needs a connected provider. Connect one, then try again. Your Claude subscription sign-in only works in Claude Code.".into(),
(h, _) => {
let name = crate::harness::harness(h).map_or("This agent", |h| h.name);
format!("{name} needs an API key for a provider it can use. Your Claude subscription sign-in only works in Claude Code.")
@@ -321,6 +356,52 @@ mod tests {
}
}
+ #[test]
+ fn hermes_failures_name_the_provider_the_card_connects() {
+ for (t, p) in [
+ (
+ "OpenRouter rejected your API key (model anthropic/claude-sonnet-5)",
+ "openrouter",
+ ),
+ ("DeepSeek rejected your API key", "deepseek"),
+ ("Moonshot rejected your API key", "kimi"),
+ ("xAI rejected your API key", "xai"),
+ ("Anthropic rejected your API key", "anthropic"),
+ ("HTTP 401 from api.openai.com: invalid api key", "openai"),
+ ] {
+ let f = classify("hermes", t);
+ assert_eq!(f.class, FailureClass::NeedsConnect, "{t}");
+ assert_eq!(f.provider.as_deref(), Some(p), "{t}");
+ }
+ let f = classify("hermes", "OpenRouter rejected your API key");
+ assert_eq!(
+ plain(&f, "hermes"),
+ "OpenRouter rejected the key Hermes used. Update it, then try again."
+ );
+ }
+
+ #[test]
+ fn a_failed_agent_reads_with_the_connections_words() {
+ let w = |h: &str, t: &str| status_word(&classify(h, t));
+ assert_eq!(w("claude-code", "Authentication required"), "Not connected");
+ assert_eq!(
+ w(
+ "claude-code",
+ "API Error: 401 OAuth access token is invalid"
+ ),
+ "Needs reconnect"
+ );
+ assert_eq!(
+ w("hermes", "OpenRouter rejected your API key"),
+ "Needs reconnect"
+ );
+ assert_eq!(
+ w("hermes", "Hermes is not connected to any AI provider"),
+ "Not connected"
+ );
+ assert_eq!(w("claude-code", "rate limited, try later"), "Stopped");
+ }
+
#[test]
fn other_errors_stay_errors_and_keep_their_text() {
let f = classify("claude-code", "rate limited, try later");
@@ -339,7 +420,7 @@ mod tests {
&classify("hermes", "not connected to any AI provider"),
"hermes",
);
- assert!(h.starts_with("Hermes needs an Anthropic API key"), "{h}");
+ assert!(h.starts_with("Hermes needs a connected provider"), "{h}");
assert!(h.contains("only works in Claude Code"));
assert!(!p.contains("401") && !p.contains('{'), "{p}");
assert!(!p.contains('\u{b7}'));
diff --git a/libs/cua/crates/cua-agents/src/harness.rs b/libs/cua/crates/cua-agents/src/harness.rs
index d73239371d..b846412ee7 100644
--- a/libs/cua/crates/cua-agents/src/harness.rs
+++ b/libs/cua/crates/cua-agents/src/harness.rs
@@ -86,11 +86,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["claude-agent-acp", "claude-code"],
acp: &["claude-agent-acp"],
cli: Some("claude"),
- keys: &[
- "ANTHROPIC_API_KEY",
- "CLAUDE_CODE_OAUTH_TOKEN",
- "ANTHROPIC_AUTH_TOKEN",
- ],
+ keys: cua_connections::READS_CLAUDE_CODE,
logins: Some(&[
"[ -s \"$HOME/.claude/.credentials.json\" ]",
"security find-generic-password -s 'Claude Code-credentials' >/dev/null 2>&1",
@@ -113,7 +109,7 @@ pub const HARNESSES: &[Harness] = &[
// person's Mac (their `~/.codex/auth.json`, OpenAI's documented
// headless route). A run writes it to the guest's
// `~/.codex/auth.json` when the guest has none ([`crate::runs`]).
- keys: &["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_AUTH_JSON"],
+ keys: cua_connections::READS_OPENAI_CODEX,
logins: Some(&["[ -s \"$HOME/.codex/auth.json\" ]"]),
auth_method: None,
wires: &[Wire::OpenaiResponses],
@@ -129,7 +125,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["gemini-cli"],
acp: &["gemini", "--acp"],
cli: Some("gemini"),
- keys: &["GEMINI_API_KEY", "GOOGLE_API_KEY"],
+ keys: cua_connections::READS_GEMINI_CLI,
logins: Some(&[]),
auth_method: Some("gemini-api-key"),
wires: &[Wire::Gemini],
@@ -147,7 +143,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["antigravity-acp"],
acp: &["agy-acp-server", "--uid="],
cli: None,
- keys: &["GEMINI_API_KEY"],
+ keys: cua_connections::READS_GOOGLE_ANTIGRAVITY,
logins: Some(&[]),
auth_method: Some("gemini-api-key"),
wires: &[Wire::Gemini],
@@ -166,12 +162,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["opencode"],
acp: &["opencode", "acp"],
cli: Some("opencode"),
- keys: &[
- "ANTHROPIC_API_KEY",
- "OPENAI_API_KEY",
- "GEMINI_API_KEY",
- "OPENROUTER_API_KEY",
- ],
+ keys: cua_connections::READS_OPENCODE,
logins: Some(&[
"[ -s \"$HOME/.local/share/opencode/auth.json\" ]",
"[ -s \"$HOME/.config/opencode/opencode.json\" ]",
@@ -190,12 +181,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["goose"],
acp: &["goose", "acp"],
cli: Some("goose"),
- keys: &[
- "OPENAI_API_KEY",
- "ANTHROPIC_API_KEY",
- "GOOGLE_API_KEY",
- "OPENROUTER_API_KEY",
- ],
+ keys: cua_connections::READS_GOOSE,
logins: Some(&[
"[ -s \"$HOME/.config/goose/config.yaml\" ]",
"[ -s \"$HOME/.config/goose/secrets.yaml\" ]",
@@ -214,12 +200,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["pi"],
acp: &["pi-acp"],
cli: Some("pi"),
- keys: &[
- "ANTHROPIC_API_KEY",
- "OPENAI_API_KEY",
- "GEMINI_API_KEY",
- "OPENROUTER_API_KEY",
- ],
+ keys: cua_connections::READS_PI,
logins: Some(&[
"[ -s \"$HOME/.pi/agent/auth.json\" ]",
"[ -s \"$HOME/.pi/agent/models.json\" ]",
@@ -241,10 +222,11 @@ pub const HARNESSES: &[Harness] = &[
installs: &["hermes"],
acp: &["hermes-acp"],
cli: Some("hermes"),
- // Provider API keys only. The Claude subscription sign-in
- // (CLAUDE_CODE_OAUTH_TOKEN) and the ChatGPT one (CODEX_AUTH_JSON) are
- // Claude Code's and Codex's: they are never given to Hermes.
- keys: &["OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"],
+ // Provider API keys only, for every provider Hermes supports. The
+ // Claude subscription sign-in (CLAUDE_CODE_OAUTH_TOKEN) and the ChatGPT
+ // one (CODEX_AUTH_JSON) are Claude Code's and Codex's: they are never
+ // given to Hermes (the provider files scope them).
+ keys: cua_connections::READS_HERMES,
// Its own `.env` (a key set inside the Space) or a provider sign-in.
logins: Some(&[
"[ -s \"$HOME/.hermes/.env\" ]",
@@ -268,7 +250,7 @@ pub const HARNESSES: &[Harness] = &[
installs: &["openclaw"],
acp: &["openclaw", "acp"],
cli: Some("openclaw"),
- keys: &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY"],
+ keys: cua_connections::READS_OPENCLAW,
logins: Some(&[
"[ -s \"$HOME/.openclaw/openclaw.json\" ]",
"[ -s \"$HOME/.openclaw/.env\" ]",
@@ -345,15 +327,17 @@ pub enum Auth {
/// What the guest probe found: `env:<NAME>`, `login`, or `none`.
pub const PROBE_NONE: &str = "none";
-/// Where the Cua Spaces app takes a key named `env` (Settings, Connectors):
-/// Anthropic and OpenAI have their own rows, any other key goes under Other.
+/// Where the Cua Spaces app takes a key named `env` (Settings, Connections):
+/// the provider that saves it, else under Other keys.
pub fn settings_hint(env: &str) -> String {
- match env {
- "ANTHROPIC_API_KEY" => {
- "Add an Anthropic API key in Cua Spaces → Settings → Connectors".into()
- }
- "OPENAI_API_KEY" => "Add an OpenAI API key in Cua Spaces → Settings → Connectors".into(),
- other => format!("Add {other} under Other in Cua Spaces → Settings → Connectors"),
+ match cua_connections::provider_of_env(env) {
+ Some(p) => format!(
+ "Connect {} in Cua Spaces \u{2192} Settings \u{2192} Connections",
+ p.name
+ ),
+ None => format!(
+ "Add {env} under Other keys in Cua Spaces \u{2192} Settings \u{2192} Connections"
+ ),
}
}
@@ -579,6 +563,22 @@ pub fn launch_with_home(
run_dir: &str,
cwd: &str,
home: Option<&str>,
+) -> crate::Result<Launch> {
+ launch_with_config(h, endpoint, model, run_dir, cwd, home, None)
+}
+
+/// [`launch_with_home`] with `hermes_config`: the `config.yaml` Cua generated
+/// from the person's connections (`cua_connections::hermes`). Hermes then
+/// starts from it, not from the guest's own setup, and uses the provider it
+/// names. Ignored for any other harness and when an endpoint is given.
+pub fn launch_with_config(
+ h: &Harness,
+ endpoint: Option<&Endpoint>,
+ model: Option<&str>,
+ run_dir: &str,
+ cwd: &str,
+ home: Option<&str>,
+ hermes_config: Option<&str>,
) -> crate::Result<Launch> {
let mut l = Launch::default();
let model = endpoint
@@ -744,9 +744,13 @@ pub fn launch_with_home(
}
}
"hermes" => {
+ let generated = hermes_config.filter(|_| endpoint.is_none());
let hermes_home = match home {
Some(h) => Some(format!("{h}/hermes")),
- None => base.as_ref().map(|_| format!("{run_dir}/hermes-home")),
+ None => base
+ .as_ref()
+ .map(|_| format!("{run_dir}/hermes-home"))
+ .or_else(|| generated.map(|_| format!("{run_dir}/hermes-home"))),
};
if let Some(b) = &base {
let m = model.clone().unwrap_or_else(|| "default".into());
@@ -758,12 +762,23 @@ pub fn launch_with_home(
},
body: format!(
"model:\n default: {m:?}\n provider: custom\n base_url: {:?}\n \
- api_key: ${{OPENAI_API_KEY}}\n context_length: 131072\n",
+ api_key: ${{OPENAI_API_KEY}}\n context_length: 131072\n\
+ auth:\n adopt_external_logins: false\n",
v1(b)
),
});
+ } else if let Some(yaml) = generated {
+ let dir = hermes_home.clone().expect("set with a generated config");
+ l.files.push(ConfigFile {
+ rel: match home {
+ Some(_) => format!("{dir}/config.yaml"),
+ None => "hermes-home/config.yaml".into(),
+ },
+ body: yaml.to_string(),
+ });
+ // The provider, model and credentials all come from the connections.
} else if let Some(dir) = &hermes_home {
- // No endpoint: start from the guest's own Hermes setup.
+ // No connections: start from the guest's own Hermes setup.
let q = crate::quote;
l.prelude.extend([
format!("mkdir -p {}", q(dir)),
@@ -1161,4 +1176,89 @@ mod tests {
assert!(key_check(h, &all, false).is_none(), "{}", h.id);
}
}
+
+ /// The registry and the launcher agree on the apps and on how they are pointed at an endpoint.
+ #[test]
+ fn the_registry_names_the_same_apps_and_wires() {
+ let ours: Vec<&str> = HARNESSES.iter().map(|h| h.id).collect();
+ assert_eq!(ours, cua_connections::HARNESS_IDS);
+ for (id, wire) in cua_connections::ENDPOINT_HARNESSES {
+ let h = harness(id).unwrap();
+ assert_eq!(Wire::parse(wire), Some(h.wires[0]), "{id}");
+ }
+ // What an app reads is what the registry delivers to it, nothing more.
+ for h in HARNESSES {
+ assert_eq!(h.keys, cua_connections::reads(h.id), "{}", h.id);
+ }
+ }
+
+ #[test]
+ fn hermes_starts_from_the_config_cua_generated() {
+ let hermes = harness("hermes").unwrap();
+ let yaml = "model:\n provider: \"openrouter\"\n";
+ let l =
+ launch_with_config(hermes, None, None, "/run/1", "/work", None, Some(yaml)).unwrap();
+ let f = l
+ .files
+ .iter()
+ .find(|f| f.rel == "hermes-home/config.yaml")
+ .unwrap();
+ assert_eq!(f.body, yaml);
+ assert!(
+ l.env
+ .contains(&("HERMES_HOME".into(), "/run/1/hermes-home".into()))
+ );
+ // Nothing is copied from the guest's own Hermes setup, no wrapper or prelude is needed.
+ assert!(l.prelude.is_empty() && l.wrapper.is_none());
+ // With a persistent home the file lands in the home, over any older copy.
+ let l = launch_with_config(
+ hermes,
+ None,
+ None,
+ "/run/1",
+ "/work",
+ Some("/home/a"),
+ Some(yaml),
+ )
+ .unwrap();
+ assert!(
+ l.files
+ .iter()
+ .any(|f| f.rel == "/home/a/hermes/config.yaml" && f.body == yaml)
+ );
+ // An explicit endpoint wins, and never borrows logins either.
+ let ep = Endpoint {
+ base_url: "http://x/v1".into(),
+ wire: None,
+ model: Some("m".into()),
+ };
+ let l = launch_with_config(hermes, Some(&ep), None, "/run/1", "/work", None, Some(yaml))
+ .unwrap();
+ let f = l
+ .files
+ .iter()
+ .find(|f| f.rel == "hermes-home/config.yaml")
+ .unwrap();
+ assert!(
+ f.body.contains("provider: custom") && f.body.contains("adopt_external_logins: false"),
+ "{}",
+ f.body
+ );
+ // No connections: the guest's own setup, as before.
+ let l = launch_with_config(hermes, None, None, "/run/1", "/work", Some("/home/a"), None)
+ .unwrap();
+ assert!(l.files.is_empty() && !l.prelude.is_empty());
+ // Other apps ignore it.
+ let l = launch_with_config(
+ harness("goose").unwrap(),
+ None,
+ None,
+ "/run/1",
+ "/work",
+ None,
+ Some(yaml),
+ )
+ .unwrap();
+ assert!(l.files.is_empty());
+ }
}
diff --git a/libs/cua/crates/cua-agents/src/lib.rs b/libs/cua/crates/cua-agents/src/lib.rs
index 18b0d0a068..a5f83583e8 100644
--- a/libs/cua/crates/cua-agents/src/lib.rs
+++ b/libs/cua/crates/cua-agents/src/lib.rs
@@ -21,6 +21,8 @@ pub mod transcript;
/// Where Claude Code keeps its sign-in (the freshness check at run start reads it).
pub use cua_agent_setup::{HostEnv, claude_login, signin};
+/// The provider registry (what each saved connection is and which app receives it).
+pub use cua_connections as connections;
pub use durable::{DriverSpec, DurableOptions, Policy, durable_driver_spec};
pub use events::{AgentEvent, EventPage};
pub use harness::{Endpoint, Harness, Wire};
diff --git a/libs/cua/crates/cua-agents/src/runs.rs b/libs/cua/crates/cua-agents/src/runs.rs
index 1b263c6974..f4c3909133 100644
--- a/libs/cua/crates/cua-agents/src/runs.rs
+++ b/libs/cua/crates/cua-agents/src/runs.rs
@@ -127,6 +127,11 @@ pub struct RunOptions {
/// journal, a tool ledger, resume with a recovery note. Implies
/// `exit_when_idle`.
pub durable: Option<crate::durable::DurableOptions>,
+ /// Hermes's `config.yaml`, generated from the person's connections
+ /// (names the provider and model, no secrets): Hermes starts from it, not
+ /// from the guest's own setup. Ignored for other harnesses and with an
+ /// endpoint.
+ pub hermes_config: Option<String>,
}
/// `meta.json`.
@@ -975,13 +980,14 @@ impl Agents {
}
e
});
- let mut launch = harness::launch_with_home(
+ let mut launch = harness::launch_with_config(
h,
endpoint.as_ref(),
opts.model.as_deref(),
&rdir,
&cwd,
home_dir.as_deref(),
+ opts.hermes_config.as_deref(),
)?;
if opts.durable.as_ref().is_some_and(|d| d.guard) {
launch.env.extend(crate::durable::guard_env(h));
@@ -1634,7 +1640,7 @@ mod tests {
"{e}"
);
assert!(
- e.contains("Add an Anthropic API key in Cua Spaces → Settings → Connectors"),
+ e.contains("Connect Anthropic in Cua Spaces → Settings → Connections"),
"{e}"
);
}
@@ -1646,7 +1652,7 @@ mod tests {
"{e}"
);
assert!(
- e.contains("Add an OpenAI API key in Cua Spaces → Settings → Connectors"),
+ e.contains("Connect OpenAI in Cua Spaces → Settings → Connections"),
"{e}"
);
// A key in the guest environment, or a sign-in file: allowed.
diff --git a/libs/cua/crates/cua-cli/src/agent_cmd.rs b/libs/cua/crates/cua-cli/src/agent_cmd.rs
index e3d3f48d61..c482aaa13e 100644
--- a/libs/cua/crates/cua-cli/src/agent_cmd.rs
+++ b/libs/cua/crates/cua-cli/src/agent_cmd.rs
@@ -168,7 +168,7 @@ pub enum AgentCmd {
cua --json agent harnesses")]
Harnesses,
/// The provider keys agents get, kept in the Keychain by the Cua daemon
- /// (Cua Spaces → Settings → Connectors). Values are read from stdin and never
+ /// (Cua Spaces → Settings → Connections). Values are read from stdin and never
/// printed.
#[command(after_help = "Examples:
cua agent keys
@@ -478,7 +478,7 @@ async fn follow(
/// The harnesses with the readiness the Spaces server reports
/// (`agent_capabilities`, which counts the keys saved in Cua Spaces →
-/// Settings → Connectors and the server's environment), so `cua agent
+/// Settings → Connections and the server's environment), so `cua agent
/// harnesses`, MCP and the app agree. Without a server: the static list.
async fn harnesses(cua: &Arc<Cua>) -> serde_json::Value {
let caps = cua
diff --git a/libs/cua/crates/cua-cli/src/agent_keys_cmd.rs b/libs/cua/crates/cua-cli/src/agent_keys_cmd.rs
index ba96deff1d..8ea8152fd9 100644
--- a/libs/cua/crates/cua-cli/src/agent_keys_cmd.rs
+++ b/libs/cua/crates/cua-cli/src/agent_keys_cmd.rs
@@ -1,5 +1,5 @@
//! `cua agent keys`: the provider keys agents get, kept in the Keychain by
-//! the Cua daemon (what Cua Spaces → Settings → Connectors shows).
+//! the Cua daemon (what Cua Spaces → Settings → Connections shows).
//!
//! ```text
//! cua agent keys # list (provider, variable, last 4, added)
diff --git a/libs/cua/crates/cua-cli/src/agents.rs b/libs/cua/crates/cua-cli/src/agents.rs
index d658eb01df..4d0958b393 100644
--- a/libs/cua/crates/cua-cli/src/agents.rs
+++ b/libs/cua/crates/cua-cli/src/agents.rs
@@ -102,7 +102,7 @@ pub struct SetupCmdArgs {
/// from where Claude Code keeps it, as an access token only; Claude
/// Code's own sign-in is never changed) and Codex's own device sign-in
/// (a link and a code to enter there, in a folder Cua owns); Hermes uses
- /// the providers connected in Cua Spaces (Settings, Connectors).
+ /// the providers connected in Cua Spaces (Settings, Connections).
/// Only Claude Code's own sign-in is read, and only its access token is
/// kept; Codex's own `auth.json` is never read or changed.
#[arg(long, conflicts_with = "cua_driver")]
diff --git a/libs/cua/crates/cua-cli/src/connections_cmd.rs b/libs/cua/crates/cua-cli/src/connections_cmd.rs
new file mode 100644
index 0000000000..63cacef2f7
--- /dev/null
+++ b/libs/cua/crates/cua-cli/src/connections_cmd.rs
@@ -0,0 +1,620 @@
+//! `cua connections`: the providers Cua Spaces connects once for every app
+//! that can use them (what Settings, Connections shows).
+//!
+//! ```text
+//! cua connections list # every provider, its state, the apps it works with
+//! pbpaste | cua connections add deepseek # the key comes from stdin, never argv
+//! cua connections add custom --base-url http://host:1234/v1 --model qwen < /dev/null
+//! cua connections add zai --region coding-global < key.txt
+//! cua connections test # ask each provider whether the saved keys still work
+//! cua connections remove deepseek
+//! ```
+//!
+//! These are the daemon's app methods (`agent_keys.*`), not MCP tools: no
+//! agent can read or change a key, and nothing here prints one. `cua connect`
+//! is a different command: it connects your coding apps to Cua.
+
+use std::collections::BTreeSet;
+use std::io::{IsTerminal, Read, Write};
+use std::sync::Arc;
+use std::time::Duration;
+
+use clap::Subcommand;
+use cua_agents::connections as reg;
+use cua_sdk::{Cua, CuaError};
+
+use crate::util::{hint, line};
+
+/// How long `cua connections test` waits for the providers in all.
+const TEST_WAIT: Duration = Duration::from_secs(20);
+
+#[derive(Subcommand, Debug, Clone)]
+pub enum ConnectionsCmd {
+ /// List the providers with their state (Connected, Needs reconnect, Not
+ /// connected) and the apps each works with. Never prints a key.
+ #[command(after_help = "Examples:
+ cua connections list
+ cua connections list --all
+ cua --json connections list")]
+ List {
+ /// Also list every provider that is not connected (by default: the
+ /// ones up front and the ones with something saved).
+ #[arg(long)]
+ all: bool,
+ },
+ /// Connect a provider. The key is read from stdin (pipe it in; a
+ /// terminal is refused so it isn't echoed). Saving never waits on the
+ /// provider: `cua connections test` asks it afterwards.
+ ///
+ /// The provider is one of the ids `cua connections list --all` prints.
+ /// Pipe the key in: `pbpaste | cua connections add deepseek`. Sign-ins
+ /// another app made on this machine are imported with
+ /// `cua connect setup <app> --sign-in`.
+ #[command(after_help = "Examples:
+ cua connections add deepseek
+ cua connections add zai --region coding-global
+ cua connections add deepinfra --model meta-llama/Meta-Llama-3.1-70B-Instruct
+ cua connections add custom --base-url http://host:1234/v1 --model qwen")]
+ Add {
+ /// The provider id (`cua connections list --all`).
+ provider: String,
+ /// How: `key` (an API key from stdin; the default) or `endpoint` (a
+ /// custom endpoint: its base URL, model and API style; a key is optional).
+ #[arg(long)]
+ method: Option<String>,
+ /// The plan or region, for a provider that has them (Z.AI: global, cn,
+ /// coding-global, coding-cn).
+ #[arg(long)]
+ region: Option<String>,
+ /// The model to use, for a provider with no default model or to choose another.
+ #[arg(long)]
+ model: Option<String>,
+ /// A custom endpoint's base URL.
+ #[arg(long = "base-url")]
+ base_url: Option<String>,
+ /// A custom endpoint's API style: openai-chat (default), openai-responses or anthropic.
+ #[arg(long)]
+ wire: Option<String>,
+ },
+ /// Ask each provider whether its saved key still works (a read-only
+ /// request on the provider's own host, bounded in time; offline is not a
+ /// failure). A key the provider refuses is listed as Needs reconnect.
+ #[command(after_help = "Examples:
+ cua connections test
+ cua connections test openrouter")]
+ Test {
+ /// Only this provider.
+ provider: Option<String>,
+ },
+ /// Disconnect a provider: remove what is saved for it.
+ #[command(after_help = "Examples:
+ cua connections remove deepseek")]
+ Remove { provider: String },
+}
+
+/// One provider as `list` shows it.
+#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
+pub struct Row {
+ pub id: String,
+ pub name: String,
+ /// `connected`, `needs_reconnect` or `not_connected`.
+ pub state: &'static str,
+ /// The apps it works with.
+ pub works_with: Vec<String>,
+ /// `api_key`, `import_login`, ... or the plan chosen, when connected.
+ pub detail: Option<String>,
+}
+
+/// The key from stdin: piped, never typed (a terminal would echo it).
+pub fn read_key(
+ stdin: &mut dyn Read,
+ is_terminal: bool,
+ required: bool,
+) -> Result<String, CuaError> {
+ if is_terminal {
+ if !required {
+ return Ok(String::new());
+ }
+ return Err(CuaError::InvalidArgument(
+ "pipe the key in, so it isn't shown or kept in your shell history: \
+ pbpaste | cua connections add <provider>"
+ .into(),
+ ));
+ }
+ let mut s = String::new();
+ stdin
+ .take(16 * 1024)
+ .read_to_string(&mut s)
+ .map_err(|e| CuaError::InvalidArgument(format!("reading the key from stdin: {e}")))?;
+ let s = s.trim().to_string();
+ if s.is_empty() && required {
+ return Err(CuaError::InvalidArgument("no key on stdin".into()));
+ }
+ Ok(s)
+}
+
+fn harness_name(id: &str) -> String {
+ cua_agents::harness::harness(id).map_or_else(|| id.to_string(), |h| h.name.to_string())
+}
+
+/// The rows for `report` (the daemon's `agent_keys.list`): every visible
+/// provider, up front first.
+pub fn rows(report: &serde_json::Value, all: bool) -> Vec<Row> {
+ let keys = report["keys"].as_array().cloned().unwrap_or_default();
+ let by_env = |env: &str| keys.iter().find(|k| k["env"] == env);
+ let mut out = vec![];
+ let ordered = reg::visible()
+ .filter(|p| p.tier == reg::Tier::Top)
+ .chain(reg::visible().filter(|p| p.tier != reg::Tier::Top));
+ for p in ordered {
+ let saved: Vec<&serde_json::Value> = p.envs().filter_map(by_env).collect();
+ let working = saved.iter().find(|k| k["expired"] != true);
+ let state = if working.is_some() {
+ "connected"
+ } else if !saved.is_empty() {
+ "needs_reconnect"
+ } else {
+ "not_connected"
+ };
+ if !all && state == "not_connected" && p.tier != reg::Tier::Top {
+ continue;
+ }
+ let detail = working.or(saved.first()).map(|k| {
+ let region = k["region"]
+ .as_str()
+ .and_then(|r| p.regions.iter().find(|x| x.id == r))
+ .map(|r| format!(", {}", r.name))
+ .unwrap_or_default();
+ format!(
+ "{}{region}",
+ method_of(p, k["env"].as_str().unwrap_or_default())
+ )
+ });
+ let mut works: Vec<String> = reg::works_with(p).into_iter().map(harness_name).collect();
+ works.extend(p.apps.iter().map(|a| match *a {
+ "copilot-cli" => "GitHub Copilot CLI".to_string(),
+ "t3code" => "T3 Code".to_string(),
+ other => other.to_string(),
+ }));
+ out.push(Row {
+ id: p.id.into(),
+ name: p.name.into(),
+ state,
+ works_with: works,
+ detail,
+ });
+ }
+ out
+}
+
+/// How a saved name connects `p`, in words.
+fn method_of(p: &reg::Provider, env: &str) -> &'static str {
+ match p
+ .methods
+ .iter()
+ .find(|m| m.env == env || m.aliases.contains(&env))
+ .map(|m| m.kind)
+ {
+ Some(reg::MethodKind::ImportLogin) => "sign-in found on this machine",
+ Some(reg::MethodKind::SubscriptionLogin) => "plan sign-in",
+ Some(reg::MethodKind::CustomEndpoint) => "custom endpoint",
+ _ => "API key",
+ }
+}
+
+fn state_words(state: &str) -> &'static str {
+ match state {
+ "connected" => "Connected",
+ "needs_reconnect" => "Needs reconnect",
+ _ => "Not connected",
+ }
+}
+
+/// `list`'s text lines for `rows`.
+pub fn list_lines(rows: &[Row], report: &serde_json::Value) -> Vec<String> {
+ let mut v = vec![];
+ if report["available"] == false {
+ v.push(format!(
+ "Keys can't be saved here: {}.",
+ report["unavailable"].as_str().unwrap_or("no Keychain")
+ ));
+ }
+ let w = rows.iter().map(|r| r.id.len()).max().unwrap_or(0);
+ for r in rows {
+ let mut l = format!("{:<w$} {:<15}", r.id, state_words(r.state));
+ if let Some(d) = &r.detail {
+ l.push_str(&format!(" {d}"));
+ }
+ if !r.works_with.is_empty() {
+ l.push_str(&format!(" works with {}", r.works_with.join(", ")));
+ }
+ v.push(l.trim_end().to_string());
+ }
+ if rows.iter().all(|r| r.state == "not_connected") {
+ v.push(hint(
+ "Nothing connected yet. Add a key with: pbpaste | cua connections add anthropic",
+ ));
+ }
+ v
+}
+
+/// The daemon call for `cmd`: method and arguments, after the input checks.
+pub fn plan(
+ cmd: &ConnectionsCmd,
+ key: impl FnOnce(bool) -> Result<String, CuaError>,
+) -> Result<(String, serde_json::Value), CuaError> {
+ match cmd {
+ ConnectionsCmd::Add {
+ provider,
+ method,
+ region,
+ model,
+ base_url,
+ wire,
+ } => {
+ let def = reg::provider(provider)
+ .filter(|p| p.visible())
+ .ok_or_else(|| {
+ CuaError::InvalidArgument(format!(
+ "unknown provider {provider:?}: one of {} (see `cua connections list --all`)",
+ reg::PROVIDER_IDS.join(", ")
+ ))
+ })?;
+ let want = method
+ .as_deref()
+ .unwrap_or(if def.kind == reg::Kind::Custom {
+ "endpoint"
+ } else {
+ "key"
+ });
+ let offered: Vec<&str> = def
+ .offered()
+ .filter_map(|m| match m.kind {
+ reg::MethodKind::ApiKey => Some("key"),
+ reg::MethodKind::CustomEndpoint => Some("endpoint"),
+ _ => None,
+ })
+ .collect();
+ if !offered.contains(&want) {
+ let other = def.offered().any(|m| {
+ matches!(
+ m.kind,
+ reg::MethodKind::ImportLogin | reg::MethodKind::SubscriptionLogin
+ )
+ });
+ return Err(CuaError::InvalidArgument(
+ if other && matches!(want, "import" | "login") {
+ format!(
+ "{} signs in through its app: run `cua connect setup <app> --sign-in`, or use --method key with an API key",
+ def.name
+ )
+ } else {
+ format!("{} can be connected with: {}", def.name, offered.join(", "))
+ },
+ ));
+ }
+ let optional = def.key_method().is_some_and(|m| m.secret_optional);
+ let value = key(!optional)?;
+ let mut a = serde_json::json!({ "provider": def.id, "value": value });
+ if let Some(r) = region {
+ a["region"] = r.clone().into();
+ }
+ let mut fields = serde_json::Map::new();
+ if let Some(m) = model {
+ fields.insert("model".into(), m.clone().into());
+ }
+ if def.kind == reg::Kind::Custom {
+ if let Some(b) = base_url {
+ fields.insert("base_url".into(), b.clone().into());
+ }
+ fields.insert(
+ "wire".into(),
+ wire.clone().unwrap_or_else(|| "openai-chat".into()).into(),
+ );
+ } else if base_url.is_some() || wire.is_some() {
+ return Err(CuaError::InvalidArgument(
+ "--base-url and --wire are for a custom endpoint (cua connections add custom)"
+ .into(),
+ ));
+ }
+ if !fields.is_empty() {
+ a["fields"] = fields.into();
+ }
+ Ok(("agent_keys.set".into(), a))
+ }
+ ConnectionsCmd::Test { provider } => {
+ if let Some(p) = provider
+ && reg::provider(p).filter(|d| d.visible()).is_none()
+ {
+ return Err(CuaError::InvalidArgument(format!("unknown provider {p:?}")));
+ }
+ Ok(("agent_keys.check".into(), serde_json::json!({})))
+ }
+ ConnectionsCmd::List { .. } => Ok(("agent_keys.list".into(), serde_json::json!({}))),
+ ConnectionsCmd::Remove { provider } => {
+ // The names saved for it are known only from the list: `run` resolves them.
+ reg::provider(provider)
+ .filter(|p| p.visible())
+ .ok_or_else(|| {
+ CuaError::InvalidArgument(format!("unknown provider {provider:?}"))
+ })?;
+ Ok(("agent_keys.list".into(), serde_json::json!({})))
+ }
+ }
+}
+
+async fn call(
+ cua: &Arc<Cua>,
+ method: &str,
+ args: serde_json::Value,
+) -> Result<serde_json::Value, CuaError> {
+ let r = cua
+ .spaces()
+ .call_tool_json(method.into(), Some(args.to_string()))
+ .await?;
+ if r.is_error {
+ let msg = r
+ .text
+ .strip_prefix("error: ")
+ .unwrap_or(&r.text)
+ .to_string();
+ return Err(CuaError::InvalidArgument(msg));
+ }
+ Ok(serde_json::from_str(&r.text).unwrap_or_default())
+}
+
+pub async fn run(
+ cua: &Arc<Cua>,
+ cmd: ConnectionsCmd,
+ json: bool,
+ out: &mut dyn Write,
+) -> Result<i32, CuaError> {
+ let (method, args) = plan(&cmd, |required| {
+ read_key(
+ &mut std::io::stdin(),
+ std::io::stdin().is_terminal(),
+ required,
+ )
+ })?;
+ match cmd {
+ ConnectionsCmd::List { all } => {
+ let report = call(cua, &method, args).await?;
+ let rows = rows(&report, all);
+ if json {
+ line(
+ out,
+ serde_json::json!({ "connections": rows, "available": report["available"] })
+ .to_string(),
+ );
+ } else {
+ for l in list_lines(&rows, &report) {
+ line(out, l);
+ }
+ }
+ Ok(0)
+ }
+ ConnectionsCmd::Add { ref provider, .. } => {
+ let report = call(cua, &method, args).await?;
+ let row = rows(&report, true).into_iter().find(|r| &r.id == provider);
+ if json {
+ line(out, serde_json::json!({ "connection": row }).to_string());
+ } else if let Some(r) = row {
+ line(
+ out,
+ format!(
+ "{}: {}. It works with {}.",
+ r.name,
+ state_words(r.state),
+ r.works_with.join(", ")
+ ),
+ );
+ line(
+ out,
+ hint("Saved without asking the provider. Check it with: cua connections test"),
+ );
+ }
+ Ok(0)
+ }
+ ConnectionsCmd::Test { provider } => {
+ // The daemon asks each provider (six seconds at most each); the whole is bounded here.
+ let report = tokio::time::timeout(TEST_WAIT, call(cua, &method, args))
+ .await
+ .map_err(|_| {
+ CuaError::InvalidArgument(
+ "the providers did not answer in time; nothing was changed".into(),
+ )
+ })??;
+ let mut shown = rows(&report, false);
+ if let Some(p) = &provider {
+ shown.retain(|r| &r.id == p);
+ }
+ shown.retain(|r| r.state != "not_connected");
+ let bad = shown.iter().any(|r| r.state == "needs_reconnect");
+ if json {
+ line(out, serde_json::json!({ "connections": shown }).to_string());
+ } else {
+ if shown.is_empty() {
+ line(out, hint("Nothing to check: no provider is connected."));
+ }
+ for r in &shown {
+ line(out, format!("{:<22} {}", r.id, state_words(r.state)));
+ }
+ }
+ Ok(if bad { 1 } else { 0 })
+ }
+ ConnectionsCmd::Remove { provider } => {
+ let report = call(cua, &method, args).await?;
+ let def = reg::provider(&provider).expect("checked by plan");
+ let saved: BTreeSet<String> = report["keys"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter_map(|k| k["env"].as_str().map(str::to_string))
+ .collect();
+ let mine: Vec<&str> = def.envs().filter(|e| saved.contains(*e)).collect();
+ if mine.is_empty() {
+ line(out, format!("{} is not connected.", def.name));
+ return Ok(0);
+ }
+ for env in mine {
+ call(cua, "agent_keys.remove", serde_json::json!({ "env": env })).await?;
+ }
+ if json {
+ line(out, serde_json::json!({ "removed": def.id }).to_string());
+ } else {
+ line(out, format!("Disconnected {}.", def.name));
+ }
+ Ok(0)
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn cmd_add(p: &str) -> ConnectionsCmd {
+ ConnectionsCmd::Add {
+ provider: p.into(),
+ method: None,
+ region: None,
+ model: None,
+ base_url: None,
+ wire: None,
+ }
+ }
+
+ #[test]
+ fn the_key_comes_only_from_a_pipe() {
+ assert!(read_key(&mut "sk".as_bytes(), true, true).is_err());
+ assert!(read_key(&mut " \n".as_bytes(), false, true).is_err());
+ assert_eq!(
+ read_key(&mut "sk-test-0000\n".as_bytes(), false, true).unwrap(),
+ "sk-test-0000"
+ );
+ // A server that needs no key may be added from a terminal, with none.
+ assert_eq!(read_key(&mut "".as_bytes(), true, false).unwrap(), "");
+ assert_eq!(read_key(&mut "".as_bytes(), false, false).unwrap(), "");
+ }
+
+ #[test]
+ fn add_sends_a_provider_a_key_and_only_the_choices_given() {
+ let key = |_| Ok("sk-test-0000".to_string());
+ let (m, a) = plan(&cmd_add("deepseek"), key).unwrap();
+ assert_eq!(m, "agent_keys.set");
+ assert_eq!(
+ a,
+ serde_json::json!({"provider": "deepseek", "value": "sk-test-0000"})
+ );
+ let mut z = cmd_add("zai");
+ if let ConnectionsCmd::Add { region, .. } = &mut z {
+ *region = Some("coding-global".into());
+ }
+ assert_eq!(
+ plan(&z, key).unwrap().1,
+ serde_json::json!({"provider": "zai", "value": "sk-test-0000", "region": "coding-global"})
+ );
+ // A custom endpoint: URL, model and wire as fields, and no key needed.
+ let c = ConnectionsCmd::Add {
+ provider: "custom".into(),
+ method: None,
+ region: None,
+ model: Some("qwen".into()),
+ base_url: Some("http://h:1234/v1".into()),
+ wire: None,
+ };
+ let (_, a) = plan(&c, |required| {
+ assert!(!required);
+ Ok(String::new())
+ })
+ .unwrap();
+ assert_eq!(
+ a["fields"],
+ serde_json::json!({"model": "qwen", "base_url": "http://h:1234/v1", "wire": "openai-chat"})
+ );
+ assert_eq!(a["value"], "");
+ // --base-url is a custom endpoint's.
+ let mut d = cmd_add("deepseek");
+ if let ConnectionsCmd::Add { base_url, .. } = &mut d {
+ *base_url = Some("http://x".into());
+ }
+ assert!(plan(&d, key).is_err());
+ }
+
+ #[test]
+ fn unknown_hidden_and_sign_in_only_providers_are_refused_in_words() {
+ let key = |_| Ok("k".to_string());
+ let e = plan(&cmd_add("nope"), key).unwrap_err().to_string();
+ assert!(
+ e.contains("unknown provider") && e.contains("deepseek"),
+ "{e}"
+ );
+ // An unreviewed login and an unverified provider are not there to add.
+ for hidden in [
+ "nous",
+ "xai-oauth",
+ "qwen-oauth",
+ "minimax-oauth",
+ "vertex",
+ "meta-ai",
+ ] {
+ assert!(plan(&cmd_add(hidden), key).is_err(), "{hidden}");
+ }
+ let mut c = cmd_add("anthropic");
+ if let ConnectionsCmd::Add { method, .. } = &mut c {
+ *method = Some("import".into());
+ }
+ let e = plan(&c, key).unwrap_err().to_string();
+ assert!(e.contains("cua connect setup <app> --sign-in"), "{e}");
+ let mut c = cmd_add("deepseek");
+ if let ConnectionsCmd::Add { method, .. } = &mut c {
+ *method = Some("login".into());
+ }
+ assert!(
+ plan(&c, key)
+ .unwrap_err()
+ .to_string()
+ .contains("can be connected with: key")
+ );
+ }
+
+ #[test]
+ fn list_says_the_state_in_the_apps_words_and_never_a_key() {
+ let report = serde_json::json!({"available": true, "keys": [
+ {"provider": "deepseek", "env": "DEEPSEEK_API_KEY", "last4": "9c2e", "added_ms": 1},
+ {"provider": "openai", "env": "OPENAI_API_KEY", "last4": "9z9z", "added_ms": 1, "expired": true},
+ {"provider": "zai", "env": "GLM_API_KEY", "last4": "7d1f", "added_ms": 1, "region": "coding-global"},
+ {"provider": "anthropic", "env": "CLAUDE_CODE_OAUTH_TOKEN", "last4": "", "added_ms": 1}
+ ]});
+ let r = rows(&report, false);
+ let state = |id: &str| r.iter().find(|x| x.id == id).map(|x| x.state);
+ assert_eq!(state("deepseek"), Some("connected"));
+ assert_eq!(state("openai"), Some("needs_reconnect"));
+ assert_eq!(state("anthropic"), Some("connected"));
+ assert_eq!(state("kimi"), Some("not_connected"));
+ // More providers appear when something is saved, or with --all.
+ assert_eq!(state("zai"), Some("connected"));
+ assert_eq!(state("fireworks"), None);
+ assert!(rows(&report, true).iter().any(|x| x.id == "fireworks"));
+ let text = list_lines(&r, &report).join("\n");
+ assert!(
+ text.contains("Needs reconnect")
+ && text.contains("Connected")
+ && text.contains("Not connected"),
+ "{text}"
+ );
+ assert!(text.contains("Global, Coding Plan"), "{text}");
+ assert!(text.contains("sign-in found on this machine"), "{text}");
+ for leak in ["9c2e", "9z9z", "7d1f", "sk-"] {
+ assert!(!text.contains(leak), "{leak} in {text}");
+ }
+ // Says machines, never devices, and no dot separators.
+ assert!(!text.to_lowercase().contains("device") && !text.contains('\u{b7}'));
+ // Hermes works with the DeepSeek key; Claude Code does not.
+ let ds = r.iter().find(|x| x.id == "deepseek").unwrap();
+ assert!(
+ ds.works_with.contains(&"Hermes".to_string())
+ && !ds.works_with.contains(&"Claude Code".to_string())
+ );
+ }
+}
diff --git a/libs/cua/crates/cua-cli/src/lib.rs b/libs/cua/crates/cua-cli/src/lib.rs
index 68ea5935c3..403f7bdf0f 100644
--- a/libs/cua/crates/cua-cli/src/lib.rs
+++ b/libs/cua/crates/cua-cli/src/lib.rs
@@ -39,6 +39,7 @@ mod cloud_cmd;
mod compat_cmd;
mod computer;
mod config_cmd;
+mod connections_cmd;
mod devices_cmd;
mod do_cmd;
mod doctor;
@@ -370,6 +371,18 @@ enum Command {
#[arg(long, hide = true)]
relay: Option<String>,
},
+ /// The AI providers connected once for every app that can use them: list,
+ /// add (a key from stdin), test, remove. What Cua Spaces shows in
+ /// Settings, Connections. (`cua connect` connects your coding apps to Cua.)
+ #[command(
+ subcommand,
+ after_help = "Examples:
+ cua connections list
+ cua connections add deepseek
+ cua connections test
+ cua connections remove deepseek"
+ )]
+ Connections(connections_cmd::ConnectionsCmd),
/// Move a desktop app session (tabs, profile, sign-in) into a sandbox.
#[command(subcommand)]
Teleport(teleport::TeleportCmd),
@@ -1914,6 +1927,7 @@ async fn run_sdk(cli: Cli, out: &mut dyn Write) -> Result<i32, CuaError> {
cli.command,
Command::Sandbox(_)
| Command::Agent(_)
+ | Command::Connections(_)
| Command::Do(_)
| Command::DoHostConsent
| Command::Mcp { .. }
@@ -1955,6 +1969,7 @@ async fn run_sdk(cli: Cli, out: &mut dyn Write) -> Result<i32, CuaError> {
return extension::viewer(cua.clone(), &listen, no_open, out).await;
}
Command::Agent(cmd) => return agent_cmd::run(&cua, cmd, json, out).await,
+ Command::Connections(cmd) => return connections_cmd::run(&cua, cmd, json, out).await,
Command::Volume(cmd) => return drive_cmd::run(&cua, cmd, json, out).await,
Command::Teleport(cmd @ teleport::TeleportCmd::Push(_)) => {
return extension::teleport(Some(&cua), cmd, json, out).await;
diff --git a/libs/cua/crates/cua-cli/tests/fixtures/help/agent.txt b/libs/cua/crates/cua-cli/tests/fixtures/help/agent.txt
index c7982805e8..06328f22b9 100644
--- a/libs/cua/crates/cua-cli/tests/fixtures/help/agent.txt
+++ b/libs/cua/crates/cua-cli/tests/fixtures/help/agent.txt
@@ -16,7 +16,7 @@ Commands:
schedule A named agent's schedules: turns the daemon starts with or without the app open
sessions Durable sessions: agents your machines keep alive (`run --durable`)
harnesses The harnesses: readiness, installs, key variables, limits
- keys The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connectors). Values are read from stdin and never printed
+ keys The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connections). Values are read from stdin and never printed
create Deprecated alias of `add`. Creates a named agent whose memory lives in the Cua Volume (agents/NAME/) and outlives its Space
persistent Deprecated alias of `ls` (without a sandbox). Lists named agents
tell Deprecated alias of `send NAME TEXT`. Gives a named agent a turn (starts a run with its home restored, or follows up on its idle run)
diff --git a/libs/cua/crates/cua-connections/Cargo.toml b/libs/cua/crates/cua-connections/Cargo.toml
new file mode 100644
index 0000000000..e6baf5fb25
--- /dev/null
+++ b/libs/cua/crates/cua-connections/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "cua-connections"
+description = "The provider registry behind Settings, Connections and `cua connections`: one TOML file per provider (methods, base URLs, env names, which apps receive what), the generated tables the other crates read, the per-app delivery rules and Hermes's generated config.yaml."
+version.workspace = true
+edition.workspace = true
+rust-version.workspace = true
+authors.workspace = true
+license.workspace = true
+repository.workspace = true
+
+[dependencies]
+# Reads the provider files (the generator and its tests); the generated tables
+# the other crates link need none of it.
+serde = { workspace = true }
+serde_json = { workspace = true }
+toml = "1"
+
+[[bin]]
+name = "cua-connections-gen"
+path = "src/bin/gen.rs"
diff --git a/libs/cua/crates/cua-connections/generated/providers.json b/libs/cua/crates/cua-connections/generated/providers.json
new file mode 100644
index 0000000000..20e02d8dc6
--- /dev/null
+++ b/libs/cua/crates/cua-connections/generated/providers.json
@@ -0,0 +1,1193 @@
+{
+ "harnesses": [
+ "claude-code",
+ "openai-codex",
+ "gemini-cli",
+ "google-antigravity",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes",
+ "openclaw"
+ ],
+ "methodKinds": [
+ "api_key",
+ "import_login",
+ "device_code",
+ "browser_oauth",
+ "subscription_login",
+ "adc",
+ "local_server",
+ "custom_endpoint"
+ ],
+ "providers": [
+ {
+ "aliases": [],
+ "alsoWires": [],
+ "delivery": {
+ "claude-code": [
+ "ANTHROPIC_API_KEY",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "ANTHROPIC_AUTH_TOKEN"
+ ],
+ "goose": [
+ "ANTHROPIC_API_KEY"
+ ],
+ "hermes": [
+ "ANTHROPIC_API_KEY"
+ ],
+ "openclaw": [
+ "ANTHROPIC_API_KEY"
+ ],
+ "opencode": [
+ "ANTHROPIC_API_KEY"
+ ],
+ "pi": [
+ "ANTHROPIC_API_KEY"
+ ]
+ },
+ "hermesId": "anthropic",
+ "hidden": false,
+ "icon": "anthropic",
+ "id": "anthropic",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "claude-login",
+ "kind": "import_login",
+ "scope": "claude-code"
+ },
+ {
+ "id": "claude-token",
+ "kind": "import_login",
+ "scope": "claude-code"
+ },
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Anthropic",
+ "rank": 10,
+ "regions": [],
+ "tier": "top",
+ "wire": "anthropic"
+ },
+ {
+ "aliases": [],
+ "alsoWires": [
+ "openai-chat"
+ ],
+ "delivery": {
+ "goose": [
+ "OPENAI_API_KEY"
+ ],
+ "hermes": [
+ "OPENAI_API_KEY"
+ ],
+ "openai-codex": [
+ "OPENAI_API_KEY",
+ "CODEX_API_KEY",
+ "CODEX_AUTH_JSON"
+ ],
+ "openclaw": [
+ "OPENAI_API_KEY"
+ ],
+ "opencode": [
+ "OPENAI_API_KEY"
+ ],
+ "pi": [
+ "OPENAI_API_KEY"
+ ]
+ },
+ "hermesId": "openai-api",
+ "hidden": false,
+ "icon": "openai",
+ "id": "openai",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "chatgpt-login",
+ "kind": "subscription_login",
+ "scope": "openai-codex"
+ },
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "OpenAI",
+ "rank": 20,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-responses"
+ },
+ {
+ "aliases": [],
+ "alsoWires": [],
+ "delivery": {
+ "goose": [
+ "OPENROUTER_API_KEY"
+ ],
+ "hermes": [
+ "OPENROUTER_API_KEY"
+ ],
+ "openclaw": [
+ "OPENROUTER_API_KEY"
+ ],
+ "opencode": [
+ "OPENROUTER_API_KEY"
+ ],
+ "pi": [
+ "OPENROUTER_API_KEY"
+ ]
+ },
+ "hermesId": "openrouter",
+ "hidden": false,
+ "icon": "openrouter",
+ "id": "openrouter",
+ "kind": "aggregator",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "OpenRouter",
+ "rank": 30,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "gemini",
+ "google ai",
+ "aistudio"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "gemini-cli": [
+ "GEMINI_API_KEY",
+ "GOOGLE_API_KEY"
+ ],
+ "google-antigravity": [
+ "GEMINI_API_KEY"
+ ],
+ "goose": [
+ "GOOGLE_API_KEY",
+ "GOOGLE_API_KEY<-GEMINI_API_KEY"
+ ],
+ "hermes": [
+ "GEMINI_API_KEY"
+ ],
+ "opencode": [
+ "GEMINI_API_KEY"
+ ],
+ "pi": [
+ "GEMINI_API_KEY"
+ ]
+ },
+ "hermesId": "gemini",
+ "hidden": false,
+ "icon": "google",
+ "id": "google",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Google AI Studio",
+ "rank": 40,
+ "regions": [],
+ "tier": "top",
+ "wire": "gemini"
+ },
+ {
+ "aliases": [
+ "grok"
+ ],
+ "alsoWires": [
+ "openai-chat"
+ ],
+ "delivery": {
+ "hermes": [
+ "XAI_API_KEY"
+ ]
+ },
+ "hermesId": "xai",
+ "hidden": false,
+ "icon": "xai",
+ "id": "xai",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "xAI",
+ "rank": 50,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-responses"
+ },
+ {
+ "aliases": [],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "DEEPSEEK_API_KEY"
+ ]
+ },
+ "hermesId": "deepseek",
+ "hidden": false,
+ "icon": "deepseek",
+ "id": "deepseek",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "DeepSeek",
+ "rank": 60,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "moonshot",
+ "kimi code"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "KIMI_API_KEY"
+ ]
+ },
+ "hermesId": "kimi-coding",
+ "hidden": false,
+ "icon": "kimi",
+ "id": "kimi",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Kimi (Moonshot)",
+ "rank": 70,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "copilot",
+ "github copilot cli"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "",
+ "hidden": false,
+ "icon": "github",
+ "id": "github",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "GitHub Copilot",
+ "rank": 80,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "hf"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "HF_TOKEN"
+ ]
+ },
+ "hermesId": "huggingface",
+ "hidden": false,
+ "icon": "huggingface",
+ "id": "huggingface",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Hugging Face",
+ "rank": 100,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "glm",
+ "zhipu",
+ "z.ai"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "GLM_API_KEY"
+ ]
+ },
+ "hermesId": "zai",
+ "hidden": false,
+ "icon": "zai",
+ "id": "zai",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Z.AI (GLM)",
+ "rank": 110,
+ "regions": [
+ "global",
+ "cn",
+ "coding-global",
+ "coding-cn"
+ ],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "fw"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "FIREWORKS_API_KEY"
+ ]
+ },
+ "hermesId": "fireworks",
+ "hidden": false,
+ "icon": "fireworks",
+ "id": "fireworks",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Fireworks AI",
+ "rank": 120,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "nim",
+ "nemotron",
+ "build.nvidia.com"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "NVIDIA_API_KEY"
+ ]
+ },
+ "hermesId": "nvidia",
+ "hidden": false,
+ "icon": "nvidia",
+ "id": "nvidia",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "NVIDIA NIM",
+ "rank": 130,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "ollama"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "OLLAMA_API_KEY"
+ ]
+ },
+ "hermesId": "ollama-cloud",
+ "hidden": false,
+ "icon": "ollama-cloud",
+ "id": "ollama-cloud",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Ollama Cloud",
+ "rank": 140,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "deep infra"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "DEEPINFRA_API_KEY"
+ ]
+ },
+ "hermesId": "deepinfra",
+ "hidden": false,
+ "icon": "deepinfra",
+ "id": "deepinfra",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "DeepInfra",
+ "rank": 150,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "novitaai"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "NOVITA_API_KEY"
+ ]
+ },
+ "hermesId": "novita",
+ "hidden": false,
+ "icon": "novita",
+ "id": "novita",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Novita AI",
+ "rank": 160,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "nebius"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "NEBIUS_API_KEY"
+ ]
+ },
+ "hermesId": "nebius-token-factory",
+ "hidden": false,
+ "icon": "nebius-token-factory",
+ "id": "nebius-token-factory",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Nebius Token Factory",
+ "rank": 170,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "gmicloud"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "GMI_API_KEY"
+ ]
+ },
+ "hermesId": "gmi",
+ "hidden": false,
+ "icon": "gmi",
+ "id": "gmi",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "GMI Cloud",
+ "rank": 180,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "solar"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "UPSTAGE_API_KEY"
+ ]
+ },
+ "hermesId": "upstage",
+ "hidden": false,
+ "icon": "upstage",
+ "id": "upstage",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Upstage Solar",
+ "rank": 190,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "trinity"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "ARCEEAI_API_KEY"
+ ]
+ },
+ "hermesId": "arcee",
+ "hidden": false,
+ "icon": "arcee",
+ "id": "arcee",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Arcee AI",
+ "rank": 200,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "vercel"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "AI_GATEWAY_API_KEY"
+ ]
+ },
+ "hermesId": "ai-gateway",
+ "hidden": false,
+ "icon": "ai-gateway",
+ "id": "ai-gateway",
+ "kind": "aggregator",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Vercel AI Gateway",
+ "rank": 210,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "zen"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "OPENCODE_ZEN_API_KEY"
+ ]
+ },
+ "hermesId": "opencode-zen",
+ "hidden": false,
+ "icon": "opencode-zen",
+ "id": "opencode-zen",
+ "kind": "aggregator",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "OpenCode Zen",
+ "rank": 220,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "go"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "OPENCODE_GO_API_KEY"
+ ]
+ },
+ "hermesId": "opencode-go",
+ "hidden": false,
+ "icon": "opencode-go",
+ "id": "opencode-go",
+ "kind": "aggregator",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "OpenCode Go",
+ "rank": 230,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "kilo"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "KILOCODE_API_KEY"
+ ]
+ },
+ "hermesId": "kilocode",
+ "hidden": false,
+ "icon": "kilocode",
+ "id": "kilocode",
+ "kind": "aggregator",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Kilo Code",
+ "rank": 240,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "mimo"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "XIAOMI_API_KEY"
+ ]
+ },
+ "hermesId": "xiaomi",
+ "hidden": false,
+ "icon": "xiaomi",
+ "id": "xiaomi",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Xiaomi MiMo",
+ "rank": 250,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "step"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "STEPFUN_API_KEY"
+ ]
+ },
+ "hermesId": "stepfun",
+ "hidden": false,
+ "icon": "stepfun",
+ "id": "stepfun",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "StepFun",
+ "rank": 260,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "mini-max"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "MINIMAX_API_KEY"
+ ]
+ },
+ "hermesId": "minimax",
+ "hidden": false,
+ "icon": "minimax",
+ "id": "minimax",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "MiniMax",
+ "rank": 270,
+ "regions": [],
+ "tier": "more",
+ "wire": "anthropic"
+ },
+ {
+ "aliases": [
+ "qwen",
+ "dashscope",
+ "alibaba cloud"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "DASHSCOPE_API_KEY"
+ ]
+ },
+ "hermesId": "alibaba",
+ "hidden": false,
+ "icon": "alibaba",
+ "id": "alibaba",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Qwen Cloud (Alibaba)",
+ "rank": 280,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "meta",
+ "muse"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "MODEL_API_KEY"
+ ]
+ },
+ "hermesId": "meta-ai",
+ "hidden": true,
+ "icon": "meta-ai",
+ "id": "meta-ai",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Meta Model API",
+ "rank": 290,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-responses"
+ },
+ {
+ "aliases": [
+ "ramp"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "RAMP_ROUTER_API_KEY"
+ ]
+ },
+ "hermesId": "router",
+ "hidden": true,
+ "icon": "router",
+ "id": "router",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Ramp Router",
+ "rank": 300,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-responses"
+ },
+ {
+ "aliases": [],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "COMMANDCODE_API_KEY"
+ ]
+ },
+ "hermesId": "commandcode",
+ "hidden": true,
+ "icon": "commandcode",
+ "id": "commandcode",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "CommandCode",
+ "rank": 310,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "aci"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "ACTUAL_API_KEY"
+ ]
+ },
+ "hermesId": "actual",
+ "hidden": true,
+ "icon": "actual",
+ "id": "actual",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Actual Computer",
+ "rank": 320,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "tencent",
+ "hunyuan"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "TOKENHUB_API_KEY"
+ ]
+ },
+ "hermesId": "tencent-tokenhub",
+ "hidden": true,
+ "icon": "tencent-tokenhub",
+ "id": "tencent-tokenhub",
+ "kind": "hosted",
+ "methods": [
+ {
+ "id": "key",
+ "kind": "api_key",
+ "scope": ""
+ }
+ ],
+ "name": "Tencent TokenHub",
+ "rank": 330,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "nous research",
+ "hermes"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "nous",
+ "hidden": true,
+ "icon": "nous",
+ "id": "nous",
+ "kind": "aggregator",
+ "methods": [],
+ "name": "Nous Portal",
+ "rank": 340,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "qwen cli",
+ "qwen code"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "qwen-oauth",
+ "hidden": true,
+ "icon": "qwen",
+ "id": "qwen-oauth",
+ "kind": "hosted",
+ "methods": [],
+ "name": "Qwen CLI sign-in",
+ "rank": 350,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "minimax coding plan"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "minimax-oauth",
+ "hidden": true,
+ "icon": "minimax",
+ "id": "minimax-oauth",
+ "kind": "hosted",
+ "methods": [],
+ "name": "MiniMax sign-in",
+ "rank": 360,
+ "regions": [],
+ "tier": "more",
+ "wire": "anthropic"
+ },
+ {
+ "aliases": [
+ "supergrok",
+ "grok subscription"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "xai-oauth",
+ "hidden": true,
+ "icon": "xai",
+ "id": "xai-oauth",
+ "kind": "hosted",
+ "methods": [],
+ "name": "SuperGrok sign-in",
+ "rank": 370,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-responses"
+ },
+ {
+ "aliases": [
+ "gcp",
+ "google cloud"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "vertex",
+ "hidden": true,
+ "icon": "google",
+ "id": "vertex",
+ "kind": "cloud",
+ "methods": [
+ {
+ "id": "adc",
+ "kind": "adc",
+ "scope": ""
+ }
+ ],
+ "name": "Google Vertex AI",
+ "rank": 380,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "aws",
+ "amazon"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "bedrock",
+ "hidden": true,
+ "icon": "aws",
+ "id": "bedrock",
+ "kind": "cloud",
+ "methods": [
+ {
+ "id": "adc",
+ "kind": "adc",
+ "scope": ""
+ }
+ ],
+ "name": "Amazon Bedrock",
+ "rank": 390,
+ "regions": [],
+ "tier": "more",
+ "wire": "bedrock"
+ },
+ {
+ "aliases": [
+ "azure",
+ "azure openai",
+ "microsoft"
+ ],
+ "alsoWires": [],
+ "delivery": {},
+ "hermesId": "azure-foundry",
+ "hidden": true,
+ "icon": "azure",
+ "id": "azure-foundry",
+ "kind": "cloud",
+ "methods": [
+ {
+ "id": "adc",
+ "kind": "adc",
+ "scope": ""
+ }
+ ],
+ "name": "Azure AI Foundry",
+ "rank": 400,
+ "regions": [],
+ "tier": "more",
+ "wire": "openai-chat"
+ },
+ {
+ "aliases": [
+ "openai compatible",
+ "lm studio",
+ "ollama",
+ "vllm",
+ "llama.cpp",
+ "litellm",
+ "local server",
+ "gateway",
+ "proxy"
+ ],
+ "alsoWires": [],
+ "delivery": {
+ "hermes": [
+ "CUSTOM_ENDPOINT_API_KEY"
+ ]
+ },
+ "hermesId": "custom",
+ "hidden": false,
+ "icon": "custom",
+ "id": "custom",
+ "kind": "custom",
+ "methods": [
+ {
+ "id": "endpoint",
+ "kind": "custom_endpoint",
+ "scope": ""
+ }
+ ],
+ "name": "Custom endpoint",
+ "rank": 900,
+ "regions": [],
+ "tier": "top",
+ "wire": "openai-chat"
+ }
+ ]
+}
diff --git a/libs/cua/crates/cua-connections/hermes-pin.json b/libs/cua/crates/cua-connections/hermes-pin.json
new file mode 100644
index 0000000000..d34c381a11
--- /dev/null
+++ b/libs/cua/crates/cua-connections/hermes-pin.json
@@ -0,0 +1,652 @@
+{
+ "commit": "d337b736aa1e8ebecfab043842d13e4a2d2f48a3",
+ "providers": {
+ "actual": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.actual.inc/v1",
+ "base_url_env": "ACTUAL_BASE_URL",
+ "default_model": "",
+ "env": [
+ "ACTUAL_API_KEY"
+ ],
+ "models": []
+ },
+ "ai-gateway": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://ai-gateway.vercel.sh/v1",
+ "base_url_env": "AI_GATEWAY_BASE_URL",
+ "default_model": "",
+ "env": [
+ "AI_GATEWAY_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
+ "base_url_env": "DASHSCOPE_BASE_URL",
+ "default_model": "",
+ "env": [
+ "DASHSCOPE_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba-cn": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
+ "base_url_env": "DASHSCOPE_CN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "DASHSCOPE_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba-coding-plan": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://coding-intl.dashscope.aliyuncs.com/v1",
+ "base_url_env": "ALIBABA_CODING_PLAN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "ALIBABA_CODING_PLAN_API_KEY",
+ "DASHSCOPE_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba-coding-plan-cn": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://coding.dashscope.aliyuncs.com/v1",
+ "base_url_env": "ALIBABA_CODING_PLAN_CN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "ALIBABA_CODING_PLAN_CN_API_KEY",
+ "ALIBABA_CODING_PLAN_API_KEY",
+ "DASHSCOPE_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba-token-plan": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
+ "base_url_env": "ALIBABA_TOKEN_PLAN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "ALIBABA_TOKEN_PLAN_API_KEY"
+ ],
+ "models": []
+ },
+ "alibaba-token-plan-cn": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
+ "base_url_env": "ALIBABA_TOKEN_PLAN_CN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "ALIBABA_TOKEN_PLAN_CN_API_KEY",
+ "ALIBABA_TOKEN_PLAN_API_KEY"
+ ],
+ "models": []
+ },
+ "anthropic": {
+ "api_mode": "anthropic_messages",
+ "auth": "api_key",
+ "base_url": "https://api.anthropic.com",
+ "base_url_env": "ANTHROPIC_BASE_URL",
+ "default_model": "claude-fable-5.1",
+ "env": [
+ "ANTHROPIC_API_KEY",
+ "ANTHROPIC_TOKEN",
+ "CLAUDE_CODE_OAUTH_TOKEN"
+ ],
+ "models": []
+ },
+ "arcee": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.arcee.ai/api/v1",
+ "base_url_env": "ARCEE_BASE_URL",
+ "default_model": "trinity-large-thinking",
+ "env": [
+ "ARCEEAI_API_KEY"
+ ],
+ "models": []
+ },
+ "azure-foundry": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "",
+ "base_url_env": "AZURE_FOUNDRY_BASE_URL",
+ "default_model": "",
+ "env": [
+ "AZURE_FOUNDRY_API_KEY"
+ ],
+ "models": []
+ },
+ "bedrock": {
+ "api_mode": "bedrock_converse",
+ "auth": "aws_sdk",
+ "base_url": "https://bedrock-runtime.us-east-1.amazonaws.com",
+ "base_url_env": "BEDROCK_BASE_URL",
+ "default_model": "us.anthropic.claude-sonnet-5",
+ "env": [],
+ "models": []
+ },
+ "commandcode": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.commandcode.ai/provider/v1",
+ "base_url_env": "COMMANDCODE_BASE_URL",
+ "default_model": "deepseek/deepseek-v4-pro",
+ "env": [
+ "COMMANDCODE_API_KEY"
+ ],
+ "models": [
+ "deepseek/deepseek-v4-pro",
+ "deepseek/deepseek-v4-flash",
+ "Qwen/Qwen3.7-Max",
+ "Qwen/Qwen3.6-Plus",
+ "moonshotai/Kimi-K2.6",
+ "zai-org/GLM-5.1",
+ "MiniMaxAI/MiniMax-M2.7",
+ "stepfun/Step-3.5-Flash",
+ "xiaomi/mimo-v2.5-pro",
+ "google/gemini-3.5-flash",
+ "gpt-5.5"
+ ]
+ },
+ "commandcode-anthropic": {
+ "api_mode": "anthropic_messages",
+ "auth": "api_key",
+ "base_url": "https://api.commandcode.ai/provider/v1",
+ "base_url_env": "COMMANDCODE_ANTHROPIC_BASE_URL",
+ "default_model": "claude-sonnet-4-6",
+ "env": [
+ "COMMANDCODE_API_KEY"
+ ],
+ "models": [
+ "claude-sonnet-4-6",
+ "claude-opus-4-7",
+ "claude-haiku-4-5-20251001"
+ ]
+ },
+ "copilot": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.githubcopilot.com",
+ "base_url_env": "COPILOT_API_BASE_URL",
+ "default_model": "",
+ "env": [
+ "COPILOT_GITHUB_TOKEN",
+ "GH_TOKEN",
+ "GITHUB_TOKEN"
+ ],
+ "models": []
+ },
+ "copilot-acp": {
+ "api_mode": "chat_completions",
+ "auth": "external_process",
+ "base_url": "acp://copilot",
+ "base_url_env": "COPILOT_ACP_BASE_URL",
+ "default_model": "copilot-acp",
+ "env": [],
+ "models": []
+ },
+ "custom": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "",
+ "base_url_env": "",
+ "default_model": "",
+ "env": [],
+ "models": []
+ },
+ "deepinfra": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.deepinfra.com/v1/openai",
+ "base_url_env": "DEEPINFRA_BASE_URL",
+ "default_model": "",
+ "env": [
+ "DEEPINFRA_API_KEY"
+ ],
+ "models": []
+ },
+ "deepseek": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.deepseek.com/v1",
+ "base_url_env": "DEEPSEEK_BASE_URL",
+ "default_model": "deepseek-flash",
+ "env": [
+ "DEEPSEEK_API_KEY"
+ ],
+ "models": [
+ "deepseek-v4-pro",
+ "deepseek-flash"
+ ]
+ },
+ "fireworks": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.fireworks.ai/inference/v1",
+ "base_url_env": "",
+ "default_model": "accounts/fireworks/models/kimi-k2p6",
+ "env": [
+ "FIREWORKS_API_KEY"
+ ],
+ "models": [
+ "accounts/fireworks/models/kimi-k2p6",
+ "accounts/fireworks/models/glm-5p2",
+ "accounts/fireworks/models/kimi-k2p7-code"
+ ]
+ },
+ "gemini": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://generativelanguage.googleapis.com/v1beta",
+ "base_url_env": "GEMINI_BASE_URL",
+ "default_model": "gemini-3.8-flash",
+ "env": [
+ "GOOGLE_API_KEY",
+ "GEMINI_API_KEY"
+ ],
+ "models": []
+ },
+ "gmi": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.gmi-serving.com/v1",
+ "base_url_env": "GMI_BASE_URL",
+ "default_model": "zai-org/GLM-5.1-FP8",
+ "env": [
+ "GMI_API_KEY"
+ ],
+ "models": [
+ "zai-org/GLM-5.1-FP8",
+ "deepseek-ai/DeepSeek-V3.2",
+ "moonshotai/Kimi-K2.5",
+ "google/gemini-3.1-flash-lite-preview",
+ "anthropic/claude-sonnet-5",
+ "anthropic/claude-sonnet-4.6",
+ "openai/gpt-5.4"
+ ]
+ },
+ "huggingface": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://router.huggingface.co/v1",
+ "base_url_env": "HF_BASE_URL",
+ "default_model": "moonshotai/Kimi-K2.5",
+ "env": [
+ "HF_TOKEN"
+ ],
+ "models": [
+ "Qwen/Qwen3.5-72B-Instruct",
+ "deepseek-ai/DeepSeek-V3.2"
+ ]
+ },
+ "kilocode": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.kilo.ai/api/gateway",
+ "base_url_env": "KILOCODE_BASE_URL",
+ "default_model": "anthropic/claude-opus-4.6",
+ "env": [
+ "KILOCODE_API_KEY"
+ ],
+ "models": []
+ },
+ "kimi-coding": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.moonshot.ai/v1",
+ "base_url_env": "KIMI_BASE_URL",
+ "default_model": "kimi-k3",
+ "env": [
+ "KIMI_API_KEY",
+ "KIMI_CODING_API_KEY"
+ ],
+ "models": []
+ },
+ "kimi-coding-cn": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.moonshot.cn/v1",
+ "base_url_env": "",
+ "default_model": "kimi-k3",
+ "env": [
+ "KIMI_CN_API_KEY"
+ ],
+ "models": []
+ },
+ "lmstudio": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "http://127.0.0.1:1234/v1",
+ "base_url_env": "LM_BASE_URL",
+ "default_model": "",
+ "env": [
+ "LM_API_KEY"
+ ],
+ "models": []
+ },
+ "meta-ai": {
+ "api_mode": "codex_responses",
+ "auth": "api_key",
+ "base_url": "",
+ "base_url_env": "META_BASE_URL",
+ "default_model": "muse-spark-1.2",
+ "env": [
+ "MODEL_API_KEY",
+ "META_API_KEY",
+ "META_MODEL_API_KEY"
+ ],
+ "models": [
+ "muse-spark-1.2"
+ ]
+ },
+ "minimax": {
+ "api_mode": "anthropic_messages",
+ "auth": "api_key",
+ "base_url": "https://api.minimax.io/anthropic",
+ "base_url_env": "MINIMAX_BASE_URL",
+ "default_model": "",
+ "env": [
+ "MINIMAX_API_KEY"
+ ],
+ "models": []
+ },
+ "minimax-cn": {
+ "api_mode": "anthropic_messages",
+ "auth": "api_key",
+ "base_url": "https://api.minimaxi.com/anthropic",
+ "base_url_env": "MINIMAX_CN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "MINIMAX_CN_API_KEY"
+ ],
+ "models": []
+ },
+ "minimax-oauth": {
+ "api_mode": "anthropic_messages",
+ "auth": "oauth_minimax",
+ "base_url": "https://api.minimax.io/anthropic",
+ "base_url_env": "",
+ "default_model": "MiniMax-M3",
+ "env": [],
+ "models": []
+ },
+ "nebius-token-factory": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.tokenfactory.nebius.com/v1",
+ "base_url_env": "NEBIUS_BASE_URL",
+ "default_model": "Qwen/Qwen3.5-397B-A17B-fast",
+ "env": [
+ "NEBIUS_API_KEY",
+ "NEBIUS_TOKEN_FACTORY_API_KEY"
+ ],
+ "models": [
+ "Qwen/Qwen3.5-397B-A17B-fast",
+ "deepseek-ai/DeepSeek-V4-Pro",
+ "zai-org/GLM-5.1",
+ "moonshotai/Kimi-K2.5-fast",
+ "MiniMaxAI/MiniMax-M2.5-fast",
+ "deepseek-ai/DeepSeek-V3.2-fast",
+ "NousResearch/Hermes-4-70B",
+ "openai/gpt-oss-120b-fast",
+ "meta-llama/Llama-3.3-70B-Instruct"
+ ]
+ },
+ "nous": {
+ "api_mode": "chat_completions",
+ "auth": "oauth_device_code",
+ "base_url": "https://inference-api.nousresearch.com/v1",
+ "base_url_env": "",
+ "default_model": "x-ai/grok-4.7",
+ "env": [
+ "NOUS_API_KEY"
+ ],
+ "models": [
+ "hermes-3-405b",
+ "hermes-3-70b"
+ ]
+ },
+ "novita": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.novita.ai/openai/v1",
+ "base_url_env": "NOVITA_BASE_URL",
+ "default_model": "moonshotai/kimi-k2.5",
+ "env": [
+ "NOVITA_API_KEY"
+ ],
+ "models": [
+ "moonshotai/kimi-k2.5",
+ "minimax/minimax-m2.7",
+ "zai-org/glm-5",
+ "deepseek/deepseek-v3-0324",
+ "deepseek/deepseek-r1-0528",
+ "qwen/qwen3-235b-a22b-fp8"
+ ]
+ },
+ "nvidia": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://integrate.api.nvidia.com/v1",
+ "base_url_env": "NVIDIA_BASE_URL",
+ "default_model": "nvidia/nemotron-3-ultra-550b-a55b",
+ "env": [
+ "NVIDIA_API_KEY"
+ ],
+ "models": [
+ "nvidia/llama-3.1-nemotron-70b-instruct",
+ "nvidia/llama-3.3-70b-instruct"
+ ]
+ },
+ "ollama-cloud": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://ollama.com/v1",
+ "base_url_env": "OLLAMA_BASE_URL",
+ "default_model": "",
+ "env": [
+ "OLLAMA_API_KEY"
+ ],
+ "models": []
+ },
+ "openai-api": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.openai.com/v1",
+ "base_url_env": "OPENAI_BASE_URL",
+ "default_model": "gpt-5.6-sol",
+ "env": [
+ "OPENAI_API_KEY"
+ ],
+ "models": []
+ },
+ "openai-codex": {
+ "api_mode": "codex_responses",
+ "auth": "oauth_external",
+ "base_url": "https://chatgpt.com/backend-api/codex",
+ "base_url_env": "",
+ "default_model": "",
+ "env": [],
+ "models": []
+ },
+ "opencode-go": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://opencode.ai/zen/go/v1",
+ "base_url_env": "OPENCODE_GO_BASE_URL",
+ "default_model": "kimi-k3",
+ "env": [
+ "OPENCODE_GO_API_KEY"
+ ],
+ "models": []
+ },
+ "opencode-zen": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://opencode.ai/zen/v1",
+ "base_url_env": "OPENCODE_ZEN_BASE_URL",
+ "default_model": "x-preview-f-free",
+ "env": [
+ "OPENCODE_ZEN_API_KEY"
+ ],
+ "models": []
+ },
+ "openrouter": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://openrouter.ai/api/v1",
+ "base_url_env": "",
+ "default_model": "anthropic/claude-fable-5.1",
+ "env": [
+ "OPENROUTER_API_KEY"
+ ],
+ "models": [
+ "anthropic/claude-sonnet-4.6",
+ "openai/gpt-5.4",
+ "deepseek/deepseek-chat",
+ "google/gemini-3.8-flash",
+ "google/gemini-3.7-flash",
+ "qwen/qwen3-plus"
+ ]
+ },
+ "qwen-oauth": {
+ "api_mode": "chat_completions",
+ "auth": "oauth_external",
+ "base_url": "https://portal.qwen.ai/v1",
+ "base_url_env": "",
+ "default_model": "",
+ "env": [
+ "QWEN_API_KEY"
+ ],
+ "models": []
+ },
+ "router": {
+ "api_mode": "codex_responses",
+ "auth": "api_key",
+ "base_url": "",
+ "base_url_env": "RAMP_ROUTER_BASE_URL",
+ "default_model": "",
+ "env": [
+ "RAMP_ROUTER_API_KEY",
+ "ROUTER_API_KEY"
+ ],
+ "models": []
+ },
+ "stepfun": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.stepfun.ai/step_plan/v1",
+ "base_url_env": "STEPFUN_BASE_URL",
+ "default_model": "step-3.5-flash",
+ "env": [
+ "STEPFUN_API_KEY"
+ ],
+ "models": []
+ },
+ "tencent-tokenhub": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://tokenhub.tencentmaas.com/v1",
+ "base_url_env": "TOKENHUB_BASE_URL",
+ "default_model": "",
+ "env": [
+ "TOKENHUB_API_KEY"
+ ],
+ "models": []
+ },
+ "tencent-tokenplan": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.lkeap.cloud.tencent.com/plan/anthropic",
+ "base_url_env": "TOKENPLAN_BASE_URL",
+ "default_model": "",
+ "env": [
+ "TOKENPLAN_API_KEY"
+ ],
+ "models": []
+ },
+ "upstage": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.upstage.ai/v1",
+ "base_url_env": "UPSTAGE_BASE_URL",
+ "default_model": "solar-pro3",
+ "env": [
+ "UPSTAGE_API_KEY"
+ ],
+ "models": [
+ "solar-pro3"
+ ]
+ },
+ "vertex": {
+ "api_mode": "chat_completions",
+ "auth": "vertex",
+ "base_url": "https://aiplatform.googleapis.com",
+ "base_url_env": "",
+ "default_model": "google/gemini-3.8-flash",
+ "env": [],
+ "models": []
+ },
+ "xai": {
+ "api_mode": "codex_responses",
+ "auth": "api_key",
+ "base_url": "https://api.x.ai/v1",
+ "base_url_env": "XAI_BASE_URL",
+ "default_model": "",
+ "env": [
+ "XAI_API_KEY"
+ ],
+ "models": []
+ },
+ "xai-oauth": {
+ "api_mode": "chat_completions",
+ "auth": "oauth_external",
+ "base_url": "https://api.x.ai/v1",
+ "base_url_env": "",
+ "default_model": "",
+ "env": [],
+ "models": []
+ },
+ "xiaomi": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.xiaomimimo.com/v1",
+ "base_url_env": "XIAOMI_BASE_URL",
+ "default_model": "mimo-v2.5-pro",
+ "env": [
+ "XIAOMI_API_KEY"
+ ],
+ "models": []
+ },
+ "zai": {
+ "api_mode": "chat_completions",
+ "auth": "api_key",
+ "base_url": "https://api.z.ai/api/paas/v4",
+ "base_url_env": "GLM_BASE_URL",
+ "default_model": "glm-5.3",
+ "env": [
+ "GLM_API_KEY",
+ "ZAI_API_KEY",
+ "Z_AI_API_KEY"
+ ],
+ "models": [
+ "glm-5.2",
+ "glm-5",
+ "glm-4-9b"
+ ]
+ }
+ },
+ "version": "2026.9.21"
+}
diff --git a/libs/cua/crates/cua-connections/hermes-unlisted.txt b/libs/cua/crates/cua-connections/hermes-unlisted.txt
new file mode 100644
index 0000000000..7585d44ca2
--- /dev/null
+++ b/libs/cua/crates/cua-connections/hermes-unlisted.txt
@@ -0,0 +1,16 @@
+# Provider ids the pinned Hermes can resolve that no provider file lists, on purpose.
+# A new id in a newer Hermes fails the drift test until it is listed here or given a file.
+# Regenerate hermes-pin.json with tools/hermes_snapshot.py when the pin moves (see providers/README.md).
+alibaba-cn # region variant of alibaba; needs the plan question first
+alibaba-coding-plan # plan variant of alibaba; needs the plan question first
+alibaba-coding-plan-cn # plan variant of alibaba; needs the plan question first
+alibaba-token-plan # plan variant of alibaba; needs the plan question first
+alibaba-token-plan-cn # plan variant of alibaba; needs the plan question first
+commandcode-anthropic # second wire of commandcode, which is hidden until verified
+copilot # GitHub Copilot is the Copilot CLI token row; Hermes no longer carries it in newer releases
+copilot-acp # an ACP child process, not a connection
+kimi-coding-cn # China key uses its own variable; Kimi lists the global key
+lmstudio # LM Studio by URL is a Custom endpoint
+minimax-cn # China variant of minimax
+openai-codex # the ChatGPT sign-in is a method of OpenAI, scoped to Codex
+tencent-tokenplan # plan variant of tencent-tokenhub, which is hidden until verified
diff --git a/libs/cua/crates/cua-connections/providers/README.md b/libs/cua/crates/cua-connections/providers/README.md
new file mode 100644
index 0000000000..78387a6a36
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/README.md
@@ -0,0 +1,28 @@
+# Provider files
+
+One TOML file per provider. `cargo run -p cua-connections --bin cua-connections-gen`
+turns them into the Rust tables, the parity data for the web and SwiftUI apps, the
+CLI help and the provider table in `docs/content/docs/spaces/guides/connections.mdx`;
+`--check` (and `cargo test -p cua-connections`) fail when any of them is stale.
+`schema.rs` is the format and its checks.
+
+## Hiding a provider
+
+`hidden = true` with a `hidden_reason` keeps a provider out of every UI and out of
+what apps receive. `terms = "review"` on a provider or a method does the same for a
+subscription login whose terms have not been checked. Nothing else is needed to
+ship one later: remove the flag.
+
+## Keeping up with Hermes
+
+Provider ids, environment variables and base URLs are checked against a snapshot of
+the Hermes release Cua installs (`hermes-pin.json`, `tests/hermes_drift.rs`). To move
+the pin:
+
+1. Change the Hermes `commit` and `version` in `crates/cua-agents/installables.json`.
+2. Check out that commit and run
+ `python3 libs/cua/crates/cua-connections/tools/hermes_snapshot.py <checkout> > libs/cua/crates/cua-connections/hermes-pin.json`.
+3. Run `cargo test -p cua-connections`. A provider file that names a variable or URL
+ Hermes dropped fails, and so does a new Hermes provider that is neither listed in
+ a file nor in `hermes-unlisted.txt` (give it a file, or add it there with the
+ reason).
diff --git a/libs/cua/crates/cua-connections/providers/actual.toml b/libs/cua/crates/cua-connections/providers/actual.toml
new file mode 100644
index 0000000000..cd0528888d
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/actual.toml
@@ -0,0 +1,23 @@
+id = "actual"
+name = "Actual Computer"
+icon = "actual"
+tier = "more"
+rank = 320
+kind = "hosted"
+hidden = true
+hidden_reason = "Unverified: Cua has not run this provider end to end yet."
+aliases = ["aci"]
+wire = "openai-chat"
+base_url = "https://api.actual.inc/v1"
+base_url_env = "ACTUAL_BASE_URL"
+default_model = ""
+hermes_id = "actual"
+key_help = "Create a key at actual.inc."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "ACTUAL_API_KEY"
+
+[delivery]
+hermes = ["ACTUAL_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/ai-gateway.toml b/libs/cua/crates/cua-connections/providers/ai-gateway.toml
new file mode 100644
index 0000000000..9ae792a7a2
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/ai-gateway.toml
@@ -0,0 +1,21 @@
+id = "ai-gateway"
+name = "Vercel AI Gateway"
+icon = "ai-gateway"
+tier = "more"
+rank = 210
+kind = "aggregator"
+aliases = ["vercel"]
+wire = "openai-chat"
+base_url = "https://ai-gateway.vercel.sh/v1"
+base_url_env = "AI_GATEWAY_BASE_URL"
+default_model = "anthropic/claude-sonnet-5"
+hermes_id = "ai-gateway"
+key_help = "Create a key in the Vercel dashboard under AI Gateway."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "AI_GATEWAY_API_KEY"
+
+[delivery]
+hermes = ["AI_GATEWAY_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/alibaba.toml b/libs/cua/crates/cua-connections/providers/alibaba.toml
new file mode 100644
index 0000000000..6147093b1a
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/alibaba.toml
@@ -0,0 +1,22 @@
+id = "alibaba"
+name = "Qwen Cloud (Alibaba)"
+icon = "alibaba"
+tier = "more"
+rank = 280
+kind = "hosted"
+aliases = ["qwen", "dashscope", "alibaba cloud"]
+wire = "openai-chat"
+base_url = "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
+base_url_env = "DASHSCOPE_BASE_URL"
+default_model = ""
+hermes_id = "alibaba"
+key_help = "Create a key in Alibaba Cloud Model Studio (DashScope, international)."
+placeholder = "sk-…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "DASHSCOPE_API_KEY"
+
+[delivery]
+hermes = ["DASHSCOPE_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/anthropic.toml b/libs/cua/crates/cua-connections/providers/anthropic.toml
new file mode 100644
index 0000000000..d77e61ce1e
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/anthropic.toml
@@ -0,0 +1,47 @@
+id = "anthropic"
+name = "Anthropic"
+icon = "anthropic"
+tier = "top"
+rank = 10
+kind = "hosted"
+wire = "anthropic"
+base_url = "https://api.anthropic.com"
+default_model = "claude-sonnet-5"
+hermes_id = "anthropic"
+key_help = "Create a key at console.anthropic.com. Every app that uses Claude can use it."
+placeholder = "sk-ant-…"
+check = { path = "/v1/models?limit=1", auth = "x-api-key" }
+apps = ["t3code"]
+
+[[method]]
+id = "claude-login"
+kind = "import_login"
+env = "CLAUDE_CODE_OAUTH_TOKEN"
+scope = "claude-code"
+app = "claude-code"
+label = "Use your Claude Code sign-in"
+help = "Reads the sign-in Claude Code already has on this machine. Uses your Claude plan. Only Claude Code uses it."
+
+[[method]]
+id = "claude-token"
+kind = "import_login"
+env = "CLAUDE_CODE_OAUTH_TOKEN"
+scope = "claude-code"
+app = "claude-code"
+flow = "paste"
+label = "Paste a Claude token"
+help = "Advanced. A token made by running claude setup-token in Terminal. It lasts a year. Only Claude Code uses it."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "ANTHROPIC_API_KEY"
+aliases = ["ANTHROPIC_AUTH_TOKEN"]
+
+[delivery]
+claude-code = ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_AUTH_TOKEN"]
+opencode = ["ANTHROPIC_API_KEY"]
+goose = ["ANTHROPIC_API_KEY"]
+pi = ["ANTHROPIC_API_KEY"]
+openclaw = ["ANTHROPIC_API_KEY"]
+hermes = ["ANTHROPIC_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/arcee.toml b/libs/cua/crates/cua-connections/providers/arcee.toml
new file mode 100644
index 0000000000..73a2aedca5
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/arcee.toml
@@ -0,0 +1,21 @@
+id = "arcee"
+name = "Arcee AI"
+icon = "arcee"
+tier = "more"
+rank = 200
+kind = "hosted"
+aliases = ["trinity"]
+wire = "openai-chat"
+base_url = "https://api.arcee.ai/api/v1"
+base_url_env = "ARCEE_BASE_URL"
+default_model = "trinity-large-thinking"
+hermes_id = "arcee"
+key_help = "Create a key at chat.arcee.ai."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "ARCEEAI_API_KEY"
+
+[delivery]
+hermes = ["ARCEEAI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/azure-foundry.toml b/libs/cua/crates/cua-connections/providers/azure-foundry.toml
new file mode 100644
index 0000000000..a1a6029667
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/azure-foundry.toml
@@ -0,0 +1,20 @@
+id = "azure-foundry"
+name = "Azure AI Foundry"
+icon = "azure"
+tier = "more"
+rank = 400
+kind = "cloud"
+hidden = true
+hidden_reason = "Not built yet: needs the Entra ID method with a resource URL."
+aliases = ["azure", "azure openai", "microsoft"]
+wire = "openai-chat"
+base_url = ""
+default_model = ""
+hermes_id = "azure-foundry"
+key_help = "Use an Azure AI Foundry key with your resource URL."
+
+[[method]]
+id = "adc"
+kind = "adc"
+label = "Use your Microsoft sign-in"
+help = "Uses Entra ID on this machine."
diff --git a/libs/cua/crates/cua-connections/providers/bedrock.toml b/libs/cua/crates/cua-connections/providers/bedrock.toml
new file mode 100644
index 0000000000..90718b49de
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/bedrock.toml
@@ -0,0 +1,20 @@
+id = "bedrock"
+name = "Amazon Bedrock"
+icon = "aws"
+tier = "more"
+rank = 390
+kind = "cloud"
+hidden = true
+hidden_reason = "Not built yet: needs the AWS credential chain method with a region."
+aliases = ["aws", "amazon"]
+wire = "bedrock"
+base_url = "https://bedrock-runtime.us-east-1.amazonaws.com"
+default_model = ""
+hermes_id = "bedrock"
+key_help = "Use your AWS credentials with a region."
+
+[[method]]
+id = "adc"
+kind = "adc"
+label = "Use your AWS credentials"
+help = "Uses the AWS profile or environment on this machine."
diff --git a/libs/cua/crates/cua-connections/providers/commandcode.toml b/libs/cua/crates/cua-connections/providers/commandcode.toml
new file mode 100644
index 0000000000..fcbfbeb20c
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/commandcode.toml
@@ -0,0 +1,22 @@
+id = "commandcode"
+name = "CommandCode"
+icon = "commandcode"
+tier = "more"
+rank = 310
+kind = "hosted"
+hidden = true
+hidden_reason = "Unverified: Cua has not run this provider end to end yet."
+wire = "openai-chat"
+base_url = "https://api.commandcode.ai/provider/v1"
+base_url_env = "COMMANDCODE_BASE_URL"
+default_model = "deepseek/deepseek-v4-pro"
+hermes_id = "commandcode"
+key_help = "Create a key at commandcode.ai."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "COMMANDCODE_API_KEY"
+
+[delivery]
+hermes = ["COMMANDCODE_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/custom.toml b/libs/cua/crates/cua-connections/providers/custom.toml
new file mode 100644
index 0000000000..db87741268
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/custom.toml
@@ -0,0 +1,43 @@
+id = "custom"
+name = "Custom endpoint"
+icon = "custom"
+tier = "top"
+rank = 900
+kind = "custom"
+aliases = ["openai compatible", "lm studio", "ollama", "vllm", "llama.cpp", "litellm", "local server", "gateway", "proxy"]
+wire = "openai-chat"
+base_url = ""
+default_model = ""
+hermes_id = "custom"
+key_help = "Any server that speaks the OpenAI chat API: LM Studio, Ollama, vLLM, a gateway or a proxy."
+placeholder = "Key, if the server asks for one"
+
+[[method]]
+id = "endpoint"
+kind = "custom_endpoint"
+env = "CUSTOM_ENDPOINT_API_KEY"
+secret = "optional"
+
+[[method.field]]
+id = "base_url"
+label = "Base URL"
+kind = "url"
+placeholder = "http://host:1234/v1"
+required = true
+
+[[method.field]]
+id = "model"
+label = "Model"
+kind = "text"
+placeholder = "The model id the server serves"
+required = true
+
+[[method.field]]
+id = "wire"
+label = "API style"
+kind = "choice"
+options = ["openai-chat", "openai-responses", "anthropic"]
+required = true
+
+[delivery]
+hermes = ["CUSTOM_ENDPOINT_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/deepinfra.toml b/libs/cua/crates/cua-connections/providers/deepinfra.toml
new file mode 100644
index 0000000000..cc3cc51685
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/deepinfra.toml
@@ -0,0 +1,21 @@
+id = "deepinfra"
+name = "DeepInfra"
+icon = "deepinfra"
+tier = "more"
+rank = 150
+kind = "hosted"
+aliases = ["deep infra"]
+wire = "openai-chat"
+base_url = "https://api.deepinfra.com/v1/openai"
+base_url_env = "DEEPINFRA_BASE_URL"
+default_model = ""
+hermes_id = "deepinfra"
+key_help = "Create a key at deepinfra.com."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "DEEPINFRA_API_KEY"
+
+[delivery]
+hermes = ["DEEPINFRA_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/deepseek.toml b/libs/cua/crates/cua-connections/providers/deepseek.toml
new file mode 100644
index 0000000000..116a7d5562
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/deepseek.toml
@@ -0,0 +1,21 @@
+id = "deepseek"
+name = "DeepSeek"
+icon = "deepseek"
+tier = "top"
+rank = 60
+kind = "hosted"
+wire = "openai-chat"
+base_url = "https://api.deepseek.com/v1"
+default_model = "deepseek-flash"
+hermes_id = "deepseek"
+key_help = "Create a key at platform.deepseek.com. Every app that uses DeepSeek can use it."
+placeholder = "sk-…"
+check = { path = "/models", auth = "bearer" }
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "DEEPSEEK_API_KEY"
+
+[delivery]
+hermes = ["DEEPSEEK_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/fireworks.toml b/libs/cua/crates/cua-connections/providers/fireworks.toml
new file mode 100644
index 0000000000..8807621755
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/fireworks.toml
@@ -0,0 +1,21 @@
+id = "fireworks"
+name = "Fireworks AI"
+icon = "fireworks"
+tier = "more"
+rank = 120
+kind = "hosted"
+aliases = ["fw"]
+wire = "openai-chat"
+base_url = "https://api.fireworks.ai/inference/v1"
+default_model = "accounts/fireworks/models/kimi-k2p6"
+hermes_id = "fireworks"
+key_help = "Create a key at fireworks.ai."
+placeholder = "fw_…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "FIREWORKS_API_KEY"
+
+[delivery]
+hermes = ["FIREWORKS_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/github.toml b/libs/cua/crates/cua-connections/providers/github.toml
new file mode 100644
index 0000000000..ce71e69a0b
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/github.toml
@@ -0,0 +1,18 @@
+id = "github"
+name = "GitHub Copilot"
+icon = "github"
+tier = "more"
+rank = 80
+kind = "hosted"
+aliases = ["copilot", "github copilot cli"]
+wire = "openai-chat"
+base_url = "https://api.githubcopilot.com"
+default_model = ""
+key_help = "Create a fine-grained token with the Copilot Requests permission at github.com/settings/tokens."
+placeholder = "github_pat_…"
+apps = ["copilot-cli"]
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "COPILOT_GITHUB_TOKEN"
diff --git a/libs/cua/crates/cua-connections/providers/gmi.toml b/libs/cua/crates/cua-connections/providers/gmi.toml
new file mode 100644
index 0000000000..2ea3eb7cad
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/gmi.toml
@@ -0,0 +1,21 @@
+id = "gmi"
+name = "GMI Cloud"
+icon = "gmi"
+tier = "more"
+rank = 180
+kind = "hosted"
+aliases = ["gmicloud"]
+wire = "openai-chat"
+base_url = "https://api.gmi-serving.com/v1"
+base_url_env = "GMI_BASE_URL"
+default_model = "zai-org/GLM-5.1-FP8"
+hermes_id = "gmi"
+key_help = "Create a key at gmicloud.ai."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "GMI_API_KEY"
+
+[delivery]
+hermes = ["GMI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/google.toml b/libs/cua/crates/cua-connections/providers/google.toml
new file mode 100644
index 0000000000..618da079d3
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/google.toml
@@ -0,0 +1,28 @@
+id = "google"
+name = "Google AI Studio"
+icon = "google"
+tier = "top"
+rank = 40
+kind = "hosted"
+aliases = ["gemini", "google ai", "aistudio"]
+wire = "gemini"
+base_url = "https://generativelanguage.googleapis.com/v1beta"
+default_model = "gemini-3.8-flash"
+hermes_id = "gemini"
+key_help = "Create a key at aistudio.google.com/apikey. Every app that uses Gemini can use it."
+placeholder = "AIza…"
+check = { path = "/models", auth = "x-goog-api-key" }
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "GEMINI_API_KEY"
+aliases = ["GOOGLE_API_KEY"]
+
+[delivery]
+gemini-cli = ["GEMINI_API_KEY", "GOOGLE_API_KEY"]
+google-antigravity = ["GEMINI_API_KEY"]
+opencode = ["GEMINI_API_KEY"]
+pi = ["GEMINI_API_KEY"]
+goose = ["GOOGLE_API_KEY", "GOOGLE_API_KEY<-GEMINI_API_KEY"]
+hermes = ["GEMINI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/huggingface.toml b/libs/cua/crates/cua-connections/providers/huggingface.toml
new file mode 100644
index 0000000000..bcb0304ff6
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/huggingface.toml
@@ -0,0 +1,22 @@
+id = "huggingface"
+name = "Hugging Face"
+icon = "huggingface"
+tier = "more"
+rank = 100
+kind = "hosted"
+aliases = ["hf"]
+wire = "openai-chat"
+base_url = "https://router.huggingface.co/v1"
+base_url_env = "HF_BASE_URL"
+default_model = "moonshotai/Kimi-K2.5"
+hermes_id = "huggingface"
+key_help = "Create a token at huggingface.co/settings/tokens with the Inference Providers permission."
+placeholder = "hf_…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "HF_TOKEN"
+
+[delivery]
+hermes = ["HF_TOKEN"]
diff --git a/libs/cua/crates/cua-connections/providers/kilocode.toml b/libs/cua/crates/cua-connections/providers/kilocode.toml
new file mode 100644
index 0000000000..02f09dec21
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/kilocode.toml
@@ -0,0 +1,21 @@
+id = "kilocode"
+name = "Kilo Code"
+icon = "kilocode"
+tier = "more"
+rank = 240
+kind = "aggregator"
+aliases = ["kilo"]
+wire = "openai-chat"
+base_url = "https://api.kilo.ai/api/gateway"
+base_url_env = "KILOCODE_BASE_URL"
+default_model = ""
+hermes_id = "kilocode"
+key_help = "Create a key at kilo.ai."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "KILOCODE_API_KEY"
+
+[delivery]
+hermes = ["KILOCODE_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/kimi.toml b/libs/cua/crates/cua-connections/providers/kimi.toml
new file mode 100644
index 0000000000..1ee11624ca
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/kimi.toml
@@ -0,0 +1,23 @@
+id = "kimi"
+name = "Kimi (Moonshot)"
+icon = "kimi"
+tier = "top"
+rank = 70
+kind = "hosted"
+aliases = ["moonshot", "kimi code"]
+wire = "openai-chat"
+base_url = "https://api.moonshot.ai/v1"
+default_model = "kimi-k3"
+hermes_id = "kimi-coding"
+key_help = "Create a key at platform.moonshot.ai, or a Kimi Code key (sk-kimi-). Every app that uses Kimi can use it."
+placeholder = "sk-…"
+check = { path = "/models", auth = "bearer" }
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "KIMI_API_KEY"
+aliases = ["KIMI_CODING_API_KEY"]
+
+[delivery]
+hermes = ["KIMI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/meta-ai.toml b/libs/cua/crates/cua-connections/providers/meta-ai.toml
new file mode 100644
index 0000000000..1fb3b15527
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/meta-ai.toml
@@ -0,0 +1,24 @@
+id = "meta-ai"
+name = "Meta Model API"
+icon = "meta-ai"
+tier = "more"
+rank = 290
+kind = "hosted"
+hidden = true
+hidden_reason = "Unverified: Cua has not run this provider end to end yet."
+aliases = ["meta", "muse"]
+wire = "openai-responses"
+base_url = "https://api.meta.ai/v1"
+base_url_env = "META_BASE_URL"
+default_model = "muse-spark-1.2"
+hermes_id = "meta-ai"
+key_help = "Create a key at the Meta Model API console."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "MODEL_API_KEY"
+aliases = ["META_API_KEY", "META_MODEL_API_KEY"]
+
+[delivery]
+hermes = ["MODEL_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/minimax-oauth.toml b/libs/cua/crates/cua-connections/providers/minimax-oauth.toml
new file mode 100644
index 0000000000..66bdb398f8
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/minimax-oauth.toml
@@ -0,0 +1,23 @@
+id = "minimax-oauth"
+name = "MiniMax sign-in"
+icon = "minimax"
+tier = "more"
+rank = 360
+kind = "hosted"
+hidden = true
+hidden_reason = "Subscription login: Cua has not reviewed the provider's terms for use in a third-party app yet."
+terms = "review"
+aliases = ["minimax coding plan"]
+wire = "anthropic"
+base_url = "https://api.minimax.io/anthropic"
+default_model = "MiniMax-M3"
+hermes_id = "minimax-oauth"
+key_help = "Sign in with your MiniMax account."
+
+[[method]]
+id = "portal"
+kind = "subscription_login"
+scope = "hermes"
+terms = "review"
+label = "Sign in with MiniMax"
+help = "Opens MiniMax in your browser. Only Hermes uses this sign-in."
diff --git a/libs/cua/crates/cua-connections/providers/minimax.toml b/libs/cua/crates/cua-connections/providers/minimax.toml
new file mode 100644
index 0000000000..1121186e67
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/minimax.toml
@@ -0,0 +1,21 @@
+id = "minimax"
+name = "MiniMax"
+icon = "minimax"
+tier = "more"
+rank = 270
+kind = "hosted"
+aliases = ["mini-max"]
+wire = "anthropic"
+base_url = "https://api.minimax.io/anthropic"
+base_url_env = "MINIMAX_BASE_URL"
+default_model = "MiniMax-M3"
+hermes_id = "minimax"
+key_help = "Create a key at platform.minimax.io. This is the API key, not the MiniMax sign-in."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "MINIMAX_API_KEY"
+
+[delivery]
+hermes = ["MINIMAX_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/nebius-token-factory.toml b/libs/cua/crates/cua-connections/providers/nebius-token-factory.toml
new file mode 100644
index 0000000000..3caea299d9
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/nebius-token-factory.toml
@@ -0,0 +1,22 @@
+id = "nebius-token-factory"
+name = "Nebius Token Factory"
+icon = "nebius-token-factory"
+tier = "more"
+rank = 170
+kind = "hosted"
+aliases = ["nebius"]
+wire = "openai-chat"
+base_url = "https://api.tokenfactory.nebius.com/v1"
+base_url_env = "NEBIUS_BASE_URL"
+default_model = "Qwen/Qwen3.5-397B-A17B-fast"
+hermes_id = "nebius-token-factory"
+key_help = "Create a key at tokenfactory.nebius.com."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "NEBIUS_API_KEY"
+aliases = ["NEBIUS_TOKEN_FACTORY_API_KEY"]
+
+[delivery]
+hermes = ["NEBIUS_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/nous.toml b/libs/cua/crates/cua-connections/providers/nous.toml
new file mode 100644
index 0000000000..fe6b3f9878
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/nous.toml
@@ -0,0 +1,24 @@
+id = "nous"
+name = "Nous Portal"
+icon = "nous"
+tier = "more"
+rank = 340
+kind = "aggregator"
+hidden = true
+hidden_reason = "Subscription sign-in: Cua has not reviewed the provider's terms for use in a third-party app yet."
+terms = "review"
+aliases = ["nous research", "hermes"]
+wire = "openai-chat"
+base_url = "https://inference-api.nousresearch.com/v1"
+default_model = ""
+hermes_id = "nous"
+key_help = "Sign in with your Nous Portal account."
+
+[[method]]
+id = "portal"
+kind = "device_code"
+env = "NOUS_API_KEY"
+scope = "hermes"
+terms = "review"
+label = "Sign in with Nous Portal"
+help = "Shows a code to enter on the Nous Portal. Only Hermes uses this sign-in."
diff --git a/libs/cua/crates/cua-connections/providers/novita.toml b/libs/cua/crates/cua-connections/providers/novita.toml
new file mode 100644
index 0000000000..781556864d
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/novita.toml
@@ -0,0 +1,22 @@
+id = "novita"
+name = "Novita AI"
+icon = "novita"
+tier = "more"
+rank = 160
+kind = "hosted"
+aliases = ["novitaai"]
+wire = "openai-chat"
+base_url = "https://api.novita.ai/openai/v1"
+base_url_env = "NOVITA_BASE_URL"
+default_model = "moonshotai/kimi-k2.5"
+hermes_id = "novita"
+key_help = "Create a key at novita.ai."
+placeholder = "sk_…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "NOVITA_API_KEY"
+
+[delivery]
+hermes = ["NOVITA_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/nvidia.toml b/libs/cua/crates/cua-connections/providers/nvidia.toml
new file mode 100644
index 0000000000..cc5ff2c9c9
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/nvidia.toml
@@ -0,0 +1,22 @@
+id = "nvidia"
+name = "NVIDIA NIM"
+icon = "nvidia"
+tier = "more"
+rank = 130
+kind = "hosted"
+aliases = ["nim", "nemotron", "build.nvidia.com"]
+wire = "openai-chat"
+base_url = "https://integrate.api.nvidia.com/v1"
+base_url_env = "NVIDIA_BASE_URL"
+default_model = "nvidia/nemotron-3-ultra-550b-a55b"
+hermes_id = "nvidia"
+key_help = "Create a key at build.nvidia.com."
+placeholder = "nvapi-…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "NVIDIA_API_KEY"
+
+[delivery]
+hermes = ["NVIDIA_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/ollama-cloud.toml b/libs/cua/crates/cua-connections/providers/ollama-cloud.toml
new file mode 100644
index 0000000000..84a72eee5b
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/ollama-cloud.toml
@@ -0,0 +1,21 @@
+id = "ollama-cloud"
+name = "Ollama Cloud"
+icon = "ollama-cloud"
+tier = "more"
+rank = 140
+kind = "hosted"
+aliases = ["ollama"]
+wire = "openai-chat"
+base_url = "https://ollama.com/v1"
+base_url_env = "OLLAMA_BASE_URL"
+default_model = ""
+hermes_id = "ollama-cloud"
+key_help = "Create a key at ollama.com/settings. For a server on your own machine use Custom endpoint."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "OLLAMA_API_KEY"
+
+[delivery]
+hermes = ["OLLAMA_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/openai.toml b/libs/cua/crates/cua-connections/providers/openai.toml
new file mode 100644
index 0000000000..69fc57b5bb
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/openai.toml
@@ -0,0 +1,39 @@
+id = "openai"
+name = "OpenAI"
+icon = "openai"
+tier = "top"
+rank = 20
+kind = "hosted"
+wire = "openai-responses"
+also_wires = ["openai-chat"]
+base_url = "https://api.openai.com/v1"
+default_model = "gpt-5.5"
+hermes_id = "openai-api"
+key_help = "Create a key at platform.openai.com. Every app that uses OpenAI can use it."
+placeholder = "sk-…"
+check = { path = "/models", auth = "bearer" }
+apps = ["t3code"]
+
+[[method]]
+id = "chatgpt-login"
+kind = "subscription_login"
+env = "CODEX_AUTH_JSON"
+scope = "openai-codex"
+app = "codex"
+flow = "device_code"
+label = "Sign in with ChatGPT"
+help = "Shows a code to enter on openai.com. It uses your ChatGPT plan and only Codex uses it."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "OPENAI_API_KEY"
+aliases = ["CODEX_API_KEY"]
+
+[delivery]
+openai-codex = ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_AUTH_JSON"]
+opencode = ["OPENAI_API_KEY"]
+goose = ["OPENAI_API_KEY"]
+pi = ["OPENAI_API_KEY"]
+openclaw = ["OPENAI_API_KEY"]
+hermes = ["OPENAI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/opencode-go.toml b/libs/cua/crates/cua-connections/providers/opencode-go.toml
new file mode 100644
index 0000000000..eab76867f1
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/opencode-go.toml
@@ -0,0 +1,21 @@
+id = "opencode-go"
+name = "OpenCode Go"
+icon = "opencode-go"
+tier = "more"
+rank = 230
+kind = "aggregator"
+aliases = ["go"]
+wire = "openai-chat"
+base_url = "https://opencode.ai/zen/go/v1"
+base_url_env = "OPENCODE_GO_BASE_URL"
+default_model = "kimi-k3"
+hermes_id = "opencode-go"
+key_help = "Create a key at opencode.ai."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "OPENCODE_GO_API_KEY"
+
+[delivery]
+hermes = ["OPENCODE_GO_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/opencode-zen.toml b/libs/cua/crates/cua-connections/providers/opencode-zen.toml
new file mode 100644
index 0000000000..00acdbb950
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/opencode-zen.toml
@@ -0,0 +1,21 @@
+id = "opencode-zen"
+name = "OpenCode Zen"
+icon = "opencode-zen"
+tier = "more"
+rank = 220
+kind = "aggregator"
+aliases = ["zen"]
+wire = "openai-chat"
+base_url = "https://opencode.ai/zen/v1"
+base_url_env = "OPENCODE_ZEN_BASE_URL"
+default_model = "x-preview-f-free"
+hermes_id = "opencode-zen"
+key_help = "Create a key at opencode.ai/zen."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "OPENCODE_ZEN_API_KEY"
+
+[delivery]
+hermes = ["OPENCODE_ZEN_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/openrouter.toml b/libs/cua/crates/cua-connections/providers/openrouter.toml
new file mode 100644
index 0000000000..05a9c7d687
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/openrouter.toml
@@ -0,0 +1,25 @@
+id = "openrouter"
+name = "OpenRouter"
+icon = "openrouter"
+tier = "top"
+rank = 30
+kind = "aggregator"
+wire = "openai-chat"
+base_url = "https://openrouter.ai/api/v1"
+default_model = "anthropic/claude-sonnet-5"
+hermes_id = "openrouter"
+key_help = "Create a key at openrouter.ai/keys. Every app that uses OpenRouter can use it."
+placeholder = "sk-or-…"
+check = { path = "/auth/key", auth = "bearer" }
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "OPENROUTER_API_KEY"
+
+[delivery]
+opencode = ["OPENROUTER_API_KEY"]
+goose = ["OPENROUTER_API_KEY"]
+pi = ["OPENROUTER_API_KEY"]
+openclaw = ["OPENROUTER_API_KEY"]
+hermes = ["OPENROUTER_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/qwen-oauth.toml b/libs/cua/crates/cua-connections/providers/qwen-oauth.toml
new file mode 100644
index 0000000000..99314fab5c
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/qwen-oauth.toml
@@ -0,0 +1,24 @@
+id = "qwen-oauth"
+name = "Qwen CLI sign-in"
+icon = "qwen"
+tier = "more"
+rank = 350
+kind = "hosted"
+hidden = true
+hidden_reason = "Subscription login: Cua has not reviewed the provider's terms for reusing another app's sign-in yet."
+terms = "review"
+aliases = ["qwen cli", "qwen code"]
+wire = "openai-chat"
+base_url = "https://portal.qwen.ai/v1"
+default_model = ""
+hermes_id = "qwen-oauth"
+key_help = "Use the sign-in the Qwen CLI made on this machine."
+
+[[method]]
+id = "qwen-login"
+kind = "import_login"
+env = "QWEN_API_KEY"
+scope = "hermes"
+terms = "review"
+label = "Use your Qwen CLI sign-in"
+help = "Copies the sign-in the Qwen CLI made on this machine. Only Hermes uses it."
diff --git a/libs/cua/crates/cua-connections/providers/router.toml b/libs/cua/crates/cua-connections/providers/router.toml
new file mode 100644
index 0000000000..ee903ac51e
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/router.toml
@@ -0,0 +1,24 @@
+id = "router"
+name = "Ramp Router"
+icon = "router"
+tier = "more"
+rank = 300
+kind = "hosted"
+hidden = true
+hidden_reason = "Unverified: Cua has not run this provider end to end yet."
+aliases = ["ramp"]
+wire = "openai-responses"
+base_url = "https://api.router.com/v1"
+base_url_env = "RAMP_ROUTER_BASE_URL"
+default_model = ""
+hermes_id = "router"
+key_help = "Create a key at router.com."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "RAMP_ROUTER_API_KEY"
+aliases = ["ROUTER_API_KEY"]
+
+[delivery]
+hermes = ["RAMP_ROUTER_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/stepfun.toml b/libs/cua/crates/cua-connections/providers/stepfun.toml
new file mode 100644
index 0000000000..1489b21c46
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/stepfun.toml
@@ -0,0 +1,21 @@
+id = "stepfun"
+name = "StepFun"
+icon = "stepfun"
+tier = "more"
+rank = 260
+kind = "hosted"
+aliases = ["step"]
+wire = "openai-chat"
+base_url = "https://api.stepfun.ai/step_plan/v1"
+base_url_env = "STEPFUN_BASE_URL"
+default_model = "step-3.5-flash"
+hermes_id = "stepfun"
+key_help = "Create a key at platform.stepfun.ai (Step Plan)."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "STEPFUN_API_KEY"
+
+[delivery]
+hermes = ["STEPFUN_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/tencent-tokenhub.toml b/libs/cua/crates/cua-connections/providers/tencent-tokenhub.toml
new file mode 100644
index 0000000000..156e4ccec0
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/tencent-tokenhub.toml
@@ -0,0 +1,23 @@
+id = "tencent-tokenhub"
+name = "Tencent TokenHub"
+icon = "tencent-tokenhub"
+tier = "more"
+rank = 330
+kind = "hosted"
+hidden = true
+hidden_reason = "Unverified: Cua has not run this provider end to end yet."
+aliases = ["tencent", "hunyuan"]
+wire = "openai-chat"
+base_url = "https://tokenhub.tencentmaas.com/v1"
+base_url_env = "TOKENHUB_BASE_URL"
+default_model = ""
+hermes_id = "tencent-tokenhub"
+key_help = "Create a key in the Tencent TokenHub console."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "TOKENHUB_API_KEY"
+
+[delivery]
+hermes = ["TOKENHUB_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/upstage.toml b/libs/cua/crates/cua-connections/providers/upstage.toml
new file mode 100644
index 0000000000..f3a91c6544
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/upstage.toml
@@ -0,0 +1,22 @@
+id = "upstage"
+name = "Upstage Solar"
+icon = "upstage"
+tier = "more"
+rank = 190
+kind = "hosted"
+aliases = ["solar"]
+wire = "openai-chat"
+base_url = "https://api.upstage.ai/v1"
+base_url_env = "UPSTAGE_BASE_URL"
+default_model = "solar-pro3"
+hermes_id = "upstage"
+key_help = "Create a key at console.upstage.ai."
+placeholder = "up_…"
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "UPSTAGE_API_KEY"
+
+[delivery]
+hermes = ["UPSTAGE_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/vertex.toml b/libs/cua/crates/cua-connections/providers/vertex.toml
new file mode 100644
index 0000000000..545c8b35c1
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/vertex.toml
@@ -0,0 +1,20 @@
+id = "vertex"
+name = "Google Vertex AI"
+icon = "google"
+tier = "more"
+rank = 380
+kind = "cloud"
+hidden = true
+hidden_reason = "Not built yet: needs the Google sign-in (ADC) method with project and region."
+aliases = ["gcp", "google cloud"]
+wire = "openai-chat"
+base_url = ""
+default_model = ""
+hermes_id = "vertex"
+key_help = "Use your Google Cloud sign-in with a project and region."
+
+[[method]]
+id = "adc"
+kind = "adc"
+label = "Use your Google Cloud sign-in"
+help = "Uses the application default credentials on this machine."
diff --git a/libs/cua/crates/cua-connections/providers/xai-oauth.toml b/libs/cua/crates/cua-connections/providers/xai-oauth.toml
new file mode 100644
index 0000000000..277e1e8ad3
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/xai-oauth.toml
@@ -0,0 +1,23 @@
+id = "xai-oauth"
+name = "SuperGrok sign-in"
+icon = "xai"
+tier = "more"
+rank = 370
+kind = "hosted"
+hidden = true
+hidden_reason = "Subscription login: Cua has not reviewed xAI's terms for use in a third-party app yet."
+terms = "review"
+aliases = ["supergrok", "grok subscription"]
+wire = "openai-responses"
+base_url = "https://api.x.ai/v1"
+default_model = "grok-4.6"
+hermes_id = "xai-oauth"
+key_help = "Sign in with your SuperGrok or X Premium+ account."
+
+[[method]]
+id = "supergrok"
+kind = "subscription_login"
+scope = "hermes"
+terms = "review"
+label = "Sign in with SuperGrok"
+help = "Shows a code to enter on x.ai. Only Hermes uses this sign-in."
diff --git a/libs/cua/crates/cua-connections/providers/xai.toml b/libs/cua/crates/cua-connections/providers/xai.toml
new file mode 100644
index 0000000000..b164cc0139
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/xai.toml
@@ -0,0 +1,23 @@
+id = "xai"
+name = "xAI"
+icon = "xai"
+tier = "top"
+rank = 50
+kind = "hosted"
+aliases = ["grok"]
+wire = "openai-responses"
+also_wires = ["openai-chat"]
+base_url = "https://api.x.ai/v1"
+default_model = "grok-4.6"
+hermes_id = "xai"
+key_help = "Create a key at console.x.ai. Every app that uses Grok can use it."
+placeholder = "xai-…"
+check = { path = "/models", auth = "bearer" }
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "XAI_API_KEY"
+
+[delivery]
+hermes = ["XAI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/xiaomi.toml b/libs/cua/crates/cua-connections/providers/xiaomi.toml
new file mode 100644
index 0000000000..cdda18c427
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/xiaomi.toml
@@ -0,0 +1,21 @@
+id = "xiaomi"
+name = "Xiaomi MiMo"
+icon = "xiaomi"
+tier = "more"
+rank = 250
+kind = "hosted"
+aliases = ["mimo"]
+wire = "openai-chat"
+base_url = "https://api.xiaomimimo.com/v1"
+base_url_env = "XIAOMI_BASE_URL"
+default_model = "mimo-v2.5-pro"
+hermes_id = "xiaomi"
+key_help = "Create a key at platform.xiaomimimo.com."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "XIAOMI_API_KEY"
+
+[delivery]
+hermes = ["XIAOMI_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/providers/zai.toml b/libs/cua/crates/cua-connections/providers/zai.toml
new file mode 100644
index 0000000000..5d89d22ae1
--- /dev/null
+++ b/libs/cua/crates/cua-connections/providers/zai.toml
@@ -0,0 +1,42 @@
+id = "zai"
+name = "Z.AI (GLM)"
+icon = "zai"
+tier = "more"
+rank = 110
+kind = "hosted"
+aliases = ["glm", "zhipu", "z.ai"]
+wire = "openai-chat"
+base_url = "https://api.z.ai/api/paas/v4"
+base_url_env = "GLM_BASE_URL"
+default_model = "glm-5.3"
+hermes_id = "zai"
+key_help = "Create a key at z.ai. Pick the plan the key belongs to: they bill separately."
+
+[[method]]
+id = "key"
+kind = "api_key"
+env = "GLM_API_KEY"
+aliases = ["ZAI_API_KEY", "Z_AI_API_KEY"]
+
+[[region]]
+id = "global"
+name = "Global"
+base_url = "https://api.z.ai/api/paas/v4"
+
+[[region]]
+id = "cn"
+name = "China"
+base_url = "https://open.bigmodel.cn/api/paas/v4"
+
+[[region]]
+id = "coding-global"
+name = "Global, Coding Plan"
+base_url = "https://api.z.ai/api/coding/paas/v4"
+
+[[region]]
+id = "coding-cn"
+name = "China, Coding Plan"
+base_url = "https://open.bigmodel.cn/api/coding/paas/v4"
+
+[delivery]
+hermes = ["GLM_API_KEY"]
diff --git a/libs/cua/crates/cua-connections/src/bin/gen.rs b/libs/cua/crates/cua-connections/src/bin/gen.rs
new file mode 100644
index 0000000000..4de146f786
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/bin/gen.rs
@@ -0,0 +1,44 @@
+//! `cua-connections-gen [--check]`: regenerates (or verifies) everything
+//! derived from `providers/*.toml`.
+
+use std::process::ExitCode;
+
+fn main() -> ExitCode {
+ let check = std::env::args().any(|a| a == "--check");
+ let root = cua_connections::generate::repo_root();
+ if check {
+ match cua_connections::generate::check(&root) {
+ Ok(stale) if stale.is_empty() => {
+ println!("connections: generated files are current");
+ ExitCode::SUCCESS
+ }
+ Ok(stale) => {
+ eprintln!(
+ "connections: stale generated files (run `cargo run -p cua-connections --bin cua-connections-gen`):"
+ );
+ for s in stale {
+ eprintln!(" {s}");
+ }
+ ExitCode::FAILURE
+ }
+ Err(e) => {
+ eprintln!("connections: {e}");
+ ExitCode::FAILURE
+ }
+ }
+ } else {
+ match cua_connections::generate::write(&root) {
+ Ok(changed) => {
+ for c in &changed {
+ println!("wrote {c}");
+ }
+ println!("connections: {} file(s) updated", changed.len());
+ ExitCode::SUCCESS
+ }
+ Err(e) => {
+ eprintln!("connections: {e}");
+ ExitCode::FAILURE
+ }
+ }
+ }
+}
diff --git a/libs/cua/crates/cua-connections/src/delivery.rs b/libs/cua/crates/cua-connections/src/delivery.rs
new file mode 100644
index 0000000000..cb090c292d
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/delivery.rs
@@ -0,0 +1,140 @@
+//! Which saved credentials reach a run of which app: the one place that
+//! decides, from the provider files.
+
+use std::collections::BTreeMap;
+
+use crate::{Connected, ENDPOINT_HARNESSES, HARNESS_IDS, Provider, provider, visible};
+
+/// The variables a run of `harness` receives, given the saved names and
+/// values (`lookup` answers for one saved name, `None` when not saved, empty
+/// or no longer usable).
+///
+/// Providers are read in rank order and the first to fill a variable wins. A
+/// name that only a scoped sign-in saves (the Claude Code sign-in, the ChatGPT
+/// sign-in) is skipped for every app but its own, even if a provider file
+/// listed it (the generator refuses such a file too).
+pub fn deliver(harness: &str, lookup: &dyn Fn(&str) -> Option<String>) -> BTreeMap<String, String> {
+ let mut out = BTreeMap::new();
+ for p in visible() {
+ for e in p.delivery_for(harness) {
+ if p.scope_of(e.src).is_some_and(|s| s != harness) {
+ continue;
+ }
+ if out.contains_key(e.dest) {
+ continue;
+ }
+ if let Some(v) = lookup(e.src).filter(|v| !v.is_empty()) {
+ out.insert(e.dest.to_string(), v);
+ }
+ }
+ }
+ out
+}
+
+/// The apps that can use `p`, in the order of the Connections page: those it
+/// delivers a variable to, then (for providers an app has no variable for)
+/// the apps that can be pointed at its wire with a base URL and a model.
+pub fn works_with(p: &Provider) -> Vec<&'static str> {
+ HARNESS_IDS
+ .iter()
+ .copied()
+ .filter(|h| {
+ !p.delivery_for(h).is_empty()
+ || (p.delivery.iter().all(|d| d.harness != *h) && endpoint_wire(p, h).is_some())
+ })
+ .collect()
+}
+
+/// The wire an endpoint harness would use for `p`, when it can.
+fn endpoint_wire(p: &Provider, harness: &str) -> Option<&'static str> {
+ let (_, wire) = ENDPOINT_HARNESSES.iter().find(|(h, _)| *h == harness)?;
+ let serves = p.wire == *wire || p.also_wires.contains(wire);
+ let usable =
+ p.kind == crate::Kind::Custom || (!p.base_url.is_empty() && !p.default_model.is_empty());
+ (serves && usable && p.visible()).then_some(*wire)
+}
+
+/// An endpoint a run is pointed at because a connection is for an app that
+/// has no variable of its own for it.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct EndpointPlan {
+ pub provider: &'static str,
+ pub base_url: String,
+ pub wire: &'static str,
+ pub model: String,
+ /// The saved name the key is read from (`None`: a server that needs none).
+ pub key_src: Option<&'static str>,
+}
+
+/// The endpoint `harness` is pointed at from `connected` when none of its
+/// own variables is available: the first connected provider (rank order)
+/// that serves the harness's wire, has a base URL and a model, and whose key
+/// is saved (`present`). `None` for a harness that is not an endpoint
+/// harness, or when nothing qualifies.
+pub fn endpoint_for(
+ harness: &str,
+ connected: &[Connected],
+ present: &dyn Fn(&str) -> bool,
+) -> Option<EndpointPlan> {
+ let mut candidates: Vec<(&'static Provider, &Connected)> = connected
+ .iter()
+ .filter_map(|c| provider(&c.provider).map(|p| (p, c)))
+ .filter(|(p, _)| p.visible() && p.delivery_for(harness).is_empty())
+ .collect();
+ candidates.sort_by_key(|(p, _)| p.rank);
+ for (p, c) in candidates {
+ let custom = p.kind == crate::Kind::Custom;
+ let wire = if custom {
+ let w = c.fields.get("wire").map(String::as_str).unwrap_or(p.wire);
+ match endpoint_wire_of(harness) {
+ Some(hw) if hw == w => hw,
+ _ => continue,
+ }
+ } else {
+ match endpoint_wire(p, harness) {
+ Some(w) => w,
+ None => continue,
+ }
+ };
+ let Some(m) = p.key_method() else {
+ continue;
+ };
+ let key_present = present(m.env) || m.aliases.iter().any(|a| present(a));
+ let optional = m.secret_optional;
+ if !key_present && !optional {
+ continue;
+ }
+ let (base_url, model) = if custom {
+ (
+ c.fields.get("base_url").cloned().unwrap_or_default(),
+ c.fields.get("model").cloned().unwrap_or_default(),
+ )
+ } else {
+ (
+ p.base_url_for(c.region.as_deref()).to_string(),
+ c.fields
+ .get("model")
+ .cloned()
+ .unwrap_or_else(|| p.default_model.to_string()),
+ )
+ };
+ if base_url.is_empty() || model.is_empty() {
+ continue;
+ }
+ return Some(EndpointPlan {
+ provider: p.id,
+ base_url,
+ wire,
+ model,
+ key_src: key_present.then_some(m.env),
+ });
+ }
+ None
+}
+
+fn endpoint_wire_of(harness: &str) -> Option<&'static str> {
+ ENDPOINT_HARNESSES
+ .iter()
+ .find(|(h, _)| *h == harness)
+ .map(|(_, w)| *w)
+}
diff --git a/libs/cua/crates/cua-connections/src/generate.rs b/libs/cua/crates/cua-connections/src/generate.rs
new file mode 100644
index 0000000000..27c4184dd9
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/generate.rs
@@ -0,0 +1,473 @@
+//! The generator: provider files in, every table and doc out.
+//!
+//! [`render`] returns every generated file (path relative to the repository
+//! root, contents), [`write`] writes them and [`check`] compares them with
+//! the tree. The gate is a test (`tests/generated.rs`) as well as the binary's
+//! `--check`, so a stale file fails `cargo nextest` and the pre-push script.
+
+use std::collections::BTreeMap;
+use std::path::{Path, PathBuf};
+
+use crate::schema::{ProviderDef, load_dir};
+use crate::{ENDPOINT_HARNESSES, HARNESS_IDS, MethodKind};
+
+/// Where the provider files live, relative to the repository root.
+pub const PROVIDERS_DIR: &str = "libs/cua/crates/cua-connections/providers";
+/// The generated Rust tables.
+pub const RUST_OUT: &str = "libs/cua/crates/cua-connections/src/generated.rs";
+/// The registry as JSON: the parity data the web and SwiftUI apps test against.
+pub const JSON_OUT: &str = "libs/cua/crates/cua-connections/generated/providers.json";
+/// The web app's copy (ids, names, icons, tiers, aliases).
+pub const TS_OUT: &str = "apps/cua-spaces-web/src/bridge/generated/providers.ts";
+/// The SwiftUI app's copy.
+pub const SWIFT_OUT: &str =
+ "apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ProviderRegistry.generated.swift";
+/// The docs page that carries the generated provider table.
+pub const DOCS_PAGE: &str = "docs/content/docs/spaces/guides/connections.mdx";
+/// The markers around the generated table in [`DOCS_PAGE`].
+pub const DOCS_START: &str = "{/* providers:start (generated by cua-connections-gen) */}";
+pub const DOCS_END: &str = "{/* providers:end */}";
+
+/// The repository root, from this crate's manifest directory.
+pub fn repo_root() -> PathBuf {
+ Path::new(env!("CARGO_MANIFEST_DIR"))
+ .join("../../../..")
+ .canonicalize()
+ .expect("the crate sits in the repository")
+}
+
+const RUST_HEADER: &str = "// Generated by `cargo run -p cua-connections --bin cua-connections-gen` from\n\
+// providers/*.toml. Do not edit: change a provider file and run the generator.\n\
+// `--check` (and tests/generated.rs) fail when this file is stale.\n\n";
+
+fn s(x: &str) -> String {
+ format!("{x:?}")
+}
+
+fn list(items: &[String]) -> String {
+ if items.is_empty() {
+ "&[]".into()
+ } else {
+ format!(
+ "&[{}]",
+ items.iter().map(|i| s(i)).collect::<Vec<_>>().join(", ")
+ )
+ }
+}
+
+fn const_name(harness: &str) -> String {
+ format!("READS_{}", harness.replace('-', "_").to_ascii_uppercase())
+}
+
+/// The names `harness` reads, in rank order, from the visible providers.
+fn reads(all: &[ProviderDef], harness: &str) -> Vec<String> {
+ let mut v: Vec<String> = vec![];
+ for p in all.iter().filter(|p| !p.hidden && !p.terms_review()) {
+ if let Some(entries) = p.delivery.get(harness) {
+ for raw in entries {
+ let (dest, _) = ProviderDef::entry(raw);
+ if !v.iter().any(|x| x == dest) {
+ v.push(dest.to_string());
+ }
+ }
+ }
+ }
+ v
+}
+
+fn rust(all: &[ProviderDef]) -> String {
+ let mut o = String::from(RUST_HEADER);
+ o.push_str("use crate::{Check, Delivery, Entry, Field, Kind, Method, MethodKind, Provider, Region, Tier};\n\n");
+ o.push_str("/// Every provider, in rank order (hidden ones included).\n");
+ o.push_str("pub static PROVIDERS: &[Provider] = &[\n");
+ for p in all {
+ o.push_str(" Provider {\n");
+ o.push_str(&format!(" id: {},\n", s(&p.id)));
+ o.push_str(&format!(" name: {},\n", s(&p.name)));
+ let icon = if p.icon.is_empty() { &p.id } else { &p.icon };
+ o.push_str(&format!(" icon: {},\n", s(icon)));
+ o.push_str(&format!(
+ " tier: Tier::{},\n",
+ if p.tier == "top" { "Top" } else { "More" }
+ ));
+ o.push_str(&format!(" rank: {},\n", p.rank));
+ let kind = match p.kind.as_str() {
+ "hosted" => "Hosted",
+ "aggregator" => "Aggregator",
+ "local" => "Local",
+ "custom" => "Custom",
+ _ => "Cloud",
+ };
+ o.push_str(&format!(" kind: Kind::{kind},\n"));
+ o.push_str(&format!(" hidden: {},\n", p.hidden));
+ o.push_str(&format!(
+ " hidden_reason: {},\n",
+ s(&p.hidden_reason)
+ ));
+ o.push_str(&format!(" terms_review: {},\n", p.terms_review()));
+ o.push_str(&format!(" aliases: {},\n", list(&p.aliases)));
+ o.push_str(&format!(" wire: {},\n", s(&p.wire)));
+ o.push_str(&format!(" also_wires: {},\n", list(&p.also_wires)));
+ o.push_str(&format!(" base_url: {},\n", s(&p.base_url)));
+ o.push_str(&format!(" base_url_env: {},\n", s(&p.base_url_env)));
+ o.push_str(&format!(
+ " default_model: {},\n",
+ s(&p.default_model)
+ ));
+ o.push_str(&format!(" hermes_id: {},\n", s(&p.hermes_id)));
+ o.push_str(&format!(" key_help: {},\n", s(&p.key_help)));
+ o.push_str(&format!(" placeholder: {},\n", s(&p.placeholder)));
+ match &p.check {
+ Some(c) => o.push_str(&format!(
+ " check: Some(Check {{ path: {}, auth: {} }}),\n",
+ s(&c.path),
+ s(&c.auth)
+ )),
+ None => o.push_str(" check: None,\n"),
+ }
+ o.push_str(&format!(" apps: {},\n", list(&p.apps)));
+ o.push_str(" methods: &[\n");
+ for m in &p.method {
+ let kind = MethodKind::parse(&m.kind).expect("checked");
+ let kind = format!("{kind:?}");
+ o.push_str(" Method {\n");
+ o.push_str(&format!(" id: {},\n", s(&m.id)));
+ o.push_str(&format!(" kind: MethodKind::{kind},\n"));
+ o.push_str(&format!(" env: {},\n", s(&m.env)));
+ o.push_str(&format!(" aliases: {},\n", list(&m.aliases)));
+ o.push_str(&format!(" scope: {},\n", s(&m.scope)));
+ o.push_str(&format!(" app: {},\n", s(&m.app)));
+ o.push_str(&format!(" flow: {},\n", s(&m.flow)));
+ o.push_str(&format!(" label: {},\n", s(&m.label)));
+ o.push_str(&format!(" help: {},\n", s(&m.help)));
+ o.push_str(&format!(
+ " terms_review: {},\n",
+ m.terms == "review"
+ ));
+ o.push_str(&format!(
+ " secret_optional: {},\n",
+ m.secret == "optional"
+ ));
+ o.push_str(" fields: &[\n");
+ for f in &m.field {
+ o.push_str(&format!(
+ " Field {{ id: {}, label: {}, kind: {}, placeholder: {}, required: {}, options: {} }},\n",
+ s(&f.id),
+ s(&f.label),
+ s(&f.kind),
+ s(&f.placeholder),
+ f.required,
+ list(&f.options)
+ ));
+ }
+ o.push_str(" ],\n },\n");
+ }
+ o.push_str(" ],\n regions: &[\n");
+ for r in &p.region {
+ o.push_str(&format!(
+ " Region {{ id: {}, name: {}, base_url: {} }},\n",
+ s(&r.id),
+ s(&r.name),
+ s(&r.base_url)
+ ));
+ }
+ o.push_str(" ],\n delivery: &[\n");
+ for (h, entries) in &p.delivery {
+ o.push_str(&format!(
+ " Delivery {{ harness: {}, entries: &[",
+ s(h)
+ ));
+ for raw in entries {
+ let (d, src) = ProviderDef::entry(raw);
+ o.push_str(&format!("Entry {{ dest: {}, src: {} }}, ", s(d), s(src)));
+ }
+ o.push_str("] },\n");
+ }
+ o.push_str(" ],\n },\n");
+ }
+ o.push_str("];\n\n");
+ o.push_str(
+ "/// The names each app reads from saved connections, in rank order (visible providers).\n",
+ );
+ for h in HARNESS_IDS {
+ o.push_str(&format!(
+ "pub const {}: &[&str] = {};\n",
+ const_name(h),
+ list(&reads(all, h))
+ ));
+ }
+ o.push_str("\n/// [`READS_*`](READS_CLAUDE_CODE) by harness id.\npub const READS: &[(&str, &[&str])] = &[\n");
+ for h in HARNESS_IDS {
+ o.push_str(&format!(" ({}, {}),\n", s(h), const_name(h)));
+ }
+ o.push_str("];\n\n");
+ let ids: Vec<String> = all
+ .iter()
+ .filter(|p| !p.hidden && !p.terms_review())
+ .map(|p| p.id.clone())
+ .collect();
+ o.push_str("/// The ids `cua connections add` takes (visible providers).\n");
+ o.push_str(&format!(
+ "pub const PROVIDER_IDS: &[&str] = {};\n\n",
+ list(&ids)
+ ));
+ o.push_str("/// The text under `cua connections add --help`.\n");
+ o.push_str(&format!(
+ "pub const CLI_PROVIDER_HELP: &str = {};\n",
+ s(&cli_help(all))
+ ));
+ o
+}
+
+/// The provider list for `cua connections add --help`.
+pub fn cli_help(all: &[ProviderDef]) -> String {
+ let mut o = String::from("Providers:\n");
+ let vis: Vec<&ProviderDef> = all
+ .iter()
+ .filter(|p| !p.hidden && !p.terms_review())
+ .collect();
+ let w = vis.iter().map(|p| p.id.len()).max().unwrap_or(0);
+ for p in &vis {
+ o.push_str(&format!(" {:<w$} {}\n", p.id, p.name));
+ }
+ o.push_str("\nMethods: key (an API key read from stdin), import (the sign-in another app made on this machine), login (a code sign-in), endpoint (a base URL).\n");
+ o
+}
+
+fn json(all: &[ProviderDef]) -> String {
+ let rows: Vec<serde_json::Value> = all
+ .iter()
+ .map(|p| {
+ serde_json::json!({
+ "id": p.id,
+ "name": p.name,
+ "icon": if p.icon.is_empty() { &p.id } else { &p.icon },
+ "tier": p.tier,
+ "rank": p.rank,
+ "kind": p.kind,
+ "hidden": p.hidden || p.terms_review(),
+ "aliases": p.aliases,
+ "wire": p.wire,
+ "alsoWires": p.also_wires,
+ "hermesId": p.hermes_id,
+ "regions": p.region.iter().map(|r| r.id.clone()).collect::<Vec<_>>(),
+ "methods": p.method.iter().filter(|m| m.terms != "review").map(|m| serde_json::json!({
+ "id": m.id, "kind": m.kind, "scope": m.scope,
+ })).collect::<Vec<_>>(),
+ "delivery": p.delivery.iter().map(|(h, e)| (h.clone(), serde_json::json!(e))).collect::<serde_json::Map<_, _>>(),
+ })
+ })
+ .collect();
+ let mut t = serde_json::to_string_pretty(&serde_json::json!({
+ "harnesses": HARNESS_IDS,
+ "methodKinds": MethodKind::ALL.iter().map(|k| k.word()).collect::<Vec<_>>(),
+ "providers": rows,
+ }))
+ .expect("json");
+ t.push('\n');
+ t
+}
+
+fn ts(all: &[ProviderDef]) -> String {
+ let mut o = String::from(
+ "// SPDX-License-Identifier: FSL-1.1-MIT\n// Copyright (c) 2026 Cua AI, Inc.\n\n\
+ // Generated by `cargo run -p cua-connections --bin cua-connections-gen` from\n\
+ // libs/cua/crates/cua-connections/providers/*.toml. Do not edit.\n\n",
+ );
+ o.push_str("export interface ProviderEntry {\n id: string;\n name: string;\n icon: string;\n tier: \"top\" | \"more\";\n aliases: string[];\n /** The variable a key for it is saved as. */\n keyEnv: string;\n}\n\n");
+ o.push_str("/** The providers a person can see, in rank order. */\nexport const PROVIDER_REGISTRY: ProviderEntry[] = [\n");
+ for p in all.iter().filter(|p| !p.hidden && !p.terms_review()) {
+ let icon = if p.icon.is_empty() { &p.id } else { &p.icon };
+ let key_env = p
+ .method
+ .iter()
+ .find(|m| matches!(m.kind.as_str(), "api_key" | "custom_endpoint"))
+ .map(|m| m.env.as_str())
+ .unwrap_or_default();
+ o.push_str(&format!(
+ " {{ id: {}, name: {}, icon: {}, tier: {}, aliases: {}, keyEnv: {} }},\n",
+ s(&p.id),
+ s(&p.name),
+ s(icon),
+ s(&p.tier),
+ serde_json::to_string(&p.aliases)
+ .expect("json")
+ .replace(',', ", "),
+ s(key_env)
+ ));
+ }
+ o.push_str("];\n\n/** The kinds of way to connect a provider (a closed set). */\nexport const METHOD_KINDS = [");
+ o.push_str(
+ &MethodKind::ALL
+ .iter()
+ .map(|k| s(k.word()))
+ .collect::<Vec<_>>()
+ .join(", "),
+ );
+ o.push_str("] as const;\n");
+ o
+}
+
+fn swift(all: &[ProviderDef]) -> String {
+ let mut o = String::from(
+ "// SPDX-License-Identifier: FSL-1.1-MIT\n// Copyright (c) 2026 Cua AI, Inc.\n\n\
+ // Generated by `cargo run -p cua-connections --bin cua-connections-gen` from\n\
+ // libs/cua/crates/cua-connections/providers/*.toml. Do not edit.\n\n\
+ /// The providers a person can see, in rank order, as the app core lists them.\n\
+ public enum ProviderRegistry {\n public static let ids: [String] = [\n",
+ );
+ for p in all.iter().filter(|p| !p.hidden && !p.terms_review()) {
+ o.push_str(&format!(" {},\n", s(&p.id)));
+ }
+ o.push_str(" ]\n\n public static let methodKinds: [String] = [\n");
+ for k in MethodKind::ALL {
+ o.push_str(&format!(" {},\n", s(k.word())));
+ }
+ o.push_str(" ]\n}\n");
+ o
+}
+
+/// The provider table for the docs page (prose page, one table).
+pub fn docs_table(all: &[ProviderDef]) -> String {
+ let mut o = String::from("| Provider | How to connect | Works with |\n| --- | --- | --- |\n");
+ for p in all.iter().filter(|p| !p.hidden && !p.terms_review()) {
+ let mut how: Vec<&str> = vec![];
+ for m in p.method.iter().filter(|m| m.terms != "review") {
+ let word = match (m.kind.as_str(), m.flow.as_str()) {
+ ("api_key", _) => "API key",
+ ("import_login", "paste") => "A pasted Claude token",
+ ("import_login", _) => "Your sign-in on this machine",
+ ("device_code" | "subscription_login", _) => "Plan sign-in",
+ ("browser_oauth", _) => "Browser sign-in",
+ ("adc", _) => "Cloud credentials",
+ ("local_server", _) => "Server URL",
+ _ => "Base URL and key",
+ };
+ if !how.contains(&word) {
+ how.push(word);
+ }
+ }
+ let works = works_with_names(p, all);
+ o.push_str(&format!(
+ "| {} | {} | {} |\n",
+ p.name,
+ how.join(", "),
+ works.join(", ")
+ ));
+ }
+ o
+}
+
+fn harness_name(id: &str) -> &'static str {
+ match id {
+ "claude-code" => "Claude Code",
+ "openai-codex" => "Codex",
+ "gemini-cli" => "Gemini CLI",
+ "google-antigravity" => "Antigravity",
+ "opencode" => "OpenCode",
+ "goose" => "Goose",
+ "pi" => "Pi",
+ "hermes" => "Hermes",
+ "openclaw" => "OpenClaw",
+ _ => "",
+ }
+}
+
+fn app_name(id: &str) -> &'static str {
+ match id {
+ "copilot-cli" => "GitHub Copilot CLI",
+ "t3code" => "T3 Code",
+ _ => "",
+ }
+}
+
+/// The same chips the app shows, for the docs (computed from the definition:
+/// delivery entries, then the endpoint apps whose wire the provider serves).
+fn works_with_names(p: &ProviderDef, _all: &[ProviderDef]) -> Vec<String> {
+ let mut v: Vec<String> = vec![];
+ for h in HARNESS_IDS {
+ let native = p.delivery.get(*h).is_some_and(|e| !e.is_empty());
+ let has_any = p.delivery.contains_key(*h);
+ let wire = ENDPOINT_HARNESSES
+ .iter()
+ .find(|(x, _)| x == h)
+ .map(|(_, w)| *w);
+ let overlap = wire.is_some_and(|w| p.wire == w || p.also_wires.iter().any(|a| a == w))
+ && (p.kind == "custom" || (!p.base_url.is_empty() && !p.default_model.is_empty()));
+ if native || (!has_any && overlap) {
+ v.push(harness_name(h).to_string());
+ }
+ }
+ for a in &p.apps {
+ v.push(app_name(a).to_string());
+ }
+ v
+}
+
+/// Replaces the generated region of the docs page with `table`.
+pub fn splice_docs(page: &str, table: &str) -> Result<String, String> {
+ let a = page
+ .find(DOCS_START)
+ .ok_or_else(|| format!("{DOCS_PAGE} lacks the {DOCS_START} marker"))?;
+ let b = page
+ .find(DOCS_END)
+ .ok_or_else(|| format!("{DOCS_PAGE} lacks the {DOCS_END} marker"))?;
+ if b < a {
+ return Err("the docs markers are in the wrong order".into());
+ }
+ Ok(format!(
+ "{}{}\n\n{}\n{}{}",
+ &page[..a],
+ DOCS_START,
+ table,
+ DOCS_END,
+ &page[b + DOCS_END.len()..]
+ ))
+}
+
+/// Every generated file for the files under `root`.
+pub fn render(root: &Path) -> Result<BTreeMap<String, String>, String> {
+ let all = load_dir(&root.join(PROVIDERS_DIR))?;
+ let mut out = BTreeMap::new();
+ out.insert(RUST_OUT.to_string(), rust(&all));
+ out.insert(JSON_OUT.to_string(), json(&all));
+ out.insert(TS_OUT.to_string(), ts(&all));
+ out.insert(SWIFT_OUT.to_string(), swift(&all));
+ let page =
+ std::fs::read_to_string(root.join(DOCS_PAGE)).map_err(|e| format!("{DOCS_PAGE}: {e}"))?;
+ out.insert(
+ DOCS_PAGE.to_string(),
+ splice_docs(&page, &docs_table(&all))?,
+ );
+ Ok(out)
+}
+
+/// Writes the generated files under `root`.
+pub fn write(root: &Path) -> Result<Vec<String>, String> {
+ let files = render(root)?;
+ let mut changed = vec![];
+ for (rel, text) in files {
+ let path = root.join(&rel);
+ if std::fs::read_to_string(&path).ok().as_deref() == Some(text.as_str()) {
+ continue;
+ }
+ if let Some(dir) = path.parent() {
+ std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+ }
+ std::fs::write(&path, text).map_err(|e| format!("{rel}: {e}"))?;
+ changed.push(rel);
+ }
+ Ok(changed)
+}
+
+/// The generated files that differ from the tree (empty: current).
+pub fn check(root: &Path) -> Result<Vec<String>, String> {
+ let files = render(root)?;
+ Ok(files
+ .into_iter()
+ .filter(|(rel, text)| {
+ std::fs::read_to_string(root.join(rel)).ok().as_deref() != Some(text.as_str())
+ })
+ .map(|(rel, _)| rel)
+ .collect())
+}
diff --git a/libs/cua/crates/cua-connections/src/generated.rs b/libs/cua/crates/cua-connections/src/generated.rs
new file mode 100644
index 0000000000..a0fb75468e
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/generated.rs
@@ -0,0 +1,1862 @@
+// Generated by `cargo run -p cua-connections --bin cua-connections-gen` from
+// providers/*.toml. Do not edit: change a provider file and run the generator.
+// `--check` (and tests/generated.rs) fail when this file is stale.
+
+use crate::{Check, Delivery, Entry, Field, Kind, Method, MethodKind, Provider, Region, Tier};
+
+/// Every provider, in rank order (hidden ones included).
+pub static PROVIDERS: &[Provider] = &[
+ Provider {
+ id: "anthropic",
+ name: "Anthropic",
+ icon: "anthropic",
+ tier: Tier::Top,
+ rank: 10,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &[],
+ wire: "anthropic",
+ also_wires: &[],
+ base_url: "https://api.anthropic.com",
+ base_url_env: "",
+ default_model: "claude-sonnet-5",
+ hermes_id: "anthropic",
+ key_help: "Create a key at console.anthropic.com. Every app that uses Claude can use it.",
+ placeholder: "sk-ant-…",
+ check: Some(Check { path: "/v1/models?limit=1", auth: "x-api-key" }),
+ apps: &["t3code"],
+ methods: &[
+ Method {
+ id: "claude-login",
+ kind: MethodKind::ImportLogin,
+ env: "CLAUDE_CODE_OAUTH_TOKEN",
+ aliases: &[],
+ scope: "claude-code",
+ app: "claude-code",
+ flow: "",
+ label: "Use your Claude Code sign-in",
+ help: "Reads the sign-in Claude Code already has on this machine. Uses your Claude plan. Only Claude Code uses it.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ Method {
+ id: "claude-token",
+ kind: MethodKind::ImportLogin,
+ env: "CLAUDE_CODE_OAUTH_TOKEN",
+ aliases: &[],
+ scope: "claude-code",
+ app: "claude-code",
+ flow: "paste",
+ label: "Paste a Claude token",
+ help: "Advanced. A token made by running claude setup-token in Terminal. It lasts a year. Only Claude Code uses it.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "ANTHROPIC_API_KEY",
+ aliases: &["ANTHROPIC_AUTH_TOKEN"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "claude-code", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, Entry { dest: "CLAUDE_CODE_OAUTH_TOKEN", src: "CLAUDE_CODE_OAUTH_TOKEN" }, Entry { dest: "ANTHROPIC_AUTH_TOKEN", src: "ANTHROPIC_AUTH_TOKEN" }, ] },
+ Delivery { harness: "goose", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, ] },
+ Delivery { harness: "hermes", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, ] },
+ Delivery { harness: "openclaw", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, ] },
+ Delivery { harness: "opencode", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, ] },
+ Delivery { harness: "pi", entries: &[Entry { dest: "ANTHROPIC_API_KEY", src: "ANTHROPIC_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "openai",
+ name: "OpenAI",
+ icon: "openai",
+ tier: Tier::Top,
+ rank: 20,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &[],
+ wire: "openai-responses",
+ also_wires: &["openai-chat"],
+ base_url: "https://api.openai.com/v1",
+ base_url_env: "",
+ default_model: "gpt-5.5",
+ hermes_id: "openai-api",
+ key_help: "Create a key at platform.openai.com. Every app that uses OpenAI can use it.",
+ placeholder: "sk-…",
+ check: Some(Check { path: "/models", auth: "bearer" }),
+ apps: &["t3code"],
+ methods: &[
+ Method {
+ id: "chatgpt-login",
+ kind: MethodKind::SubscriptionLogin,
+ env: "CODEX_AUTH_JSON",
+ aliases: &[],
+ scope: "openai-codex",
+ app: "codex",
+ flow: "device_code",
+ label: "Sign in with ChatGPT",
+ help: "Shows a code to enter on openai.com. It uses your ChatGPT plan and only Codex uses it.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "OPENAI_API_KEY",
+ aliases: &["CODEX_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "goose", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, ] },
+ Delivery { harness: "hermes", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, ] },
+ Delivery { harness: "openai-codex", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, Entry { dest: "CODEX_API_KEY", src: "CODEX_API_KEY" }, Entry { dest: "CODEX_AUTH_JSON", src: "CODEX_AUTH_JSON" }, ] },
+ Delivery { harness: "openclaw", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, ] },
+ Delivery { harness: "opencode", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, ] },
+ Delivery { harness: "pi", entries: &[Entry { dest: "OPENAI_API_KEY", src: "OPENAI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "openrouter",
+ name: "OpenRouter",
+ icon: "openrouter",
+ tier: Tier::Top,
+ rank: 30,
+ kind: Kind::Aggregator,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &[],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://openrouter.ai/api/v1",
+ base_url_env: "",
+ default_model: "anthropic/claude-sonnet-5",
+ hermes_id: "openrouter",
+ key_help: "Create a key at openrouter.ai/keys. Every app that uses OpenRouter can use it.",
+ placeholder: "sk-or-…",
+ check: Some(Check { path: "/auth/key", auth: "bearer" }),
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "OPENROUTER_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "goose", entries: &[Entry { dest: "OPENROUTER_API_KEY", src: "OPENROUTER_API_KEY" }, ] },
+ Delivery { harness: "hermes", entries: &[Entry { dest: "OPENROUTER_API_KEY", src: "OPENROUTER_API_KEY" }, ] },
+ Delivery { harness: "openclaw", entries: &[Entry { dest: "OPENROUTER_API_KEY", src: "OPENROUTER_API_KEY" }, ] },
+ Delivery { harness: "opencode", entries: &[Entry { dest: "OPENROUTER_API_KEY", src: "OPENROUTER_API_KEY" }, ] },
+ Delivery { harness: "pi", entries: &[Entry { dest: "OPENROUTER_API_KEY", src: "OPENROUTER_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "google",
+ name: "Google AI Studio",
+ icon: "google",
+ tier: Tier::Top,
+ rank: 40,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["gemini", "google ai", "aistudio"],
+ wire: "gemini",
+ also_wires: &[],
+ base_url: "https://generativelanguage.googleapis.com/v1beta",
+ base_url_env: "",
+ default_model: "gemini-3.8-flash",
+ hermes_id: "gemini",
+ key_help: "Create a key at aistudio.google.com/apikey. Every app that uses Gemini can use it.",
+ placeholder: "AIza…",
+ check: Some(Check { path: "/models", auth: "x-goog-api-key" }),
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "GEMINI_API_KEY",
+ aliases: &["GOOGLE_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "gemini-cli", entries: &[Entry { dest: "GEMINI_API_KEY", src: "GEMINI_API_KEY" }, Entry { dest: "GOOGLE_API_KEY", src: "GOOGLE_API_KEY" }, ] },
+ Delivery { harness: "google-antigravity", entries: &[Entry { dest: "GEMINI_API_KEY", src: "GEMINI_API_KEY" }, ] },
+ Delivery { harness: "goose", entries: &[Entry { dest: "GOOGLE_API_KEY", src: "GOOGLE_API_KEY" }, Entry { dest: "GOOGLE_API_KEY", src: "GEMINI_API_KEY" }, ] },
+ Delivery { harness: "hermes", entries: &[Entry { dest: "GEMINI_API_KEY", src: "GEMINI_API_KEY" }, ] },
+ Delivery { harness: "opencode", entries: &[Entry { dest: "GEMINI_API_KEY", src: "GEMINI_API_KEY" }, ] },
+ Delivery { harness: "pi", entries: &[Entry { dest: "GEMINI_API_KEY", src: "GEMINI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "xai",
+ name: "xAI",
+ icon: "xai",
+ tier: Tier::Top,
+ rank: 50,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["grok"],
+ wire: "openai-responses",
+ also_wires: &["openai-chat"],
+ base_url: "https://api.x.ai/v1",
+ base_url_env: "",
+ default_model: "grok-4.6",
+ hermes_id: "xai",
+ key_help: "Create a key at console.x.ai. Every app that uses Grok can use it.",
+ placeholder: "xai-…",
+ check: Some(Check { path: "/models", auth: "bearer" }),
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "XAI_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "XAI_API_KEY", src: "XAI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "deepseek",
+ name: "DeepSeek",
+ icon: "deepseek",
+ tier: Tier::Top,
+ rank: 60,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &[],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.deepseek.com/v1",
+ base_url_env: "",
+ default_model: "deepseek-flash",
+ hermes_id: "deepseek",
+ key_help: "Create a key at platform.deepseek.com. Every app that uses DeepSeek can use it.",
+ placeholder: "sk-…",
+ check: Some(Check { path: "/models", auth: "bearer" }),
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "DEEPSEEK_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "DEEPSEEK_API_KEY", src: "DEEPSEEK_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "kimi",
+ name: "Kimi (Moonshot)",
+ icon: "kimi",
+ tier: Tier::Top,
+ rank: 70,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["moonshot", "kimi code"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.moonshot.ai/v1",
+ base_url_env: "",
+ default_model: "kimi-k3",
+ hermes_id: "kimi-coding",
+ key_help: "Create a key at platform.moonshot.ai, or a Kimi Code key (sk-kimi-). Every app that uses Kimi can use it.",
+ placeholder: "sk-…",
+ check: Some(Check { path: "/models", auth: "bearer" }),
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "KIMI_API_KEY",
+ aliases: &["KIMI_CODING_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "KIMI_API_KEY", src: "KIMI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "github",
+ name: "GitHub Copilot",
+ icon: "github",
+ tier: Tier::More,
+ rank: 80,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["copilot", "github copilot cli"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.githubcopilot.com",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "",
+ key_help: "Create a fine-grained token with the Copilot Requests permission at github.com/settings/tokens.",
+ placeholder: "github_pat_…",
+ check: None,
+ apps: &["copilot-cli"],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "COPILOT_GITHUB_TOKEN",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "huggingface",
+ name: "Hugging Face",
+ icon: "huggingface",
+ tier: Tier::More,
+ rank: 100,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["hf"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://router.huggingface.co/v1",
+ base_url_env: "HF_BASE_URL",
+ default_model: "moonshotai/Kimi-K2.5",
+ hermes_id: "huggingface",
+ key_help: "Create a token at huggingface.co/settings/tokens with the Inference Providers permission.",
+ placeholder: "hf_…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "HF_TOKEN",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "HF_TOKEN", src: "HF_TOKEN" }, ] },
+ ],
+ },
+ Provider {
+ id: "zai",
+ name: "Z.AI (GLM)",
+ icon: "zai",
+ tier: Tier::More,
+ rank: 110,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["glm", "zhipu", "z.ai"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.z.ai/api/paas/v4",
+ base_url_env: "GLM_BASE_URL",
+ default_model: "glm-5.3",
+ hermes_id: "zai",
+ key_help: "Create a key at z.ai. Pick the plan the key belongs to: they bill separately.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "GLM_API_KEY",
+ aliases: &["ZAI_API_KEY", "Z_AI_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ Region { id: "global", name: "Global", base_url: "https://api.z.ai/api/paas/v4" },
+ Region { id: "cn", name: "China", base_url: "https://open.bigmodel.cn/api/paas/v4" },
+ Region { id: "coding-global", name: "Global, Coding Plan", base_url: "https://api.z.ai/api/coding/paas/v4" },
+ Region { id: "coding-cn", name: "China, Coding Plan", base_url: "https://open.bigmodel.cn/api/coding/paas/v4" },
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "GLM_API_KEY", src: "GLM_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "fireworks",
+ name: "Fireworks AI",
+ icon: "fireworks",
+ tier: Tier::More,
+ rank: 120,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["fw"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.fireworks.ai/inference/v1",
+ base_url_env: "",
+ default_model: "accounts/fireworks/models/kimi-k2p6",
+ hermes_id: "fireworks",
+ key_help: "Create a key at fireworks.ai.",
+ placeholder: "fw_…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "FIREWORKS_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "FIREWORKS_API_KEY", src: "FIREWORKS_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "nvidia",
+ name: "NVIDIA NIM",
+ icon: "nvidia",
+ tier: Tier::More,
+ rank: 130,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["nim", "nemotron", "build.nvidia.com"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://integrate.api.nvidia.com/v1",
+ base_url_env: "NVIDIA_BASE_URL",
+ default_model: "nvidia/nemotron-3-ultra-550b-a55b",
+ hermes_id: "nvidia",
+ key_help: "Create a key at build.nvidia.com.",
+ placeholder: "nvapi-…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "NVIDIA_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "NVIDIA_API_KEY", src: "NVIDIA_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "ollama-cloud",
+ name: "Ollama Cloud",
+ icon: "ollama-cloud",
+ tier: Tier::More,
+ rank: 140,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["ollama"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://ollama.com/v1",
+ base_url_env: "OLLAMA_BASE_URL",
+ default_model: "",
+ hermes_id: "ollama-cloud",
+ key_help: "Create a key at ollama.com/settings. For a server on your own machine use Custom endpoint.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "OLLAMA_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "OLLAMA_API_KEY", src: "OLLAMA_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "deepinfra",
+ name: "DeepInfra",
+ icon: "deepinfra",
+ tier: Tier::More,
+ rank: 150,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["deep infra"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.deepinfra.com/v1/openai",
+ base_url_env: "DEEPINFRA_BASE_URL",
+ default_model: "",
+ hermes_id: "deepinfra",
+ key_help: "Create a key at deepinfra.com.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "DEEPINFRA_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "DEEPINFRA_API_KEY", src: "DEEPINFRA_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "novita",
+ name: "Novita AI",
+ icon: "novita",
+ tier: Tier::More,
+ rank: 160,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["novitaai"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.novita.ai/openai/v1",
+ base_url_env: "NOVITA_BASE_URL",
+ default_model: "moonshotai/kimi-k2.5",
+ hermes_id: "novita",
+ key_help: "Create a key at novita.ai.",
+ placeholder: "sk_…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "NOVITA_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "NOVITA_API_KEY", src: "NOVITA_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "nebius-token-factory",
+ name: "Nebius Token Factory",
+ icon: "nebius-token-factory",
+ tier: Tier::More,
+ rank: 170,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["nebius"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.tokenfactory.nebius.com/v1",
+ base_url_env: "NEBIUS_BASE_URL",
+ default_model: "Qwen/Qwen3.5-397B-A17B-fast",
+ hermes_id: "nebius-token-factory",
+ key_help: "Create a key at tokenfactory.nebius.com.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "NEBIUS_API_KEY",
+ aliases: &["NEBIUS_TOKEN_FACTORY_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "NEBIUS_API_KEY", src: "NEBIUS_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "gmi",
+ name: "GMI Cloud",
+ icon: "gmi",
+ tier: Tier::More,
+ rank: 180,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["gmicloud"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.gmi-serving.com/v1",
+ base_url_env: "GMI_BASE_URL",
+ default_model: "zai-org/GLM-5.1-FP8",
+ hermes_id: "gmi",
+ key_help: "Create a key at gmicloud.ai.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "GMI_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "GMI_API_KEY", src: "GMI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "upstage",
+ name: "Upstage Solar",
+ icon: "upstage",
+ tier: Tier::More,
+ rank: 190,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["solar"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.upstage.ai/v1",
+ base_url_env: "UPSTAGE_BASE_URL",
+ default_model: "solar-pro3",
+ hermes_id: "upstage",
+ key_help: "Create a key at console.upstage.ai.",
+ placeholder: "up_…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "UPSTAGE_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "UPSTAGE_API_KEY", src: "UPSTAGE_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "arcee",
+ name: "Arcee AI",
+ icon: "arcee",
+ tier: Tier::More,
+ rank: 200,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["trinity"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.arcee.ai/api/v1",
+ base_url_env: "ARCEE_BASE_URL",
+ default_model: "trinity-large-thinking",
+ hermes_id: "arcee",
+ key_help: "Create a key at chat.arcee.ai.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "ARCEEAI_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "ARCEEAI_API_KEY", src: "ARCEEAI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "ai-gateway",
+ name: "Vercel AI Gateway",
+ icon: "ai-gateway",
+ tier: Tier::More,
+ rank: 210,
+ kind: Kind::Aggregator,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["vercel"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://ai-gateway.vercel.sh/v1",
+ base_url_env: "AI_GATEWAY_BASE_URL",
+ default_model: "anthropic/claude-sonnet-5",
+ hermes_id: "ai-gateway",
+ key_help: "Create a key in the Vercel dashboard under AI Gateway.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "AI_GATEWAY_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "AI_GATEWAY_API_KEY", src: "AI_GATEWAY_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "opencode-zen",
+ name: "OpenCode Zen",
+ icon: "opencode-zen",
+ tier: Tier::More,
+ rank: 220,
+ kind: Kind::Aggregator,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["zen"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://opencode.ai/zen/v1",
+ base_url_env: "OPENCODE_ZEN_BASE_URL",
+ default_model: "x-preview-f-free",
+ hermes_id: "opencode-zen",
+ key_help: "Create a key at opencode.ai/zen.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "OPENCODE_ZEN_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "OPENCODE_ZEN_API_KEY", src: "OPENCODE_ZEN_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "opencode-go",
+ name: "OpenCode Go",
+ icon: "opencode-go",
+ tier: Tier::More,
+ rank: 230,
+ kind: Kind::Aggregator,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["go"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://opencode.ai/zen/go/v1",
+ base_url_env: "OPENCODE_GO_BASE_URL",
+ default_model: "kimi-k3",
+ hermes_id: "opencode-go",
+ key_help: "Create a key at opencode.ai.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "OPENCODE_GO_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "OPENCODE_GO_API_KEY", src: "OPENCODE_GO_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "kilocode",
+ name: "Kilo Code",
+ icon: "kilocode",
+ tier: Tier::More,
+ rank: 240,
+ kind: Kind::Aggregator,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["kilo"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.kilo.ai/api/gateway",
+ base_url_env: "KILOCODE_BASE_URL",
+ default_model: "",
+ hermes_id: "kilocode",
+ key_help: "Create a key at kilo.ai.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "KILOCODE_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "KILOCODE_API_KEY", src: "KILOCODE_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "xiaomi",
+ name: "Xiaomi MiMo",
+ icon: "xiaomi",
+ tier: Tier::More,
+ rank: 250,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["mimo"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.xiaomimimo.com/v1",
+ base_url_env: "XIAOMI_BASE_URL",
+ default_model: "mimo-v2.5-pro",
+ hermes_id: "xiaomi",
+ key_help: "Create a key at platform.xiaomimimo.com.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "XIAOMI_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "XIAOMI_API_KEY", src: "XIAOMI_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "stepfun",
+ name: "StepFun",
+ icon: "stepfun",
+ tier: Tier::More,
+ rank: 260,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["step"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.stepfun.ai/step_plan/v1",
+ base_url_env: "STEPFUN_BASE_URL",
+ default_model: "step-3.5-flash",
+ hermes_id: "stepfun",
+ key_help: "Create a key at platform.stepfun.ai (Step Plan).",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "STEPFUN_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "STEPFUN_API_KEY", src: "STEPFUN_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "minimax",
+ name: "MiniMax",
+ icon: "minimax",
+ tier: Tier::More,
+ rank: 270,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["mini-max"],
+ wire: "anthropic",
+ also_wires: &[],
+ base_url: "https://api.minimax.io/anthropic",
+ base_url_env: "MINIMAX_BASE_URL",
+ default_model: "MiniMax-M3",
+ hermes_id: "minimax",
+ key_help: "Create a key at platform.minimax.io. This is the API key, not the MiniMax sign-in.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "MINIMAX_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "MINIMAX_API_KEY", src: "MINIMAX_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "alibaba",
+ name: "Qwen Cloud (Alibaba)",
+ icon: "alibaba",
+ tier: Tier::More,
+ rank: 280,
+ kind: Kind::Hosted,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["qwen", "dashscope", "alibaba cloud"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
+ base_url_env: "DASHSCOPE_BASE_URL",
+ default_model: "",
+ hermes_id: "alibaba",
+ key_help: "Create a key in Alibaba Cloud Model Studio (DashScope, international).",
+ placeholder: "sk-…",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "DASHSCOPE_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "DASHSCOPE_API_KEY", src: "DASHSCOPE_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "meta-ai",
+ name: "Meta Model API",
+ icon: "meta-ai",
+ tier: Tier::More,
+ rank: 290,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Unverified: Cua has not run this provider end to end yet.",
+ terms_review: false,
+ aliases: &["meta", "muse"],
+ wire: "openai-responses",
+ also_wires: &[],
+ base_url: "https://api.meta.ai/v1",
+ base_url_env: "META_BASE_URL",
+ default_model: "muse-spark-1.2",
+ hermes_id: "meta-ai",
+ key_help: "Create a key at the Meta Model API console.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "MODEL_API_KEY",
+ aliases: &["META_API_KEY", "META_MODEL_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "MODEL_API_KEY", src: "MODEL_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "router",
+ name: "Ramp Router",
+ icon: "router",
+ tier: Tier::More,
+ rank: 300,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Unverified: Cua has not run this provider end to end yet.",
+ terms_review: false,
+ aliases: &["ramp"],
+ wire: "openai-responses",
+ also_wires: &[],
+ base_url: "https://api.router.com/v1",
+ base_url_env: "RAMP_ROUTER_BASE_URL",
+ default_model: "",
+ hermes_id: "router",
+ key_help: "Create a key at router.com.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "RAMP_ROUTER_API_KEY",
+ aliases: &["ROUTER_API_KEY"],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "RAMP_ROUTER_API_KEY", src: "RAMP_ROUTER_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "commandcode",
+ name: "CommandCode",
+ icon: "commandcode",
+ tier: Tier::More,
+ rank: 310,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Unverified: Cua has not run this provider end to end yet.",
+ terms_review: false,
+ aliases: &[],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.commandcode.ai/provider/v1",
+ base_url_env: "COMMANDCODE_BASE_URL",
+ default_model: "deepseek/deepseek-v4-pro",
+ hermes_id: "commandcode",
+ key_help: "Create a key at commandcode.ai.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "COMMANDCODE_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "COMMANDCODE_API_KEY", src: "COMMANDCODE_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "actual",
+ name: "Actual Computer",
+ icon: "actual",
+ tier: Tier::More,
+ rank: 320,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Unverified: Cua has not run this provider end to end yet.",
+ terms_review: false,
+ aliases: &["aci"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://api.actual.inc/v1",
+ base_url_env: "ACTUAL_BASE_URL",
+ default_model: "",
+ hermes_id: "actual",
+ key_help: "Create a key at actual.inc.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "ACTUAL_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "ACTUAL_API_KEY", src: "ACTUAL_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "tencent-tokenhub",
+ name: "Tencent TokenHub",
+ icon: "tencent-tokenhub",
+ tier: Tier::More,
+ rank: 330,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Unverified: Cua has not run this provider end to end yet.",
+ terms_review: false,
+ aliases: &["tencent", "hunyuan"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://tokenhub.tencentmaas.com/v1",
+ base_url_env: "TOKENHUB_BASE_URL",
+ default_model: "",
+ hermes_id: "tencent-tokenhub",
+ key_help: "Create a key in the Tencent TokenHub console.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "key",
+ kind: MethodKind::ApiKey,
+ env: "TOKENHUB_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "TOKENHUB_API_KEY", src: "TOKENHUB_API_KEY" }, ] },
+ ],
+ },
+ Provider {
+ id: "nous",
+ name: "Nous Portal",
+ icon: "nous",
+ tier: Tier::More,
+ rank: 340,
+ kind: Kind::Aggregator,
+ hidden: true,
+ hidden_reason: "Subscription sign-in: Cua has not reviewed the provider's terms for use in a third-party app yet.",
+ terms_review: true,
+ aliases: &["nous research", "hermes"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://inference-api.nousresearch.com/v1",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "nous",
+ key_help: "Sign in with your Nous Portal account.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "portal",
+ kind: MethodKind::DeviceCode,
+ env: "NOUS_API_KEY",
+ aliases: &[],
+ scope: "hermes",
+ app: "",
+ flow: "",
+ label: "Sign in with Nous Portal",
+ help: "Shows a code to enter on the Nous Portal. Only Hermes uses this sign-in.",
+ terms_review: true,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "qwen-oauth",
+ name: "Qwen CLI sign-in",
+ icon: "qwen",
+ tier: Tier::More,
+ rank: 350,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Subscription login: Cua has not reviewed the provider's terms for reusing another app's sign-in yet.",
+ terms_review: true,
+ aliases: &["qwen cli", "qwen code"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "https://portal.qwen.ai/v1",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "qwen-oauth",
+ key_help: "Use the sign-in the Qwen CLI made on this machine.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "qwen-login",
+ kind: MethodKind::ImportLogin,
+ env: "QWEN_API_KEY",
+ aliases: &[],
+ scope: "hermes",
+ app: "",
+ flow: "",
+ label: "Use your Qwen CLI sign-in",
+ help: "Copies the sign-in the Qwen CLI made on this machine. Only Hermes uses it.",
+ terms_review: true,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "minimax-oauth",
+ name: "MiniMax sign-in",
+ icon: "minimax",
+ tier: Tier::More,
+ rank: 360,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Subscription login: Cua has not reviewed the provider's terms for use in a third-party app yet.",
+ terms_review: true,
+ aliases: &["minimax coding plan"],
+ wire: "anthropic",
+ also_wires: &[],
+ base_url: "https://api.minimax.io/anthropic",
+ base_url_env: "",
+ default_model: "MiniMax-M3",
+ hermes_id: "minimax-oauth",
+ key_help: "Sign in with your MiniMax account.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "portal",
+ kind: MethodKind::SubscriptionLogin,
+ env: "",
+ aliases: &[],
+ scope: "hermes",
+ app: "",
+ flow: "",
+ label: "Sign in with MiniMax",
+ help: "Opens MiniMax in your browser. Only Hermes uses this sign-in.",
+ terms_review: true,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "xai-oauth",
+ name: "SuperGrok sign-in",
+ icon: "xai",
+ tier: Tier::More,
+ rank: 370,
+ kind: Kind::Hosted,
+ hidden: true,
+ hidden_reason: "Subscription login: Cua has not reviewed xAI's terms for use in a third-party app yet.",
+ terms_review: true,
+ aliases: &["supergrok", "grok subscription"],
+ wire: "openai-responses",
+ also_wires: &[],
+ base_url: "https://api.x.ai/v1",
+ base_url_env: "",
+ default_model: "grok-4.6",
+ hermes_id: "xai-oauth",
+ key_help: "Sign in with your SuperGrok or X Premium+ account.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "supergrok",
+ kind: MethodKind::SubscriptionLogin,
+ env: "",
+ aliases: &[],
+ scope: "hermes",
+ app: "",
+ flow: "",
+ label: "Sign in with SuperGrok",
+ help: "Shows a code to enter on x.ai. Only Hermes uses this sign-in.",
+ terms_review: true,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "vertex",
+ name: "Google Vertex AI",
+ icon: "google",
+ tier: Tier::More,
+ rank: 380,
+ kind: Kind::Cloud,
+ hidden: true,
+ hidden_reason: "Not built yet: needs the Google sign-in (ADC) method with project and region.",
+ terms_review: false,
+ aliases: &["gcp", "google cloud"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "vertex",
+ key_help: "Use your Google Cloud sign-in with a project and region.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "adc",
+ kind: MethodKind::Adc,
+ env: "",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "Use your Google Cloud sign-in",
+ help: "Uses the application default credentials on this machine.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "bedrock",
+ name: "Amazon Bedrock",
+ icon: "aws",
+ tier: Tier::More,
+ rank: 390,
+ kind: Kind::Cloud,
+ hidden: true,
+ hidden_reason: "Not built yet: needs the AWS credential chain method with a region.",
+ terms_review: false,
+ aliases: &["aws", "amazon"],
+ wire: "bedrock",
+ also_wires: &[],
+ base_url: "https://bedrock-runtime.us-east-1.amazonaws.com",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "bedrock",
+ key_help: "Use your AWS credentials with a region.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "adc",
+ kind: MethodKind::Adc,
+ env: "",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "Use your AWS credentials",
+ help: "Uses the AWS profile or environment on this machine.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "azure-foundry",
+ name: "Azure AI Foundry",
+ icon: "azure",
+ tier: Tier::More,
+ rank: 400,
+ kind: Kind::Cloud,
+ hidden: true,
+ hidden_reason: "Not built yet: needs the Entra ID method with a resource URL.",
+ terms_review: false,
+ aliases: &["azure", "azure openai", "microsoft"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "azure-foundry",
+ key_help: "Use an Azure AI Foundry key with your resource URL.",
+ placeholder: "",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "adc",
+ kind: MethodKind::Adc,
+ env: "",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "Use your Microsoft sign-in",
+ help: "Uses Entra ID on this machine.",
+ terms_review: false,
+ secret_optional: false,
+ fields: &[
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ ],
+ },
+ Provider {
+ id: "custom",
+ name: "Custom endpoint",
+ icon: "custom",
+ tier: Tier::Top,
+ rank: 900,
+ kind: Kind::Custom,
+ hidden: false,
+ hidden_reason: "",
+ terms_review: false,
+ aliases: &["openai compatible", "lm studio", "ollama", "vllm", "llama.cpp", "litellm", "local server", "gateway", "proxy"],
+ wire: "openai-chat",
+ also_wires: &[],
+ base_url: "",
+ base_url_env: "",
+ default_model: "",
+ hermes_id: "custom",
+ key_help: "Any server that speaks the OpenAI chat API: LM Studio, Ollama, vLLM, a gateway or a proxy.",
+ placeholder: "Key, if the server asks for one",
+ check: None,
+ apps: &[],
+ methods: &[
+ Method {
+ id: "endpoint",
+ kind: MethodKind::CustomEndpoint,
+ env: "CUSTOM_ENDPOINT_API_KEY",
+ aliases: &[],
+ scope: "",
+ app: "",
+ flow: "",
+ label: "",
+ help: "",
+ terms_review: false,
+ secret_optional: true,
+ fields: &[
+ Field { id: "base_url", label: "Base URL", kind: "url", placeholder: "http://host:1234/v1", required: true, options: &[] },
+ Field { id: "model", label: "Model", kind: "text", placeholder: "The model id the server serves", required: true, options: &[] },
+ Field { id: "wire", label: "API style", kind: "choice", placeholder: "", required: true, options: &["openai-chat", "openai-responses", "anthropic"] },
+ ],
+ },
+ ],
+ regions: &[
+ ],
+ delivery: &[
+ Delivery { harness: "hermes", entries: &[Entry { dest: "CUSTOM_ENDPOINT_API_KEY", src: "CUSTOM_ENDPOINT_API_KEY" }, ] },
+ ],
+ },
+];
+
+/// The names each app reads from saved connections, in rank order (visible providers).
+pub const READS_CLAUDE_CODE: &[&str] = &["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_AUTH_TOKEN"];
+pub const READS_OPENAI_CODEX: &[&str] = &["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_AUTH_JSON"];
+pub const READS_GEMINI_CLI: &[&str] = &["GEMINI_API_KEY", "GOOGLE_API_KEY"];
+pub const READS_GOOGLE_ANTIGRAVITY: &[&str] = &["GEMINI_API_KEY"];
+pub const READS_OPENCODE: &[&str] = &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "GEMINI_API_KEY"];
+pub const READS_GOOSE: &[&str] = &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "GOOGLE_API_KEY"];
+pub const READS_PI: &[&str] = &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "GEMINI_API_KEY"];
+pub const READS_HERMES: &[&str] = &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "GEMINI_API_KEY", "XAI_API_KEY", "DEEPSEEK_API_KEY", "KIMI_API_KEY", "HF_TOKEN", "GLM_API_KEY", "FIREWORKS_API_KEY", "NVIDIA_API_KEY", "OLLAMA_API_KEY", "DEEPINFRA_API_KEY", "NOVITA_API_KEY", "NEBIUS_API_KEY", "GMI_API_KEY", "UPSTAGE_API_KEY", "ARCEEAI_API_KEY", "AI_GATEWAY_API_KEY", "OPENCODE_ZEN_API_KEY", "OPENCODE_GO_API_KEY", "KILOCODE_API_KEY", "XIAOMI_API_KEY", "STEPFUN_API_KEY", "MINIMAX_API_KEY", "DASHSCOPE_API_KEY", "CUSTOM_ENDPOINT_API_KEY"];
+pub const READS_OPENCLAW: &[&str] = &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY"];
+
+/// [`READS_*`](READS_CLAUDE_CODE) by harness id.
+pub const READS: &[(&str, &[&str])] = &[
+ ("claude-code", READS_CLAUDE_CODE),
+ ("openai-codex", READS_OPENAI_CODEX),
+ ("gemini-cli", READS_GEMINI_CLI),
+ ("google-antigravity", READS_GOOGLE_ANTIGRAVITY),
+ ("opencode", READS_OPENCODE),
+ ("goose", READS_GOOSE),
+ ("pi", READS_PI),
+ ("hermes", READS_HERMES),
+ ("openclaw", READS_OPENCLAW),
+];
+
+/// The ids `cua connections add` takes (visible providers).
+pub const PROVIDER_IDS: &[&str] = &["anthropic", "openai", "openrouter", "google", "xai", "deepseek", "kimi", "github", "huggingface", "zai", "fireworks", "nvidia", "ollama-cloud", "deepinfra", "novita", "nebius-token-factory", "gmi", "upstage", "arcee", "ai-gateway", "opencode-zen", "opencode-go", "kilocode", "xiaomi", "stepfun", "minimax", "alibaba", "custom"];
+
+/// The text under `cua connections add --help`.
+pub const CLI_PROVIDER_HELP: &str = "Providers:\n anthropic Anthropic\n openai OpenAI\n openrouter OpenRouter\n google Google AI Studio\n xai xAI\n deepseek DeepSeek\n kimi Kimi (Moonshot)\n github GitHub Copilot\n huggingface Hugging Face\n zai Z.AI (GLM)\n fireworks Fireworks AI\n nvidia NVIDIA NIM\n ollama-cloud Ollama Cloud\n deepinfra DeepInfra\n novita Novita AI\n nebius-token-factory Nebius Token Factory\n gmi GMI Cloud\n upstage Upstage Solar\n arcee Arcee AI\n ai-gateway Vercel AI Gateway\n opencode-zen OpenCode Zen\n opencode-go OpenCode Go\n kilocode Kilo Code\n xiaomi Xiaomi MiMo\n stepfun StepFun\n minimax MiniMax\n alibaba Qwen Cloud (Alibaba)\n custom Custom endpoint\n\nMethods: key (an API key read from stdin), import (the sign-in another app made on this machine), login (a code sign-in), endpoint (a base URL).\n";
diff --git a/libs/cua/crates/cua-connections/src/hermes.rs b/libs/cua/crates/cua-connections/src/hermes.rs
new file mode 100644
index 0000000000..16ab46b433
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/hermes.rs
@@ -0,0 +1,132 @@
+//! Hermes's `config.yaml`, generated from the Connections.
+//!
+//! Hermes's own `auto` picks a provider by its registry order and borrows the
+//! logins of other CLIs it finds; neither is what the person connected. The
+//! file written here names the provider (and model) explicitly, lists the
+//! other connected providers as fallbacks in the person's order, and turns
+//! `auth.adopt_external_logins` off so Hermes never takes another app's
+//! sign-in. Credentials are not in it: Hermes reads them from the run's
+//! environment under the names the registry delivers.
+
+use crate::{Connected, Provider, provider, visible};
+
+/// One provider Hermes may use, in the order of use.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct Pick {
+ pub provider: &'static Provider,
+ pub region: Option<String>,
+ pub model: String,
+ /// A base URL to set (a plan or region, or a custom endpoint).
+ pub base_url: Option<String>,
+ /// The key is saved (a custom endpoint may have none).
+ pub key: bool,
+}
+
+/// The providers Hermes can use from `connected`: only those that deliver a
+/// variable to it (never a sign-in scoped to another app) and whose key is
+/// saved (`present`), in rank order.
+pub fn select(connected: &[Connected], present: &dyn Fn(&str) -> bool) -> Vec<Pick> {
+ let mut picks = vec![];
+ for p in visible() {
+ let Some(c) = connected.iter().find(|c| c.provider == p.id) else {
+ continue;
+ };
+ let entries = p.delivery_for("hermes");
+ if entries.is_empty() || p.hermes_id.is_empty() {
+ continue;
+ }
+ let key = entries
+ .iter()
+ .filter(|e| p.scope_of(e.src).is_none())
+ .any(|e| present(e.src));
+ let optional = p.key_method().is_some_and(|m| m.secret_optional);
+ if !key && !optional {
+ continue;
+ }
+ let model = c
+ .fields
+ .get("model")
+ .cloned()
+ .unwrap_or_else(|| p.default_model.to_string());
+ let base_url = if p.kind == crate::Kind::Custom {
+ c.fields.get("base_url").cloned()
+ } else {
+ c.region
+ .as_deref()
+ .map(|r| p.base_url_for(Some(r)))
+ .filter(|u| *u != p.base_url)
+ .map(str::to_string)
+ };
+ if p.kind == crate::Kind::Custom && base_url.is_none() {
+ continue;
+ }
+ picks.push(Pick {
+ provider: p,
+ region: c.region.clone(),
+ model,
+ base_url,
+ key,
+ });
+ }
+ picks
+}
+
+fn q(s: &str) -> String {
+ // A JSON string is a valid YAML double-quoted scalar.
+ serde_json::to_string(s).unwrap_or_else(|_| "\"\"".into())
+}
+
+/// The `config.yaml` for `picks` (the first is the provider Hermes uses, the
+/// rest its fallbacks), or `None` when there is nothing to name.
+pub fn config_yaml(picks: &[Pick]) -> Option<String> {
+ let first = picks.first()?;
+ let mut y = String::from(
+ "# Written by Cua from your Connections each time a run starts. Change the\n\
+ # connections in Cua, not this file.\n",
+ );
+ y.push_str("model:\n");
+ y.push_str(&format!(" provider: {}\n", q(first.provider.hermes_id)));
+ if !first.model.is_empty() {
+ y.push_str(&format!(" default: {}\n", q(&first.model)));
+ }
+ if let Some(b) = &first.base_url {
+ y.push_str(&format!(" base_url: {}\n", q(b)));
+ }
+ if first.provider.kind == crate::Kind::Custom {
+ let key = if first.key {
+ "${CUSTOM_ENDPOINT_API_KEY}".to_string()
+ } else {
+ "no-key-required".to_string()
+ };
+ y.push_str(&format!(" api_key: {}\n", q(&key)));
+ y.push_str(" context_length: 131072\n");
+ }
+ let fallbacks: Vec<&Pick> = picks[1..]
+ .iter()
+ .filter(|p| !p.model.is_empty() && p.provider.kind != crate::Kind::Custom)
+ .collect();
+ if fallbacks.is_empty() {
+ y.push_str("fallback_providers: []\n");
+ } else {
+ y.push_str("fallback_providers:\n");
+ for f in fallbacks {
+ y.push_str(&format!(" - provider: {}\n", q(f.provider.hermes_id)));
+ y.push_str(&format!(" model: {}\n", q(&f.model)));
+ if let Some(b) = &f.base_url {
+ y.push_str(&format!(" base_url: {}\n", q(b)));
+ }
+ }
+ }
+ y.push_str("auth:\n adopt_external_logins: false\n");
+ Some(y)
+}
+
+/// The provider ids in `connected` Hermes would use, first to last
+/// (for the app's page and the CLI).
+pub fn order(connected: &[Connected], present: &dyn Fn(&str) -> bool) -> Vec<&'static str> {
+ select(connected, present)
+ .into_iter()
+ .map(|p| p.provider.id)
+ .filter(|id| provider(id).is_some())
+ .collect()
+}
diff --git a/libs/cua/crates/cua-connections/src/lib.rs b/libs/cua/crates/cua-connections/src/lib.rs
new file mode 100644
index 0000000000..ac44a9c97a
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/lib.rs
@@ -0,0 +1,363 @@
+//! The provider registry behind Settings, Connections and `cua connections`.
+//!
+//! One TOML file per provider lives in `providers/`: its id, name, wire, base
+//! URL, regions, the ways to connect it (methods, from a closed set of kinds),
+//! the environment variables each app receives, and a terms flag that keeps a
+//! subscription login out of every UI until it has been reviewed. The
+//! generator (`cargo run -p cua-connections --bin cua-connections-gen`)
+//! turns the files into [`generated`] (the tables everything links), the
+//! parity data the web and SwiftUI apps test against, the CLI help and the
+//! provider table in the docs; `--check` fails when any of them is stale.
+//!
+//! Nothing here touches a credential. [`deliver`] decides which saved
+//! variables reach a run of an app (one place, tested for every provider and
+//! every app), [`works_with`] computes the "works with" chips, and
+//! [`hermes::config_yaml`] writes the config Hermes reads so that the
+//! connected provider is the one it uses.
+
+pub mod delivery;
+pub mod generate;
+pub mod hermes;
+pub mod schema;
+
+#[rustfmt::skip]
+mod generated;
+
+use std::collections::BTreeMap;
+
+pub use delivery::{deliver, endpoint_for, works_with};
+pub use generated::*;
+
+/// Every agent harness a run can use, in the order the Connections page lists
+/// them. `cua-agents` holds a test that this equals its own table.
+pub const HARNESS_IDS: &[&str] = &[
+ "claude-code",
+ "openai-codex",
+ "gemini-cli",
+ "google-antigravity",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes",
+ "openclaw",
+];
+
+/// Harnesses that can be pointed at any endpoint of one wire with a base URL
+/// and a model (their launcher writes the config), with that wire. A provider
+/// that serves the wire and names a default model works with these without a
+/// native key of its own.
+pub const ENDPOINT_HARNESSES: &[(&str, &str)] = &[
+ ("opencode", "openai-chat"),
+ ("goose", "openai-chat"),
+ ("pi", "openai-chat"),
+ ("openclaw", "openai-chat"),
+ ("openai-codex", "openai-responses"),
+];
+
+/// The wires a provider can serve (closed set).
+pub const WIRES: &[&str] = &[
+ "anthropic",
+ "openai-responses",
+ "openai-chat",
+ "gemini",
+ "bedrock",
+];
+
+/// Where a provider shows up.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Tier {
+ /// Up front on the Connections page.
+ Top,
+ /// In the searchable "More providers" list.
+ More,
+}
+
+/// What kind of service a provider is.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Kind {
+ Hosted,
+ Aggregator,
+ Local,
+ Custom,
+ Cloud,
+}
+
+impl Kind {
+ pub fn word(self) -> &'static str {
+ match self {
+ Kind::Hosted => "hosted",
+ Kind::Aggregator => "aggregator",
+ Kind::Local => "local",
+ Kind::Custom => "custom",
+ Kind::Cloud => "cloud",
+ }
+ }
+}
+
+/// The ways to connect a provider: a closed set, each implemented once in
+/// core. The UIs branch on the kind, never on a provider id.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum MethodKind {
+ /// A key the person pastes (or reads from their shell).
+ ApiKey,
+ /// The sign-in another app made on this machine, copied with consent
+ /// (access token only, never refreshed by Cua).
+ ImportLogin,
+ /// A code entered on the provider's page.
+ DeviceCode,
+ /// A browser approval that returns to this machine.
+ BrowserOauth,
+ /// A plan sign-in whose token belongs to one app.
+ SubscriptionLogin,
+ /// The cloud credential chain on this machine (Google, AWS, Entra).
+ Adc,
+ /// A server on a machine of the person's, by URL.
+ LocalServer,
+ /// Any OpenAI-compatible base URL with an optional key.
+ CustomEndpoint,
+}
+
+impl MethodKind {
+ /// The word used in files, telemetry and the view model.
+ pub fn word(self) -> &'static str {
+ match self {
+ MethodKind::ApiKey => "api_key",
+ MethodKind::ImportLogin => "import_login",
+ MethodKind::DeviceCode => "device_code",
+ MethodKind::BrowserOauth => "browser_oauth",
+ MethodKind::SubscriptionLogin => "subscription_login",
+ MethodKind::Adc => "adc",
+ MethodKind::LocalServer => "local_server",
+ MethodKind::CustomEndpoint => "custom_endpoint",
+ }
+ }
+
+ /// Every kind, in the order of [`MethodKind::word`]'s list in the docs.
+ pub const ALL: [MethodKind; 8] = [
+ MethodKind::ApiKey,
+ MethodKind::ImportLogin,
+ MethodKind::DeviceCode,
+ MethodKind::BrowserOauth,
+ MethodKind::SubscriptionLogin,
+ MethodKind::Adc,
+ MethodKind::LocalServer,
+ MethodKind::CustomEndpoint,
+ ];
+
+ pub fn parse(word: &str) -> Option<MethodKind> {
+ Self::ALL.into_iter().find(|k| k.word() == word)
+ }
+}
+
+/// How a saved key is checked, without blocking: one read-only GET on the
+/// provider's own host.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Check {
+ /// Appended to the provider's base URL (or the region's).
+ pub path: &'static str,
+ /// `bearer`, `x-api-key` (with the Anthropic version header) or
+ /// `x-goog-api-key`.
+ pub auth: &'static str,
+}
+
+/// A non-secret value a method asks for besides the key.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Field {
+ pub id: &'static str,
+ pub label: &'static str,
+ /// `text`, `url` or `choice`.
+ pub kind: &'static str,
+ pub placeholder: &'static str,
+ pub required: bool,
+ pub options: &'static [&'static str],
+}
+
+/// One way to connect a provider.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Method {
+ pub id: &'static str,
+ pub kind: MethodKind,
+ /// The variable the credential is saved as (empty: none).
+ pub env: &'static str,
+ /// Other saved names that also mean this provider is connected.
+ pub aliases: &'static [&'static str],
+ /// The one app that may receive this credential (a harness id), or empty.
+ pub scope: &'static str,
+ /// The setup id of the app the sign-in is made through, or empty.
+ pub app: &'static str,
+ /// `device_code` for a code sign-in, or empty.
+ pub flow: &'static str,
+ pub label: &'static str,
+ pub help: &'static str,
+ /// Subscription logins whose terms are unchecked: never offered.
+ pub terms_review: bool,
+ /// The key may be empty (a server that asks for none).
+ pub secret_optional: bool,
+ pub fields: &'static [Field],
+}
+
+/// A region (or plan) with its own base URL.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Region {
+ pub id: &'static str,
+ pub name: &'static str,
+ pub base_url: &'static str,
+}
+
+/// One name delivered to a run: `dest` is the variable the app reads, `src`
+/// the saved name it is filled from (usually the same).
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Entry {
+ pub dest: &'static str,
+ pub src: &'static str,
+}
+
+/// What one app receives from a provider.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Delivery {
+ pub harness: &'static str,
+ pub entries: &'static [Entry],
+}
+
+/// One provider.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Provider {
+ pub id: &'static str,
+ pub name: &'static str,
+ pub icon: &'static str,
+ pub tier: Tier,
+ /// Preference order: Hermes uses the first connected provider.
+ pub rank: u32,
+ pub kind: Kind,
+ /// Kept out of every UI (`hidden_reason` says why).
+ pub hidden: bool,
+ pub hidden_reason: &'static str,
+ /// The provider's subscription terms are unchecked: out of every UI.
+ pub terms_review: bool,
+ pub aliases: &'static [&'static str],
+ pub wire: &'static str,
+ pub also_wires: &'static [&'static str],
+ pub base_url: &'static str,
+ /// The variable Hermes reads to override the base URL.
+ pub base_url_env: &'static str,
+ pub default_model: &'static str,
+ /// Hermes's provider id, when it has one.
+ pub hermes_id: &'static str,
+ pub key_help: &'static str,
+ pub placeholder: &'static str,
+ pub check: Option<Check>,
+ /// Apps that are not agent harnesses but read this provider's variable.
+ pub apps: &'static [&'static str],
+ pub methods: &'static [Method],
+ pub regions: &'static [Region],
+ pub delivery: &'static [Delivery],
+}
+
+impl Provider {
+ /// Whether any UI may show it.
+ pub fn visible(&self) -> bool {
+ !self.hidden && !self.terms_review
+ }
+
+ /// The methods a UI may offer (terms-reviewed only).
+ pub fn offered(&self) -> impl Iterator<Item = &'static Method> + '_ {
+ self.methods.iter().filter(|m| !m.terms_review)
+ }
+
+ /// The API-key method, when there is one.
+ pub fn key_method(&self) -> Option<&'static Method> {
+ self.methods
+ .iter()
+ .find(|m| matches!(m.kind, MethodKind::ApiKey | MethodKind::CustomEndpoint))
+ }
+
+ /// Every saved name that connects this provider.
+ pub fn envs(&self) -> impl Iterator<Item = &'static str> + '_ {
+ self.methods
+ .iter()
+ .filter(|m| !m.terms_review)
+ .flat_map(|m| std::iter::once(m.env).chain(m.aliases.iter().copied()))
+ .filter(|e| !e.is_empty())
+ }
+
+ /// What `harness` receives from this provider.
+ pub fn delivery_for(&self, harness: &str) -> &'static [Entry] {
+ self.delivery
+ .iter()
+ .find(|d| d.harness == harness)
+ .map(|d| d.entries)
+ .unwrap_or(&[])
+ }
+
+ /// The base URL for `region` (the provider's own when empty or unknown).
+ pub fn base_url_for(&self, region: Option<&str>) -> &'static str {
+ region
+ .and_then(|r| self.regions.iter().find(|x| x.id == r))
+ .map(|r| r.base_url)
+ .unwrap_or(self.base_url)
+ }
+
+ /// Whether `env` is a name only a scoped method saves: the app that may
+ /// receive it, when so.
+ pub fn scope_of(&self, env: &str) -> Option<&'static str> {
+ self.methods
+ .iter()
+ .find(|m| !m.scope.is_empty() && (m.env == env || m.aliases.contains(&env)))
+ .map(|m| m.scope)
+ }
+}
+
+/// A provider by id (hidden ones too).
+pub fn provider(id: &str) -> Option<&'static Provider> {
+ PROVIDERS.iter().find(|p| p.id == id)
+}
+
+/// The providers a UI may show, in rank order.
+pub fn visible() -> impl Iterator<Item = &'static Provider> {
+ PROVIDERS.iter().filter(|p| p.visible())
+}
+
+/// The visible provider that saves a credential under `env`.
+pub fn provider_of_env(env: &str) -> Option<&'static Provider> {
+ visible().find(|p| p.envs().any(|e| e == env))
+}
+
+/// The names `harness` reads, in preference order (the generated table).
+pub fn reads(harness: &str) -> &'static [&'static str] {
+ READS
+ .iter()
+ .find(|(h, _)| *h == harness)
+ .map(|(_, r)| *r)
+ .unwrap_or(&[])
+}
+
+/// Every name any visible provider may be saved or delivered as.
+pub fn all_env_names() -> Vec<&'static str> {
+ let mut v: Vec<&'static str> = visible().flat_map(|p| p.envs()).collect();
+ v.sort_unstable();
+ v.dedup();
+ v
+}
+
+/// Names that may be read from the person's login shell: the API-key names
+/// of visible providers, nothing else.
+pub fn shell_names() -> Vec<&'static str> {
+ let mut v: Vec<&'static str> = visible()
+ .flat_map(|p| p.methods.iter())
+ .filter(|m| m.kind == MethodKind::ApiKey && !m.terms_review)
+ .map(|m| m.env)
+ .collect();
+ v.sort_unstable();
+ v.dedup();
+ v
+}
+
+/// What a connected provider contributes to a run's selection.
+#[derive(Clone, Debug, PartialEq, Eq, Default)]
+pub struct Connected {
+ pub provider: String,
+ /// The region or plan chosen, when the provider has them.
+ pub region: Option<String>,
+ /// Non-secret fields saved with it (`base_url`, `model`, `wire`).
+ pub fields: BTreeMap<String, String>,
+}
diff --git a/libs/cua/crates/cua-connections/src/schema.rs b/libs/cua/crates/cua-connections/src/schema.rs
new file mode 100644
index 0000000000..5cbd46c39a
--- /dev/null
+++ b/libs/cua/crates/cua-connections/src/schema.rs
@@ -0,0 +1,358 @@
+//! The provider file format and its checks. Used by the generator and the
+//! tests; the generated tables hold the result, so shipped code never parses.
+
+use std::collections::{BTreeMap, BTreeSet};
+use std::path::Path;
+
+use serde::Deserialize;
+
+use crate::{ENDPOINT_HARNESSES, HARNESS_IDS, MethodKind, WIRES};
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct CheckDef {
+ pub path: String,
+ pub auth: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct FieldDef {
+ pub id: String,
+ pub label: String,
+ #[serde(default = "text")]
+ pub kind: String,
+ #[serde(default)]
+ pub placeholder: String,
+ #[serde(default)]
+ pub required: bool,
+ #[serde(default)]
+ pub options: Vec<String>,
+}
+
+fn text() -> String {
+ "text".into()
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct MethodDef {
+ pub id: String,
+ pub kind: String,
+ #[serde(default)]
+ pub env: String,
+ #[serde(default)]
+ pub aliases: Vec<String>,
+ #[serde(default)]
+ pub scope: String,
+ #[serde(default)]
+ pub app: String,
+ #[serde(default)]
+ pub flow: String,
+ #[serde(default)]
+ pub label: String,
+ #[serde(default)]
+ pub help: String,
+ /// `ok` (default) or `review`.
+ #[serde(default)]
+ pub terms: String,
+ /// `required` (default) or `optional`.
+ #[serde(default)]
+ pub secret: String,
+ #[serde(default)]
+ pub field: Vec<FieldDef>,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct RegionDef {
+ pub id: String,
+ pub name: String,
+ pub base_url: String,
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct ProviderDef {
+ pub id: String,
+ pub name: String,
+ #[serde(default)]
+ pub icon: String,
+ pub tier: String,
+ pub rank: u32,
+ pub kind: String,
+ #[serde(default)]
+ pub hidden: bool,
+ #[serde(default)]
+ pub hidden_reason: String,
+ /// `ok` (default) or `review`.
+ #[serde(default)]
+ pub terms: String,
+ #[serde(default)]
+ pub aliases: Vec<String>,
+ pub wire: String,
+ #[serde(default)]
+ pub also_wires: Vec<String>,
+ pub base_url: String,
+ #[serde(default)]
+ pub base_url_env: String,
+ #[serde(default)]
+ pub default_model: String,
+ #[serde(default)]
+ pub hermes_id: String,
+ pub key_help: String,
+ #[serde(default)]
+ pub placeholder: String,
+ #[serde(default)]
+ pub check: Option<CheckDef>,
+ #[serde(default)]
+ pub apps: Vec<String>,
+ #[serde(default)]
+ pub method: Vec<MethodDef>,
+ #[serde(default)]
+ pub region: Vec<RegionDef>,
+ /// Harness id to the names it receives: `NAME`, or `DEST<-SRC`.
+ #[serde(default)]
+ pub delivery: BTreeMap<String, Vec<String>>,
+}
+
+impl ProviderDef {
+ pub fn terms_review(&self) -> bool {
+ self.terms == "review"
+ }
+
+ /// `(dest, src)` of a delivery entry.
+ pub fn entry(raw: &str) -> (&str, &str) {
+ match raw.split_once("<-") {
+ Some((d, s)) => (d, s),
+ None => (raw, raw),
+ }
+ }
+}
+
+/// Every provider file under `dir`, sorted by rank then id, checked.
+pub fn load_dir(dir: &Path) -> Result<Vec<ProviderDef>, String> {
+ let mut files: Vec<_> = std::fs::read_dir(dir)
+ .map_err(|e| format!("{}: {e}", dir.display()))?
+ .filter_map(|e| e.ok())
+ .map(|e| e.path())
+ .filter(|p| p.extension().is_some_and(|x| x == "toml"))
+ .collect();
+ files.sort();
+ let mut out = vec![];
+ for f in files {
+ let text = std::fs::read_to_string(&f).map_err(|e| format!("{}: {e}", f.display()))?;
+ let def: ProviderDef =
+ toml::from_str(&text).map_err(|e| format!("{}: {e}", f.display()))?;
+ let stem = f.file_stem().and_then(|s| s.to_str()).unwrap_or_default();
+ if stem != def.id {
+ return Err(format!(
+ "{}: the file is named for the id {:?}",
+ f.display(),
+ def.id
+ ));
+ }
+ out.push(def);
+ }
+ out.sort_by(|a, b| (a.rank, &a.id).cmp(&(b.rank, &b.id)));
+ check(&out)?;
+ Ok(out)
+}
+
+fn env_ok(name: &str) -> bool {
+ !name.is_empty()
+ && name.len() <= 64
+ && name
+ .bytes()
+ .all(|b| b.is_ascii_uppercase() || b.is_ascii_digit() || b == b'_')
+ && !name.as_bytes()[0].is_ascii_digit()
+}
+
+/// The rules every file set must meet. Each failure names the file.
+pub fn check(all: &[ProviderDef]) -> Result<(), String> {
+ let mut ids = BTreeSet::new();
+ let mut ranks = BTreeSet::new();
+ // name -> provider that saves it
+ let mut saved: BTreeMap<String, String> = BTreeMap::new();
+ for p in all {
+ let at = |m: &str| format!("providers/{}.toml: {m}", p.id);
+ if !ids.insert(p.id.clone()) {
+ return Err(at("duplicate id"));
+ }
+ if !ranks.insert(p.rank) {
+ return Err(at(&format!("rank {} is used by another provider", p.rank)));
+ }
+ if !p
+ .id
+ .bytes()
+ .all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-')
+ {
+ return Err(at("the id is lowercase letters, digits and -"));
+ }
+ if !matches!(p.tier.as_str(), "top" | "more") {
+ return Err(at("tier is top or more"));
+ }
+ if !matches!(
+ p.kind.as_str(),
+ "hosted" | "aggregator" | "local" | "custom" | "cloud"
+ ) {
+ return Err(at("kind is hosted, aggregator, local, custom or cloud"));
+ }
+ if !matches!(p.terms.as_str(), "" | "ok" | "review") {
+ return Err(at("terms is ok or review"));
+ }
+ if p.hidden && p.hidden_reason.trim().is_empty() {
+ return Err(at("a hidden provider says why in hidden_reason"));
+ }
+ if p.tier == "top" && (p.hidden || p.terms_review()) {
+ return Err(at("an up front provider cannot be hidden"));
+ }
+ if p.name.contains('\u{b7}') || p.key_help.contains('\u{b7}') {
+ return Err(at("UI text has no middle dot"));
+ }
+ for t in std::iter::once(&p.name)
+ .chain(std::iter::once(&p.key_help))
+ .chain(p.method.iter().map(|m| &m.help))
+ .chain(p.method.iter().map(|m| &m.label))
+ {
+ if t.to_ascii_lowercase().contains("device")
+ && !t.to_ascii_lowercase().contains("device code")
+ {
+ return Err(at("UI text says machines, not devices"));
+ }
+ }
+ for w in std::iter::once(&p.wire).chain(p.also_wires.iter()) {
+ if !WIRES.contains(&w.as_str()) {
+ return Err(at(&format!("unknown wire {w:?}")));
+ }
+ }
+ if p.method.is_empty() {
+ return Err(at("a provider has at least one method"));
+ }
+ let mut method_ids = BTreeSet::new();
+ for m in &p.method {
+ if !method_ids.insert(m.id.clone()) {
+ return Err(at(&format!("duplicate method {}", m.id)));
+ }
+ let kind = MethodKind::parse(&m.kind)
+ .ok_or_else(|| at(&format!("method {}: unknown kind {:?}", m.id, m.kind)))?;
+ if !matches!(m.terms.as_str(), "" | "ok" | "review") {
+ return Err(at(&format!("method {}: terms is ok or review", m.id)));
+ }
+ if !matches!(m.secret.as_str(), "" | "required" | "optional") {
+ return Err(at(&format!(
+ "method {}: secret is required or optional",
+ m.id
+ )));
+ }
+ let needs_env = matches!(
+ kind,
+ MethodKind::ApiKey | MethodKind::ImportLogin | MethodKind::CustomEndpoint
+ );
+ if needs_env && m.env.is_empty() {
+ return Err(at(&format!("method {} saves a credential: set env", m.id)));
+ }
+ for e in std::iter::once(&m.env).chain(m.aliases.iter()) {
+ if e.is_empty() {
+ continue;
+ }
+ if !env_ok(e) {
+ return Err(at(&format!("{e:?} is not an environment variable name")));
+ }
+ if let Some(prev) = saved.insert(e.clone(), p.id.clone())
+ && prev != p.id
+ {
+ return Err(at(&format!("{e} is also saved by {prev}")));
+ }
+ }
+ // A subscription or imported sign-in belongs to one app.
+ let signin = matches!(
+ kind,
+ MethodKind::ImportLogin | MethodKind::SubscriptionLogin | MethodKind::DeviceCode
+ );
+ if signin && m.scope.is_empty() {
+ return Err(at(&format!(
+ "method {}: a sign-in names the one app that may use it (scope)",
+ m.id
+ )));
+ }
+ if !m.scope.is_empty() && !HARNESS_IDS.contains(&m.scope.as_str()) {
+ return Err(at(&format!(
+ "method {}: scope {:?} is not an app",
+ m.id, m.scope
+ )));
+ }
+ if kind == MethodKind::ImportLogin && m.app.is_empty() && m.terms != "review" {
+ return Err(at(&format!(
+ "method {}: an import names the app it is read from",
+ m.id
+ )));
+ }
+ if (m.kind == "device_code" || m.flow == "device_code") && m.label.is_empty() {
+ return Err(at(&format!("method {}: a sign-in has a label", m.id)));
+ }
+ for f in &m.field {
+ if !matches!(f.kind.as_str(), "text" | "url" | "choice") {
+ return Err(at(&format!("field {}: kind is text, url or choice", f.id)));
+ }
+ if f.kind == "choice" && f.options.is_empty() {
+ return Err(at(&format!("field {}: a choice lists its options", f.id)));
+ }
+ }
+ }
+ let mut region_ids = BTreeSet::new();
+ for r in &p.region {
+ if !region_ids.insert(r.id.clone()) {
+ return Err(at(&format!("duplicate region {}", r.id)));
+ }
+ }
+ if let Some(c) = &p.check {
+ if !matches!(c.auth.as_str(), "bearer" | "x-api-key" | "x-goog-api-key") {
+ return Err(at("check.auth is bearer, x-api-key or x-goog-api-key"));
+ }
+ if !c.path.starts_with('/') || p.base_url.is_empty() {
+ return Err(at("a check is a path on the provider's own base URL"));
+ }
+ }
+ if !p.base_url.is_empty() && !p.base_url.starts_with("https://") && p.kind != "local" {
+ return Err(at("a hosted base URL is https"));
+ }
+ // Delivery: known apps, names this provider saves, scoped names to their app only.
+ for (harness, entries) in &p.delivery {
+ if !HARNESS_IDS.contains(&harness.as_str()) {
+ return Err(at(&format!("delivery to unknown app {harness:?}")));
+ }
+ for raw in entries {
+ let (dest, src) = ProviderDef::entry(raw);
+ if !env_ok(dest) || !env_ok(src) {
+ return Err(at(&format!(
+ "delivery entry {raw:?} is not a variable name"
+ )));
+ }
+ let method = p
+ .method
+ .iter()
+ .find(|m| m.env == src || m.aliases.iter().any(|a| a == src))
+ .ok_or_else(|| {
+ at(&format!(
+ "delivery entry {raw:?}: this provider saves no {src}"
+ ))
+ })?;
+ if !method.scope.is_empty() && method.scope != *harness {
+ return Err(at(&format!(
+ "{src} is the {} sign-in: it may only go to {}, not {harness}",
+ method.id, method.scope
+ )));
+ }
+ }
+ }
+ // Endpoint harnesses are fed by wire: the file must name a model.
+ let overlaps = ENDPOINT_HARNESSES
+ .iter()
+ .any(|(_, w)| *w == p.wire || p.also_wires.iter().any(|a| a == w));
+ if overlaps && p.kind != "custom" && !p.default_model.is_empty() && p.base_url.is_empty() {
+ return Err(at("serves an endpoint wire but has no base URL"));
+ }
+ }
+ Ok(())
+}
diff --git a/libs/cua/crates/cua-connections/tests/generated.rs b/libs/cua/crates/cua-connections/tests/generated.rs
new file mode 100644
index 0000000000..1cceff0766
--- /dev/null
+++ b/libs/cua/crates/cua-connections/tests/generated.rs
@@ -0,0 +1,25 @@
+//! The generated files match the provider files: a stale one fails here, in
+//! `cargo nextest`, and in `cua-connections-gen --check`.
+
+#[test]
+fn generated_files_are_current() {
+ let root = cua_connections::generate::repo_root();
+ let stale = cua_connections::generate::check(&root).expect("render");
+ assert!(
+ stale.is_empty(),
+ "stale generated files: {stale:?}\nrun: cargo run -p cua-connections --bin cua-connections-gen"
+ );
+}
+
+#[test]
+fn the_tables_hold_every_provider_file() {
+ let root = cua_connections::generate::repo_root();
+ let defs =
+ cua_connections::schema::load_dir(&root.join(cua_connections::generate::PROVIDERS_DIR))
+ .expect("provider files");
+ assert_eq!(defs.len(), cua_connections::PROVIDERS.len());
+ for (d, p) in defs.iter().zip(cua_connections::PROVIDERS) {
+ assert_eq!(d.id, p.id);
+ assert_eq!(d.method.len(), p.methods.len(), "{}", d.id);
+ }
+}
diff --git a/libs/cua/crates/cua-connections/tests/hermes_drift.rs b/libs/cua/crates/cua-connections/tests/hermes_drift.rs
new file mode 100644
index 0000000000..d49fc64f1c
--- /dev/null
+++ b/libs/cua/crates/cua-connections/tests/hermes_drift.rs
@@ -0,0 +1,125 @@
+//! Drift guard against the Hermes release Cua installs.
+//!
+//! `hermes-pin.json` is a snapshot of the pinned release's provider set
+//! (`tools/hermes_snapshot.py`). Provider files may only name variables and
+//! base URLs Hermes uses, every Hermes provider is either listed or
+//! deliberately not (`hermes-unlisted.txt`), and the snapshot is the pin in
+//! `cua-agents/installables.json`. See `providers/README.md` to move the pin.
+
+use std::collections::BTreeSet;
+
+use serde_json::Value;
+
+fn snapshot() -> Value {
+ let text = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/hermes-pin.json"))
+ .expect("hermes-pin.json");
+ serde_json::from_str(&text).expect("json")
+}
+
+#[test]
+fn the_snapshot_is_the_pinned_release() {
+ let installables = std::fs::read_to_string(concat!(
+ env!("CARGO_MANIFEST_DIR"),
+ "/../cua-agents/installables.json"
+ ))
+ .expect("installables.json");
+ let v: Value = serde_json::from_str(&installables).expect("json");
+ let hermes = &v["items"]["hermes"];
+ let snap = snapshot();
+ assert_eq!(
+ snap["commit"], hermes["commit"],
+ "pin moved: regenerate hermes-pin.json (providers/README.md)"
+ );
+ assert_eq!(snap["version"], hermes["version"]);
+}
+
+#[test]
+fn provider_files_use_what_hermes_uses() {
+ let snap = snapshot();
+ let theirs = snap["providers"].as_object().expect("providers");
+ for p in cua_connections::PROVIDERS {
+ if p.hermes_id.is_empty() {
+ continue;
+ }
+ let h = theirs.get(p.hermes_id).unwrap_or_else(|| {
+ panic!(
+ "{}: Hermes has no provider {:?} at the pin",
+ p.id, p.hermes_id
+ )
+ });
+ let env: BTreeSet<&str> = h["env"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .filter_map(Value::as_str)
+ .collect();
+ // Every name Hermes receives from us is one it reads.
+ for d in p.delivery_for("hermes") {
+ if p.kind == cua_connections::Kind::Custom {
+ continue;
+ }
+ assert!(
+ env.contains(d.dest),
+ "{}: Hermes does not read {} (it reads {env:?})",
+ p.id,
+ d.dest
+ );
+ }
+ // The base URL is Hermes's (empty on their side: computed or user set).
+ let base = h["base_url"].as_str().unwrap_or_default();
+ if !base.is_empty() && !p.base_url.is_empty() {
+ assert_eq!(p.base_url, base, "{}: base URL differs from Hermes's", p.id);
+ }
+ // The variable that overrides the base URL, when both name one.
+ let base_env = h["base_url_env"].as_str().unwrap_or_default();
+ if !base_env.is_empty() && !p.base_url_env.is_empty() {
+ assert_eq!(p.base_url_env, base_env, "{}", p.id);
+ }
+ // Regions are Hermes's endpoints for the same provider.
+ for r in p.regions {
+ assert!(r.base_url.starts_with("https://"), "{}: {}", p.id, r.id);
+ }
+ }
+}
+
+#[test]
+fn every_hermes_provider_is_listed_or_left_out_on_purpose() {
+ let snap = snapshot();
+ let ours: BTreeSet<&str> = cua_connections::PROVIDERS
+ .iter()
+ .filter(|p| !p.hermes_id.is_empty())
+ .map(|p| p.hermes_id)
+ .collect();
+ let allowed: BTreeSet<String> =
+ std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/hermes-unlisted.txt"))
+ .unwrap()
+ .lines()
+ .map(|l| l.split('#').next().unwrap().trim().to_string())
+ .filter(|l| !l.is_empty())
+ .collect();
+ let theirs: BTreeSet<String> = snap["providers"]
+ .as_object()
+ .unwrap()
+ .keys()
+ .cloned()
+ .collect();
+ let unknown: Vec<&String> = theirs
+ .iter()
+ .filter(|id| !ours.contains(id.as_str()) && !allowed.contains(*id))
+ .collect();
+ assert!(
+ unknown.is_empty(),
+ "Hermes providers neither in a provider file nor in hermes-unlisted.txt: {unknown:?}"
+ );
+ // The allowlist does not keep ids that no longer exist or that now have a file.
+ for id in &allowed {
+ assert!(
+ theirs.contains(id),
+ "{id} is not a Hermes provider at the pin"
+ );
+ assert!(
+ !ours.contains(id.as_str()),
+ "{id} has a provider file: remove it from hermes-unlisted.txt"
+ );
+ }
+}
diff --git a/libs/cua/crates/cua-connections/tests/registry.rs b/libs/cua/crates/cua-connections/tests/registry.rs
new file mode 100644
index 0000000000..67f98d9c04
--- /dev/null
+++ b/libs/cua/crates/cua-connections/tests/registry.rs
@@ -0,0 +1,558 @@
+//! The registry's rules: what is up front, what stays hidden, who receives
+//! what, and the plain-words rules for UI text.
+
+use std::collections::BTreeMap;
+
+use cua_connections::{
+ Connected, HARNESS_IDS, MethodKind, PROVIDERS, Tier, deliver, endpoint_for, hermes, provider,
+ reads, visible, works_with,
+};
+
+fn saved(all: &[(&str, &str)]) -> impl Fn(&str) -> Option<String> {
+ let m: BTreeMap<String, String> = all
+ .iter()
+ .map(|(k, v)| (k.to_string(), v.to_string()))
+ .collect();
+ move |n: &str| m.get(n).cloned()
+}
+
+#[test]
+fn eight_providers_are_up_front_in_the_decided_order() {
+ let top: Vec<&str> = visible()
+ .filter(|p| p.tier == Tier::Top)
+ .map(|p| p.id)
+ .collect();
+ assert_eq!(
+ top,
+ [
+ "anthropic",
+ "openai",
+ "openrouter",
+ "google",
+ "xai",
+ "deepseek",
+ "kimi",
+ "custom"
+ ]
+ );
+}
+
+#[test]
+fn unreviewed_logins_and_unverified_providers_are_out_of_every_list() {
+ for id in ["nous", "qwen-oauth", "minimax-oauth", "xai-oauth"] {
+ let p = provider(id).unwrap();
+ assert!(p.terms_review && p.hidden, "{id}");
+ assert!(!p.visible(), "{id}");
+ }
+ for p in PROVIDERS.iter().filter(|p| !p.visible()) {
+ assert!(
+ !p.hidden_reason.is_empty(),
+ "{}: says why it is hidden",
+ p.id
+ );
+ // What a hidden provider saves is not an app's variable, nor read from a shell.
+ for h in HARNESS_IDS {
+ for e in p.delivery_for(h) {
+ assert!(
+ !reads(h).contains(&e.dest)
+ || visible().any(|v| v.delivery_for(h).iter().any(|x| x.dest == e.dest)),
+ "{} leaks {} to {h}",
+ p.id,
+ e.dest
+ );
+ }
+ }
+ for e in p.envs() {
+ assert!(
+ !cua_connections::shell_names().contains(&e)
+ || visible().any(|v| v.envs().any(|x| x == e)),
+ "{}: {e} readable from a shell",
+ p.id
+ );
+ assert!(
+ cua_connections::provider_of_env(e).is_none_or(|v| v.id != p.id),
+ "{}",
+ p.id
+ );
+ }
+ }
+ // A subscription login with unchecked terms is never offered even on a visible provider.
+ for p in visible() {
+ assert!(p.offered().all(|m| !m.terms_review), "{}", p.id);
+ }
+}
+
+#[test]
+fn what_each_app_reads_is_unchanged_for_the_migrated_providers() {
+ let set = |h: &str| -> Vec<&str> {
+ let mut v = reads(h).to_vec();
+ v.sort_unstable();
+ v
+ };
+ assert_eq!(
+ set("claude-code"),
+ [
+ "ANTHROPIC_API_KEY",
+ "ANTHROPIC_AUTH_TOKEN",
+ "CLAUDE_CODE_OAUTH_TOKEN"
+ ]
+ );
+ assert_eq!(
+ set("openai-codex"),
+ ["CODEX_API_KEY", "CODEX_AUTH_JSON", "OPENAI_API_KEY"]
+ );
+ assert_eq!(set("gemini-cli"), ["GEMINI_API_KEY", "GOOGLE_API_KEY"]);
+ assert_eq!(set("google-antigravity"), ["GEMINI_API_KEY"]);
+ assert_eq!(
+ set("opencode"),
+ [
+ "ANTHROPIC_API_KEY",
+ "GEMINI_API_KEY",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY"
+ ]
+ );
+ assert_eq!(
+ set("pi"),
+ [
+ "ANTHROPIC_API_KEY",
+ "GEMINI_API_KEY",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY"
+ ]
+ );
+ assert_eq!(
+ set("goose"),
+ [
+ "ANTHROPIC_API_KEY",
+ "GOOGLE_API_KEY",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY"
+ ]
+ );
+ assert_eq!(
+ set("openclaw"),
+ ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY"]
+ );
+ // Hermes reads every key of a provider it supports, and never a plan sign-in.
+ let hermes = reads("hermes");
+ for must in [
+ "ANTHROPIC_API_KEY",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY",
+ "DEEPSEEK_API_KEY",
+ "XAI_API_KEY",
+ "KIMI_API_KEY",
+ "GEMINI_API_KEY",
+ "HF_TOKEN",
+ "GLM_API_KEY",
+ "FIREWORKS_API_KEY",
+ "CUSTOM_ENDPOINT_API_KEY",
+ ] {
+ assert!(hermes.contains(&must), "Hermes reads {must}");
+ }
+ assert!(!hermes.contains(&"CLAUDE_CODE_OAUTH_TOKEN") && !hermes.contains(&"CODEX_AUTH_JSON"));
+}
+
+/// A credential that belongs to one app never reaches another, for every provider.
+#[test]
+fn a_provider_credential_never_reaches_an_app_that_cannot_use_it() {
+ for p in PROVIDERS {
+ let mut all: Vec<(&str, String)> = vec![];
+ for e in p.envs() {
+ all.push((e, format!("secret-{e}")));
+ }
+ let pairs: Vec<(&str, &str)> = all.iter().map(|(k, v)| (*k, v.as_str())).collect();
+ for h in HARNESS_IDS {
+ let got = deliver(h, &saved(&pairs));
+ for (dest, value) in &got {
+ // Every delivered value came from this provider's own saved names.
+ let src = all
+ .iter()
+ .find(|(_, v)| v == value)
+ .map(|(k, _)| *k)
+ .unwrap();
+ assert!(
+ p.visible(),
+ "{} is hidden and still delivers {dest} to {h}",
+ p.id
+ );
+ if let Some(scope) = p.scope_of(src) {
+ assert_eq!(
+ scope, *h,
+ "{}: {src} is the {scope} sign-in and reached {h}",
+ p.id
+ );
+ }
+ // And the app reads that name.
+ assert!(
+ reads(h).contains(&dest.as_str()),
+ "{}: {h} got {dest}, which it does not read",
+ p.id
+ );
+ }
+ // An app a provider lists no delivery for gets nothing from it.
+ if p.delivery_for(h).is_empty() {
+ assert!(
+ got.is_empty(),
+ "{} reached {h} without a delivery entry",
+ p.id
+ );
+ }
+ }
+ }
+}
+
+#[test]
+fn the_claude_sign_in_goes_to_claude_code_only_and_the_chatgpt_one_to_codex_only() {
+ let s = saved(&[
+ ("CLAUDE_CODE_OAUTH_TOKEN", "claude"),
+ ("CODEX_AUTH_JSON", "codex"),
+ ("ANTHROPIC_API_KEY", "key"),
+ ]);
+ for h in HARNESS_IDS {
+ let got = deliver(h, &s);
+ assert_eq!(
+ got.contains_key("CLAUDE_CODE_OAUTH_TOKEN"),
+ *h == "claude-code",
+ "{h}"
+ );
+ assert_eq!(
+ got.contains_key("CODEX_AUTH_JSON"),
+ *h == "openai-codex",
+ "{h}"
+ );
+ }
+ // Hermes gets the API key only.
+ assert_eq!(
+ deliver("hermes", &s).keys().collect::<Vec<_>>(),
+ ["ANTHROPIC_API_KEY"]
+ );
+}
+
+#[test]
+fn a_file_that_leaks_a_scoped_sign_in_is_refused() {
+ use cua_connections::schema::{ProviderDef, check};
+ let toml = r#"
+id = "x"
+name = "X"
+tier = "more"
+rank = 1
+kind = "hosted"
+wire = "openai-chat"
+base_url = "https://x.example/v1"
+key_help = "h"
+[[method]]
+id = "login"
+kind = "import_login"
+env = "X_LOGIN"
+scope = "claude-code"
+app = "claude-code"
+[delivery]
+hermes = ["X_LOGIN"]
+"#;
+ let def: ProviderDef = ::toml::from_str(toml).unwrap();
+ let err = check(&[def]).unwrap_err();
+ assert!(
+ err.contains("may only go to claude-code, not hermes"),
+ "{err}"
+ );
+}
+
+#[test]
+fn works_with_chips_are_computed_from_delivery_and_wires() {
+ let w = |id: &str| works_with(provider(id).unwrap());
+ assert_eq!(
+ w("anthropic"),
+ [
+ "claude-code",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes",
+ "openclaw"
+ ]
+ );
+ assert_eq!(
+ w("openai"),
+ [
+ "openai-codex",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes",
+ "openclaw"
+ ]
+ );
+ assert_eq!(
+ w("google"),
+ [
+ "gemini-cli",
+ "google-antigravity",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes"
+ ]
+ );
+ assert_eq!(
+ w("openrouter"),
+ ["opencode", "goose", "pi", "hermes", "openclaw"]
+ );
+ // An app that can be pointed at the provider's wire counts, with a base URL and a model.
+ assert_eq!(
+ w("deepseek"),
+ ["opencode", "goose", "pi", "hermes", "openclaw"]
+ );
+ assert_eq!(
+ w("xai"),
+ [
+ "openai-codex",
+ "opencode",
+ "goose",
+ "pi",
+ "hermes",
+ "openclaw"
+ ]
+ );
+ // Claude Code takes Anthropic only.
+ for p in visible() {
+ assert_eq!(
+ w(p.id).contains(&"claude-code"),
+ p.id == "anthropic",
+ "{}",
+ p.id
+ );
+ }
+ // Hermes takes any provider that names a Hermes id and a variable.
+ for p in visible() {
+ assert_eq!(
+ w(p.id).contains(&"hermes"),
+ !p.delivery_for("hermes").is_empty(),
+ "{}",
+ p.id
+ );
+ }
+ // No model, no base URL: an app is not claimed for it.
+ assert_eq!(w("github"), Vec::<&str>::new());
+}
+
+#[test]
+fn an_app_without_a_variable_of_its_own_is_pointed_at_the_connection() {
+ let conn = |id: &str| Connected {
+ provider: id.into(),
+ ..Default::default()
+ };
+ let have = |names: &'static [&'static str]| move |n: &str| names.contains(&n);
+ let plan = endpoint_for(
+ "opencode",
+ &[conn("deepseek")],
+ &have(&["DEEPSEEK_API_KEY"]),
+ )
+ .unwrap();
+ assert_eq!(plan.provider, "deepseek");
+ assert_eq!(plan.base_url, "https://api.deepseek.com/v1");
+ assert_eq!(plan.wire, "openai-chat");
+ assert_eq!(plan.model, "deepseek-flash");
+ assert_eq!(plan.key_src, Some("DEEPSEEK_API_KEY"));
+ // No key saved, no endpoint.
+ assert!(endpoint_for("opencode", &[conn("deepseek")], &have(&[])).is_none());
+ // An app that has its own variable for the provider is not redirected.
+ assert!(
+ endpoint_for(
+ "opencode",
+ &[conn("openrouter")],
+ &have(&["OPENROUTER_API_KEY"])
+ )
+ .is_none()
+ );
+ // The wire must match: Codex speaks Responses (xAI), not chat (DeepSeek).
+ assert!(
+ endpoint_for(
+ "openai-codex",
+ &[conn("deepseek")],
+ &have(&["DEEPSEEK_API_KEY"])
+ )
+ .is_none()
+ );
+ assert_eq!(
+ endpoint_for("openai-codex", &[conn("xai")], &have(&["XAI_API_KEY"]))
+ .unwrap()
+ .wire,
+ "openai-responses"
+ );
+ // Claude Code and Gemini are never pointed anywhere.
+ assert!(
+ endpoint_for(
+ "claude-code",
+ &[conn("deepseek")],
+ &have(&["DEEPSEEK_API_KEY"])
+ )
+ .is_none()
+ );
+ // A custom endpoint brings its own URL and model, key optional.
+ let mut c = conn("custom");
+ c.fields
+ .insert("base_url".into(), "http://host.example:1234/v1".into());
+ c.fields.insert("model".into(), "qwen".into());
+ let plan = endpoint_for("goose", &[c.clone()], &have(&[])).unwrap();
+ assert_eq!(
+ (plan.base_url.as_str(), plan.model.as_str(), plan.key_src),
+ ("http://host.example:1234/v1", "qwen", None)
+ );
+ c.fields.insert("wire".into(), "openai-responses".into());
+ assert!(endpoint_for("goose", &[c.clone()], &have(&[])).is_none());
+ assert!(endpoint_for("openai-codex", &[c], &have(&[])).is_some());
+}
+
+#[test]
+fn hermes_names_the_connected_provider_and_borrows_no_logins() {
+ let conn = |id: &str| Connected {
+ provider: id.into(),
+ ..Default::default()
+ };
+ let have = |names: &'static [&'static str]| move |n: &str| names.contains(&n);
+ // Only OpenRouter connected: Hermes is told to use it, not "auto".
+ let picks = hermes::select(&[conn("openrouter")], &have(&["OPENROUTER_API_KEY"]));
+ let y = hermes::config_yaml(&picks).unwrap();
+ assert!(y.contains("provider: \"openrouter\""), "{y}");
+ assert!(y.contains("default: \"anthropic/claude-sonnet-5\""), "{y}");
+ assert!(y.contains("adopt_external_logins: false"), "{y}");
+ assert!(y.contains("fallback_providers: []"), "{y}");
+ assert!(!y.contains("auto"));
+ // Several: the preference order picks the first, the rest are fallbacks in order.
+ let picks = hermes::select(
+ &[conn("deepseek"), conn("openrouter"), conn("anthropic")],
+ &have(&[
+ "DEEPSEEK_API_KEY",
+ "OPENROUTER_API_KEY",
+ "ANTHROPIC_API_KEY",
+ ]),
+ );
+ let ids: Vec<&str> = picks.iter().map(|p| p.provider.id).collect();
+ assert_eq!(ids, ["anthropic", "openrouter", "deepseek"]);
+ let y = hermes::config_yaml(&picks).unwrap();
+ assert!(y.starts_with("# Written by Cua"), "{y}");
+ assert!(y.contains("model:\n provider: \"anthropic\""), "{y}");
+ assert!(y.contains("fallback_providers:\n - provider: \"openrouter\"\n model: \"anthropic/claude-sonnet-5\"\n - provider: \"deepseek\""), "{y}");
+ // The Claude sign-in alone is not something Hermes can use.
+ assert!(hermes::select(&[conn("anthropic")], &have(&["CLAUDE_CODE_OAUTH_TOKEN"])).is_empty());
+ assert!(hermes::config_yaml(&[]).is_none());
+ // A plan (region) sets the base URL; the model can be chosen.
+ let mut z = conn("zai");
+ z.region = Some("coding-global".into());
+ z.fields.insert("model".into(), "glm-5.2".into());
+ let y = hermes::config_yaml(&hermes::select(&[z], &have(&["GLM_API_KEY"]))).unwrap();
+ assert!(
+ y.contains("provider: \"zai\"")
+ && y.contains("base_url: \"https://api.z.ai/api/coding/paas/v4\"")
+ && y.contains("default: \"glm-5.2\""),
+ "{y}"
+ );
+ // A custom endpoint: its URL, its key variable (or none), no fallbacks to it.
+ let mut c = conn("custom");
+ c.fields
+ .insert("base_url".into(), "http://127.0.0.1:1234/v1".into());
+ c.fields.insert("model".into(), "qwen".into());
+ let y = hermes::config_yaml(&hermes::select(&[c.clone()], &have(&[]))).unwrap();
+ assert!(
+ y.contains("provider: \"custom\"")
+ && y.contains("api_key: \"no-key-required\"")
+ && y.contains("base_url: \"http://127.0.0.1:1234/v1\""),
+ "{y}"
+ );
+ let y =
+ hermes::config_yaml(&hermes::select(&[c], &have(&["CUSTOM_ENDPOINT_API_KEY"]))).unwrap();
+ assert!(y.contains("api_key: \"${CUSTOM_ENDPOINT_API_KEY}\""), "{y}");
+ // Strings with quotes cannot break out of the file.
+ let mut c = conn("custom");
+ c.fields.insert(
+ "base_url".into(),
+ "http://h/v1\"\nauth: {adopt_external_logins: true}".into(),
+ );
+ c.fields.insert("model".into(), "m".into());
+ let y = hermes::config_yaml(&hermes::select(&[c], &have(&[]))).unwrap();
+ assert_eq!(
+ y.matches("adopt_external_logins").count(),
+ 2,
+ "one in the file, one inside the quoted string: {y}"
+ );
+ assert!(
+ y.lines().filter(|l| l.starts_with("auth:")).count() == 1,
+ "{y}"
+ );
+}
+
+#[test]
+fn ui_text_is_plain_words() {
+ let mut texts: Vec<(String, &str)> = vec![];
+ for p in PROVIDERS {
+ texts.push((p.name.into(), p.id));
+ texts.push((p.key_help.into(), p.id));
+ for m in p.methods {
+ texts.push((m.label.into(), p.id));
+ texts.push((m.help.into(), p.id));
+ for f in m.fields {
+ texts.push((f.label.into(), p.id));
+ texts.push((f.placeholder.into(), p.id));
+ }
+ }
+ for r in p.regions {
+ texts.push((r.name.into(), p.id));
+ }
+ }
+ for (t, id) in texts {
+ assert!(
+ !t.contains('\u{b7}') && !t.contains('\u{2022}'),
+ "{id}: no dot separators: {t}"
+ );
+ let l = t.to_lowercase();
+ assert!(
+ !l.contains("devices") && !l.replace("device code", "").contains("device"),
+ "{id}: machines, not devices: {t}"
+ );
+ assert!(!t.contains('\u{2014}'), "{id}: no em dash: {t}");
+ }
+}
+
+#[test]
+fn every_method_kind_is_in_the_closed_set() {
+ for p in PROVIDERS {
+ for m in p.methods {
+ assert!(MethodKind::ALL.contains(&m.kind), "{}", p.id);
+ }
+ }
+ // Every kind has a word that round trips.
+ for k in MethodKind::ALL {
+ assert_eq!(MethodKind::parse(k.word()), Some(k));
+ }
+}
+
+#[test]
+fn a_provider_that_is_checked_is_checked_on_its_own_host() {
+ for p in PROVIDERS {
+ if let Some(c) = p.check {
+ assert!(p.base_url.starts_with("https://"), "{}", p.id);
+ assert!(c.path.starts_with('/'));
+ }
+ }
+ // Custom endpoints are never probed by Cua.
+ assert!(provider("custom").unwrap().check.is_none());
+}
+
+#[test]
+fn goose_reads_the_google_key_from_either_saved_name() {
+ // Goose reads GOOGLE_API_KEY; the Google row saves GEMINI_API_KEY: both fill it, the pasted name first.
+ let only_gemini = deliver("goose", &saved(&[("GEMINI_API_KEY", "gem")]));
+ assert_eq!(
+ only_gemini.get("GOOGLE_API_KEY").map(String::as_str),
+ Some("gem")
+ );
+ let both = deliver(
+ "goose",
+ &saved(&[("GEMINI_API_KEY", "gem"), ("GOOGLE_API_KEY", "goog")]),
+ );
+ assert_eq!(both.get("GOOGLE_API_KEY").map(String::as_str), Some("goog"));
+ // OpenCode and Pi read GEMINI_API_KEY only.
+ assert!(deliver("opencode", &saved(&[("GOOGLE_API_KEY", "goog")])).is_empty());
+}
diff --git a/libs/cua/crates/cua-connections/tools/hermes_snapshot.py b/libs/cua/crates/cua-connections/tools/hermes_snapshot.py
new file mode 100644
index 0000000000..dbda67ebcc
--- /dev/null
+++ b/libs/cua/crates/cua-connections/tools/hermes_snapshot.py
@@ -0,0 +1,165 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: MIT
+# Copyright (c) 2026 Cua AI, Inc.
+"""Reads the provider set out of a Hermes checkout without importing it.
+
+ hermes_snapshot.py <hermes-checkout> > hermes-pin.json
+
+The snapshot holds, for every provider id Hermes can resolve, the environment
+variables that carry its key, its default base URL and its wire. It is what
+`cargo test -p cua-connections` compares the provider files against, so a
+provider file never names a variable or URL the pinned Hermes does not use.
+Only Python's standard library is needed; nothing from Hermes runs.
+
+Sources, in the order Hermes itself layers them:
+ hermes_cli/auth.py _REGISTRY_ROWS (the credential registry)
+ plugins/model-providers/*/__init__.py one profile per provider
+"""
+import ast
+import json
+import os
+import re
+import subprocess
+import sys
+
+
+def literal(node, consts):
+ """A literal's value, resolving names through `consts`; None when it is computed."""
+ try:
+ return ast.literal_eval(node)
+ except Exception:
+ pass
+ if isinstance(node, ast.Name):
+ return consts.get(node.id)
+ if isinstance(node, ast.Tuple) or isinstance(node, ast.List):
+ out = [literal(e, consts) for e in node.elts]
+ return out
+ return None
+
+
+def module_consts(path):
+ """Top-level NAME = <literal> assignments of a module."""
+ consts = {}
+ tree = ast.parse(open(path, encoding="utf-8").read())
+ for n in tree.body:
+ if isinstance(n, ast.Assign) and len(n.targets) == 1 and isinstance(n.targets[0], ast.Name):
+ v = literal(n.value, consts)
+ if v is not None:
+ consts[n.targets[0].id] = v
+ return consts
+
+
+def registry_rows(root):
+ consts = module_consts(os.path.join(root, "hermes_cli/auth_constants.py"))
+ path = os.path.join(root, "hermes_cli/auth.py")
+ tree = ast.parse(open(path, encoding="utf-8").read())
+ consts.update({k: v for k, v in module_consts(path).items()})
+ rows = {}
+ for n in ast.walk(tree):
+ if not (isinstance(n, ast.AnnAssign) and getattr(n.target, "id", "") == "_REGISTRY_ROWS"):
+ continue
+ for e in n.value.elts:
+ if isinstance(e, ast.Tuple):
+ v = [literal(x, consts) for x in e.elts]
+ v += [None] * (6 - len(v))
+ pid, name, base, env, base_env, auth = v[:6]
+ rows[pid] = dict(name=name, base_url=base or "", env=list(env or []),
+ base_url_env=base_env or "", auth=auth or "api_key")
+ elif isinstance(e, ast.Call):
+ args = [literal(x, consts) for x in e.args]
+ kw = {k.arg: literal(k.value, consts) for k in e.keywords}
+ if len(args) < 3 or not isinstance(args[0], str):
+ continue
+ pid, name, auth = args[0], args[1], args[2]
+ rows[pid] = dict(name=name, base_url=kw.get("inference_base_url") or "",
+ env=list(kw.get("api_key_env_vars") or []),
+ base_url_env=kw.get("base_url_env_var") or "", auth=auth)
+ return rows
+
+
+def plugin_profiles(root):
+ out = {}
+ d = os.path.join(root, "plugins/model-providers")
+ for name in sorted(os.listdir(d)):
+ p = os.path.join(d, name, "__init__.py")
+ if not os.path.exists(p):
+ continue
+ consts = module_consts(p)
+ tree = ast.parse(open(p, encoding="utf-8").read())
+ for n in ast.walk(tree):
+ if not isinstance(n, ast.Call):
+ continue
+ kw = {k.arg: literal(k.value, consts) for k in n.keywords if k.arg}
+ if "env_vars" not in kw or not isinstance(kw.get("name"), str):
+ continue
+ out[kw["name"]] = dict(
+ display=kw.get("display_name"),
+ env=list(kw.get("env_vars") or []),
+ base_url=kw.get("base_url") or "",
+ api_mode=kw.get("api_mode") or "chat_completions",
+ auth=kw.get("auth_type") or "api_key",
+ aliases=list(kw.get("aliases") or []),
+ models=list(kw.get("fallback_models") or []),
+ hidden=bool(kw.get("hidden", False)),
+ )
+ return out
+
+
+def static_models(root):
+ """The first model Hermes lists for each provider (its own default pick)."""
+ path = os.path.join(root, "hermes_cli/models_catalog_static.py")
+ consts = module_consts(path)
+ tree = ast.parse(open(path, encoding="utf-8").read())
+ out = {}
+ for n in tree.body:
+ target = getattr(n, "target", None) or (n.targets[0] if isinstance(n, ast.Assign) else None)
+ name = getattr(target, "id", "")
+ if name == "_PROVIDER_MODELS" and isinstance(n.value, ast.Dict):
+ for k, v in zip(n.value.keys, n.value.values):
+ key = literal(k, consts)
+ first = None
+ if isinstance(v, ast.List) and v.elts:
+ first = literal(v.elts[0], consts)
+ elif isinstance(v, ast.BinOp) and isinstance(v.left, ast.List) and v.left.elts:
+ first = literal(v.left.elts[0], consts)
+ if isinstance(key, str) and isinstance(first, str):
+ out[key] = first
+ if name == "OPENROUTER_MODELS" and isinstance(n.value, ast.ListComp):
+ it = n.value.generators[0].iter
+ if isinstance(it, ast.Tuple) and it.elts:
+ out["openrouter"] = literal(it.elts[0], consts)
+ return out
+
+
+def main():
+ root = sys.argv[1]
+ commit = subprocess.run(["git", "-C", root, "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
+ rows = registry_rows(root)
+ profiles = plugin_profiles(root)
+ models_static = static_models(root)
+ ids = sorted(set(rows) | set(profiles))
+ providers = {}
+ for pid in ids:
+ r, p = rows.get(pid, {}), profiles.get(pid, {})
+ env = list(dict.fromkeys(list(r.get("env", [])) + list(p.get("env", []))))
+ # Plugin profiles list the base-URL override variable beside the key variables.
+ base_env = r.get("base_url_env", "") or next((e for e in env if e.endswith("_BASE_URL")), "")
+ env = [e for e in env if not e.endswith("_BASE_URL")]
+ providers[pid] = dict(
+ env=env,
+ base_url=r.get("base_url") or p.get("base_url") or "",
+ base_url_env=base_env,
+ api_mode=p.get("api_mode", "chat_completions"),
+ auth=r.get("auth") or p.get("auth") or "api_key",
+ models=p.get("models", []),
+ default_model=models_static.get(pid) or models_static.get(
+ {"openai-api": "openai-api", "kimi-coding": "kimi-coding"}.get(pid, pid)) or (p.get("models") or [""])[0],
+ )
+ version = re.search(r"v?(\d{4}\.\d+\.\d+)", subprocess.run(
+ ["git", "-C", root, "describe", "--tags", "--exact-match"], capture_output=True, text=True).stdout or "")
+ json.dump({"commit": commit, "version": version.group(1) if version else None,
+ "providers": providers}, sys.stdout, indent=1, sort_keys=True)
+ print()
+
+
+main()
diff --git a/libs/cua/crates/cua-daemon/src/spaces_svc.rs b/libs/cua/crates/cua-daemon/src/spaces_svc.rs
index 28d16ccb71..450c84186f 100644
--- a/libs/cua/crates/cua-daemon/src/spaces_svc.rs
+++ b/libs/cua/crates/cua-daemon/src/spaces_svc.rs
@@ -936,7 +936,7 @@ mod imp {
serde_json::from_str(&r.arguments_json)
.map_err(|_| st(Error::InvalidArgument("arguments_json is not JSON".into())))?
};
- // The app's Settings → Connectors methods: not contract tools, so no
+ // The app's Settings → Connections methods: not contract tools, so no
// MCP server lists or forwards them to an agent.
let out = if app_method {
cua_spaces::agents::keys::app_tool_async(&r.name, args)
diff --git a/libs/cua/crates/cua-sdk/src/native/agents.rs b/libs/cua/crates/cua-sdk/src/native/agents.rs
index 15be2445b8..b69f303ba9 100644
--- a/libs/cua/crates/cua-sdk/src/native/agents.rs
+++ b/libs/cua/crates/cua-sdk/src/native/agents.rs
@@ -500,6 +500,8 @@ fn run_options(o: AgentRunOptions) -> Result<ca::RunOptions> {
bridge: false,
// Durable runs are started through a session (`cua agent run --durable`).
durable: None,
+ // The saved connections are the Cua Spaces app's; an SDK run names its own keys.
+ hermes_config: None,
})
}
diff --git a/libs/cua/crates/cua-spaces-app-core/Cargo.toml b/libs/cua/crates/cua-spaces-app-core/Cargo.toml
index ef0c55e026..5161c30d20 100644
--- a/libs/cua/crates/cua-spaces-app-core/Cargo.toml
+++ b/libs/cua/crates/cua-spaces-app-core/Cargo.toml
@@ -34,6 +34,10 @@ cua-telemetry = { workspace = true, optional = true }
async-trait = { workspace = true, optional = true }
tokio = { workspace = true, optional = true, features = ["sync"] }
+# The provider registry: which providers exist, how each connects, who receives what.
+[dependencies.cua-connections]
+workspace = true
+
[dev-dependencies]
# Sign-in drift test (`tests/sign_in_failures.rs`): every real cua-auth
# sign-in failure maps to a reason with words.
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/agent-keys.json b/libs/cua/crates/cua-spaces-app-core/parity/agent-keys.json
index 85c34b34d0..ed646d81b9 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/agent-keys.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/agent-keys.json
@@ -1,6 +1,6 @@
{
"name": "agent-keys",
- "about": "Settings, Connectors: the provider keys agents in your Spaces get. Anthropic and OpenAI always have a row (Not set until a key is saved; then its last four characters, when it was added, Replace and Remove); any other key has a row by its variable name. A build that can't keep keys, or a daemon that can't be read, says why instead of offering the buttons. Then the add or replace sheet for each kind of key (a new Other key asks for the variable and refuses names a shell or loader reads), the question before removing a key, and which variable names can hold a key.",
+ "about": "Settings, Connections: the provider keys agents in your Spaces get. Anthropic and OpenAI always have a row (Not set until a key is saved; then its last four characters, when it was added, Replace and Remove); any other key has a row by its variable name. A build that can't keep keys, or a daemon that can't be read, says why instead of offering the buttons. Then the add or replace sheet for each kind of key (a new Other key asks for the variable and refuses names a shell or loader reads), the question before removing a key, and which variable names can hold a key.",
"sections": [
{ "step": "nothing saved", "input": { "keys": [] } },
{
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/connectors.json b/libs/cua/crates/cua-spaces-app-core/parity/connectors.json
index 4f14ca36eb..f7cbc33cc9 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/connectors.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/connectors.json
@@ -1,6 +1,6 @@
{
"name": "connectors",
- "about": "Settings, Connectors (redesign) and summoning agents in a Space: the coding apps with Connect and Connected, the Providers with Connect or Sign out, each provider's Connect sheet (an app's own sign-in, a pasted token or key, a key from your shell), the words around importing Claude Code's sign-in, , what one Connect on an app does (importing the sign-in it already has, its device code, or the provider's sheet), an app's page, what sending an @mention does (add, wake, or why it can't be woken), and the one agent list Home and the Agents page draw (agents in Spaces and this device's runs that haven't started).",
+ "about": "Settings, Connections and summoning agents in a Space: the coding apps with Connect and Connected, the Connections list (up front, then the searchable More providers) with state, works-with chips and Connect, Reconnect or Disconnect, each provider's Connect sheet (only the methods that apply: an app's own sign-in, a pasted token or key, a key from your shell, a custom endpoint), the provider choice an app opens, the words around importing Claude Code's sign-in, what one Connect on an app does (importing the sign-in it already has, its device code, or the provider's sheet), an app's page, what sending an @mention does (add, wake, or why it can't be woken), and the one agent list Home and the Agents page draw (agents in Spaces and this device's runs that haven't started).",
"connectors": [
{
"step": "nothing connected",
@@ -48,10 +48,31 @@
"keys": { "keys": [] },
"busy": [{ "id": "app:claude-code", "step": "signing-in" }]
}
+ },
+ {
+ "step": "DeepSeek key and a custom endpoint, More providers searched",
+ "input": {
+ "apps": [
+ { "agent": "opencode", "name": "OpenCode", "installed": true, "configured": true, "skills": true, "mcp": true, "mcpConfig": "~/.config/opencode/opencode.json" }
+ ],
+ "keys": { "keys": [
+ { "provider": "deepseek", "env": "DEEPSEEK_API_KEY", "last4": "9c2e", "addedMs": 1790000200000 },
+ { "provider": "zai", "env": "GLM_API_KEY", "last4": "7d1f", "addedMs": 1790000300000, "region": "coding-global" },
+ { "provider": "custom", "env": "CUSTOM_ENDPOINT_API_KEY", "last4": "", "addedMs": 1790000400000, "fields": { "base_url": "http://127.0.0.1:1234/v1", "model": "qwen", "wire": "openai-chat" } },
+ { "provider": "huggingface", "env": "HF_TOKEN", "last4": "1a2b", "addedMs": 1790000500000, "expired": true }
+ ] },
+ "moreOpen": true,
+ "query": "fire"
+ }
}
],
- "sheets": ["anthropic", "openai", "github"],
- "plans": ["claude-code", "codex", "vscode", "copilot-cli"],
+ "sheets": ["anthropic", "openai", "openrouter", "zai", "custom", "deepinfra", "github"],
+ "pickers": [
+ { "forApp": "hermes", "query": "", "expanded": false },
+ { "forApp": "claude-code", "query": "", "expanded": false },
+ { "forApp": null, "query": "kimi", "expanded": false }
+ ],
+ "plans": ["claude-code", "codex", "hermes", "vscode", "copilot-cli"],
"details": ["claude-code", "vscode"],
"summon": {
"input": {
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json
index e9de8aa657..981684a07f 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/connectors.json
@@ -5,31 +5,37 @@
"apps": [
"claude-code | not-connected | - | Connect | -",
"codex | not-connected | Needs a sign-in to OpenAI. | Connect | -",
- "gemini-cli | not-connected | Needs an API key for Google. | Connect | -",
- "antigravity | not-connected | Needs an API key for Google. | Connect | -",
- "opencode | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "goose | not-connected | Needs an API key for OpenAI, Anthropic or OpenRouter. | Connect | -",
- "pi | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "hermes | not-connected | Needs an API key for Anthropic or OpenAI. | Connect | -",
- "openclaw | not-connected | Needs an API key for Anthropic, OpenAI or OpenRouter. | Connect | -",
+ "gemini-cli | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "antigravity | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "opencode | not-connected | Needs a connected provider. | Connect | -",
+ "goose | not-connected | Needs a connected provider. | Connect | -",
+ "pi | not-connected | Needs a connected provider. | Connect | -",
+ "hermes | not-connected | Needs a connected provider. | Connect | -",
+ "openclaw | not-connected | Needs a connected provider. | Connect | -",
"vscode | connected | - | - | Connected"
],
"footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.",
+ "more": "More providers | 20 | -",
+ "moreProviders": [],
"providers": [
- "anthropic | not-connected | Not connected | Connect",
- "openai | not-connected | Not connected | Connect",
- "google | not-connected | Not connected | Connect",
- "openrouter | not-connected | Not connected | Connect",
- "github | not-connected | Not connected | Connect"
+ "anthropic | top | not-connected | Not connected | - | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openrouter | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "google | top | not-connected | Not connected | - | Gemini CLI, Google Antigravity, OpenCode, Goose, Pi, Hermes | Connect",
+ "xai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "deepseek | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "kimi | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "custom | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect"
],
- "step": "nothing connected"
+ "step": "nothing connected",
+ "title": "Connections"
},
{
"apps": [
"claude-code | connected | Signed in as [email protected] (Claude Max) | - | Connected",
"codex | connecting | Enter the code in your browser… | Connect | -",
- "gemini-cli | not-connected | Needs an API key for Google. | Connect | -",
- "antigravity | not-connected | Needs an API key for Google. | Connect | -",
+ "gemini-cli | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "antigravity | not-connected | Needs an API key for Google AI Studio. | Connect | -",
"opencode | connected | Runs in your Spaces | - | Connected",
"goose | connected | Runs in your Spaces | - | Connected",
"pi | connected | Runs in your Spaces | - | Connected",
@@ -37,87 +43,270 @@
"openclaw | connected | Runs in your Spaces | - | Connected"
],
"footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.",
+ "more": "More providers | 20 | -",
+ "moreProviders": [],
"providers": [
- "anthropic | connected | Signed in as [email protected] (Claude Max) | Sign out",
- "openai | connected | API key •••• 3f9a | Sign out",
- "google | not-connected | Not connected | Connect",
- "openrouter | not-connected | Not connected | Connect",
- "github | not-connected | Not connected | Connect"
+ "anthropic | top | connected | Connected | Signed in as [email protected] (Claude Max) | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Disconnect",
+ "openai | top | connected | Connected | API key •••• 3f9a | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Disconnect",
+ "openrouter | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "google | top | not-connected | Not connected | - | Gemini CLI, Google Antigravity, OpenCode, Goose, Pi, Hermes | Connect",
+ "xai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "deepseek | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "kimi | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "custom | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect"
],
- "step": "Claude Code signed in, an OpenAI key pasted, Codex connecting"
+ "step": "Claude Code signed in, an OpenAI key pasted, Codex connecting",
+ "title": "Connections"
},
{
"apps": [
"claude-code | not-connected | Needs reconnect | Reconnect | -",
"codex | not-connected | Needs a sign-in to OpenAI. | Connect | -",
- "gemini-cli | not-connected | Needs an API key for Google. | Connect | -",
- "antigravity | not-connected | Needs an API key for Google. | Connect | -",
- "opencode | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "goose | not-connected | Needs an API key for OpenAI, Anthropic or OpenRouter. | Connect | -",
- "pi | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "hermes | not-connected | Needs an API key for Anthropic or OpenAI. | Connect | -",
- "openclaw | not-connected | Needs an API key for Anthropic, OpenAI or OpenRouter. | Connect | -"
+ "gemini-cli | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "antigravity | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "opencode | not-connected | Needs a connected provider. | Connect | -",
+ "goose | not-connected | Needs a connected provider. | Connect | -",
+ "pi | not-connected | Needs a connected provider. | Connect | -",
+ "hermes | not-connected | Needs a connected provider. | Connect | -",
+ "openclaw | not-connected | Needs a connected provider. | Connect | -"
],
"footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.",
+ "more": "More providers | 20 | -",
+ "moreProviders": [],
"providers": [
- "anthropic | not-connected | Needs reconnect | Reconnect",
- "openai | not-connected | Not connected | Connect",
- "google | not-connected | Not connected | Connect",
- "openrouter | not-connected | Not connected | Connect",
- "github | not-connected | Not connected | Connect"
+ "anthropic | top | not-connected | Needs reconnect | - | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Reconnect",
+ "openai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openrouter | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "google | top | not-connected | Not connected | - | Gemini CLI, Google Antigravity, OpenCode, Goose, Pi, Hermes | Connect",
+ "xai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "deepseek | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "kimi | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "custom | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect"
],
- "step": "Claude Code sign-in ran out (needs reconnect)"
+ "step": "Claude Code sign-in ran out (needs reconnect)",
+ "title": "Connections"
},
{
"apps": [
"claude-code | connecting | Reading your Claude Code sign-in… | Connect | -",
"codex | not-connected | Needs a sign-in to OpenAI. | Connect | -",
- "gemini-cli | not-connected | Needs an API key for Google. | Connect | -",
- "antigravity | not-connected | Needs an API key for Google. | Connect | -",
- "opencode | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "goose | not-connected | Needs an API key for OpenAI, Anthropic or OpenRouter. | Connect | -",
- "pi | not-connected | Needs an API key for Anthropic, OpenAI, Google or OpenRouter. | Connect | -",
- "hermes | not-connected | Needs an API key for Anthropic or OpenAI. | Connect | -",
- "openclaw | not-connected | Needs an API key for Anthropic, OpenAI or OpenRouter. | Connect | -"
+ "gemini-cli | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "antigravity | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "opencode | not-connected | Needs a connected provider. | Connect | -",
+ "goose | not-connected | Needs a connected provider. | Connect | -",
+ "pi | not-connected | Needs a connected provider. | Connect | -",
+ "hermes | not-connected | Needs a connected provider. | Connect | -",
+ "openclaw | not-connected | Needs a connected provider. | Connect | -"
],
"footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.",
+ "more": "More providers | 20 | -",
+ "moreProviders": [],
"providers": [
- "anthropic | not-connected | Not connected | Connect",
- "openai | not-connected | Not connected | Connect",
- "google | not-connected | Not connected | Connect",
- "openrouter | not-connected | Not connected | Connect",
- "github | not-connected | Not connected | Connect"
+ "anthropic | top | not-connected | Not connected | - | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openrouter | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "google | top | not-connected | Not connected | - | Gemini CLI, Google Antigravity, OpenCode, Goose, Pi, Hermes | Connect",
+ "xai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "deepseek | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "kimi | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "custom | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect"
],
- "step": "Claude Code is reading its sign-in"
+ "step": "Claude Code is reading its sign-in",
+ "title": "Connections"
},
{
- "key": "anthropic | -",
+ "apps": [
+ "claude-code | not-connected | Needs a sign-in to Anthropic. | Connect | -",
+ "codex | not-connected | Needs a sign-in to OpenAI. | Connect | -",
+ "gemini-cli | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "antigravity | not-connected | Needs an API key for Google AI Studio. | Connect | -",
+ "opencode | connected | - | - | Connected",
+ "goose | connected | Runs in your Spaces | - | Connected",
+ "pi | connected | Runs in your Spaces | - | Connected",
+ "hermes | connected | Runs in your Spaces | - | Connected",
+ "openclaw | connected | Runs in your Spaces | - | Connected"
+ ],
+ "footer": "Sign-ins and keys stay on this Mac in the Keychain. Each one is only given to the apps that use it.",
+ "more": "More providers | 18 | -",
+ "moreProviders": [
+ "fireworks | more | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect"
+ ],
+ "providers": [
+ "anthropic | top | not-connected | Not connected | - | Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw, T3 Code | Connect",
+ "openrouter | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "google | top | not-connected | Not connected | - | Gemini CLI, Google Antigravity, OpenCode, Goose, Pi, Hermes | Connect",
+ "xai | top | not-connected | Not connected | - | OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "deepseek | top | connected | Connected | API key •••• 9c2e | OpenCode, Goose, Pi, Hermes, OpenClaw | Disconnect",
+ "kimi | top | not-connected | Not connected | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Connect",
+ "custom | top | connected | Connected | http://127.0.0.1:1234/v1 | OpenCode, Goose, Pi, Hermes, OpenClaw | Disconnect",
+ "huggingface | more | not-connected | Needs reconnect | - | OpenCode, Goose, Pi, Hermes, OpenClaw | Reconnect",
+ "zai | more | connected | Connected | API key •••• 7d1f, Global, Coding Plan | OpenCode, Goose, Pi, Hermes, OpenClaw | Disconnect"
+ ],
+ "step": "DeepSeek key and a custom endpoint, More providers searched",
+ "title": "Connections"
+ },
+ {
+ "lede": "Works with Claude Code, OpenCode, Goose, Pi, Hermes, OpenClaw and T3 Code.",
+ "note": null,
"sheet": "anthropic",
+ "switch": "Other providers",
"title": "Connect Anthropic",
"ways": [
- "app-token | Use your Claude Code sign-in | Sign in",
- "token | Paste a Claude token | Paste token",
- "key | Paste an API key | Paste key",
- "shell | Use ANTHROPIC_API_KEY from your shell | Use it"
+ {
+ "fields": [],
+ "way": "app-token | import_login | Use your Claude Code sign-in | Sign in | none"
+ },
+ {
+ "fields": [],
+ "way": "token | import_login | Paste a Claude token | Paste token | required"
+ },
+ {
+ "fields": [],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ },
+ {
+ "fields": [],
+ "way": "shell | api_key | Use ANTHROPIC_API_KEY from your shell | Use it | none"
+ }
]
},
{
- "key": "openai | -",
+ "lede": "Works with OpenAI Codex, OpenCode, Goose, Pi, Hermes, OpenClaw and T3 Code.",
+ "note": null,
"sheet": "openai",
+ "switch": "Other providers",
"title": "Connect OpenAI",
"ways": [
- "app-device | Sign in with ChatGPT | Sign in",
- "key | Paste an API key | Paste key"
+ {
+ "fields": [],
+ "way": "app-device | subscription_login | Sign in with ChatGPT | Sign in | none"
+ },
+ {
+ "fields": [],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ }
+ ]
+ },
+ {
+ "lede": "Works with OpenCode, Goose, Pi, Hermes and OpenClaw.",
+ "note": null,
+ "sheet": "openrouter",
+ "switch": "Other providers",
+ "title": "Connect OpenRouter",
+ "ways": [
+ {
+ "fields": [],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ }
+ ]
+ },
+ {
+ "lede": "Works with OpenCode, Goose, Pi, Hermes and OpenClaw.",
+ "note": null,
+ "sheet": "zai",
+ "switch": "Other providers",
+ "title": "Connect Z.AI (GLM)",
+ "ways": [
+ {
+ "fields": [
+ "region | Plan | choice | true | global"
+ ],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ }
+ ]
+ },
+ {
+ "lede": "Works with OpenCode, Goose, Pi, Hermes and OpenClaw.",
+ "note": "A server on this Mac is only reachable from a Space that is allowed to reach that port. Cua doesn't open it for you.",
+ "sheet": "custom",
+ "switch": "Other providers",
+ "title": "Connect Custom endpoint",
+ "ways": [
+ {
+ "fields": [
+ "base_url | Base URL | url | true | ",
+ "model | Model | text | true | ",
+ "wire | API style | choice | true | openai-chat"
+ ],
+ "way": "endpoint | custom_endpoint | Connect a server by its base URL | Set up | optional"
+ }
+ ]
+ },
+ {
+ "lede": "Works with Hermes.",
+ "note": null,
+ "sheet": "deepinfra",
+ "switch": "Other providers",
+ "title": "Connect DeepInfra",
+ "ways": [
+ {
+ "fields": [
+ "model | Model | text | true | "
+ ],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ }
]
},
{
- "key": "other | COPILOT_GITHUB_TOKEN",
+ "lede": "Works with GitHub Copilot CLI.",
+ "note": null,
"sheet": "github",
- "title": "Connect GitHub",
+ "switch": "Other providers",
+ "title": "Connect GitHub Copilot",
"ways": [
- "key | Paste an API key | Paste key"
+ {
+ "fields": [],
+ "way": "key | api_key | Paste an API key | Paste key | required"
+ }
]
},
+ {
+ "items": [
+ "anthropic | top | not-connected",
+ "openai | top | not-connected",
+ "openrouter | top | not-connected",
+ "google | top | not-connected",
+ "xai | top | not-connected",
+ "deepseek | top | not-connected",
+ "kimi | top | not-connected",
+ "custom | top | not-connected"
+ ],
+ "lede": "Providers Hermes can use.",
+ "more": "More providers | 19 | -",
+ "picker": {
+ "expanded": false,
+ "forApp": "hermes",
+ "query": ""
+ },
+ "title": "Connect a provider"
+ },
+ {
+ "items": [
+ "anthropic | top | not-connected"
+ ],
+ "lede": "Providers Claude Code can use.",
+ "more": "- | 0 | -",
+ "picker": {
+ "expanded": false,
+ "forApp": "claude-code",
+ "query": ""
+ },
+ "title": "Connect a provider"
+ },
+ {
+ "items": [
+ "kimi | top | not-connected"
+ ],
+ "lede": "",
+ "more": "- | 0 | -",
+ "picker": {
+ "expanded": false,
+ "forApp": null,
+ "query": "kimi"
+ },
+ "title": "Connect a provider"
+ },
{
"buttons": "Use my sign-in | Cancel | Reading your Claude Code sign-in…",
"importSheet": "macos",
@@ -160,6 +349,10 @@
"does": "false | false | true | - | openai",
"plan": "codex"
},
+ {
+ "does": "false | false | false | anthropic | -",
+ "plan": "hermes"
+ },
{
"does": "false | false | false | - | -",
"plan": "vscode"
@@ -172,12 +365,8 @@
"detail": "claude-code",
"note": null,
"signIn": "Signs in with Anthropic | Not connected | Sign in",
- "status": "Reading your Claude Code sign-in…",
- "toggles": [
- "skills | Cua skills | true",
- "mcp | Cua tools (MCP) | true",
- "auto | Keep it set up | true"
- ]
+ "status": "Needs a sign-in to Anthropic.",
+ "toggles": []
},
{
"detail": "vscode",
@@ -189,7 +378,7 @@
{
"candidates": [
"hermes | Hermes | true | In this Space",
- "claude | Claude Code | false | Not connected yet",
+ "claude | Claude Code | false | Not connected",
"codex | Codex | false | Starts in this Space",
"openclaw | OpenClaw | false | Starts in this Space"
]
diff --git a/libs/cua/crates/cua-spaces-app-core/src/agent_keys.rs b/libs/cua/crates/cua-spaces-app-core/src/agent_keys.rs
index a9659a6263..aa6e4fd5c6 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/agent_keys.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/agent_keys.rs
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-//! Settings, Connectors: the provider keys agents in your Spaces get.
+//! Settings, Connections: the provider keys agents in your Spaces get.
//!
//! The cua daemon keeps the keys in the Keychain (`cua_spaces::agents::keys`)
//! and answers only what this section shows: the provider, the variable a
@@ -62,6 +62,11 @@ pub struct AgentKeyInput {
pub expired: bool,
/// A copied sign-in's name ("Signed in as [email protected] (Claude Max)").
pub label: Option<String>,
+ /// The plan or region chosen for it (Z.AI), when the provider has them.
+ pub region: Option<String>,
+ /// Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ /// and `wire`, or a `model`. Never the key.
+ pub fields: std::collections::HashMap<String, String>,
}
/// What the section shows.
@@ -469,6 +474,8 @@ mod tests {
added_ms: 1,
expired: false,
label: None,
+ region: None,
+ fields: Default::default(),
}
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/agent_list.rs b/libs/cua/crates/cua-spaces-app-core/src/agent_list.rs
index d2c2f72461..768fd54634 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/agent_list.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/agent_list.rs
@@ -65,7 +65,7 @@ pub struct ListAttempt {
/// Not connected: the thread's own words ("Claude Code isn't connected yet") and Connect's.
pub note: Option<String>,
pub connect_label: Option<String>,
- /// The Connectors app Connect runs for.
+ /// The Connections app Connect runs for.
pub app: Option<String>,
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/connectors.rs b/libs/cua/crates/cua-spaces-app-core/src/connectors.rs
index d930c555b4..99668de7ac 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/connectors.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/connectors.rs
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-//! Settings, Connectors: the coding apps Cua works with and the providers
+//! Settings, Connections: the coding apps Cua works with and the providers
//! they sign in to, with one Connect for each.
//!
//! - **Coding apps.** One row for every agent harness that can run in a Space
@@ -38,134 +38,28 @@ use serde::{Deserialize, Serialize};
use crate::agent_keys::{AgentKeyInput, AgentKeyRow, AgentKeysInput};
use crate::model::SpaceOs;
-/// How a provider can be connected.
+/// The providers come from the registry (`cua_connections`: one file per
+/// provider). This module decides the words and the states.
+use cua_connections as reg;
+
+/// How an app signs in on its own, when it can: a method of a provider file
+/// with `app` set.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Way {
- /// An app's own token command, run on This Mac with one browser
- /// approval; the token is saved under `env` and only that app uses it.
- AppToken {
- app: &'static str,
- env: &'static str,
- label: &'static str,
- help: &'static str,
- },
- /// An app's own device-code sign-in, run on This Mac in a folder Cua
- /// owns (Codex: `codex login --device-auth`); the person enters a code
- /// on the provider's page. Saved under `env`; only that app uses it.
- AppDevice {
- app: &'static str,
- env: &'static str,
- label: &'static str,
- help: &'static str,
- },
- /// A token the person pastes (Claude's `claude setup-token`), saved
- /// under `env`; only that app uses it.
- Token {
- app: &'static str,
- env: &'static str,
- label: &'static str,
- help: &'static str,
- },
- /// A key the person pastes.
- Key,
- /// The key already exported in the person's shell, saved once.
- Shell,
-}
-
-/// A provider row.
-struct Provider {
- id: &'static str,
- label: &'static str,
- /// The variable a pasted key is saved as.
- env: &'static str,
- /// Other variables that also mean this provider is connected (a
- /// sign-in token, a key saved under another name).
- also: &'static [&'static str],
- used_by: &'static str,
- key_help: &'static str,
- placeholder: &'static str,
- ways: &'static [Way],
-}
-
-const CLAUDE_TOKEN: Way = Way::AppToken {
- app: "claude-code",
- env: "CLAUDE_CODE_OAUTH_TOKEN",
- label: "Use your Claude Code sign-in",
- help: "Reads the sign-in Claude Code already has on this machine. Uses your Claude plan. Only Claude Code uses it.",
-};
-
-const CLAUDE_PASTE: Way = Way::Token {
- app: "claude-code",
- env: "CLAUDE_CODE_OAUTH_TOKEN",
- label: "Paste a Claude token",
- help: "Advanced. A token made by running claude setup-token in Terminal. It lasts a year. Only Claude Code uses it.",
-};
-
-const CODEX_DEVICE: Way = Way::AppDevice {
- app: "codex",
- env: "CODEX_AUTH_JSON",
- label: "Sign in with ChatGPT",
- help: "Shows a code to enter on openai.com. Uses your ChatGPT plan. Only Codex uses this sign-in.",
-};
-
-const PROVIDERS: &[Provider] = &[
- Provider {
- id: "anthropic",
- label: "Anthropic",
- env: "ANTHROPIC_API_KEY",
- also: &["CLAUDE_CODE_OAUTH_TOKEN"],
- used_by: "Claude Code. Hermes and other apps that use Claude need an API key.",
- key_help: "Create a key at console.anthropic.com. Every app that uses Claude can use it.",
- placeholder: "sk-ant-…",
- ways: &[CLAUDE_TOKEN, CLAUDE_PASTE, Way::Key, Way::Shell],
- },
- Provider {
- id: "openai",
- label: "OpenAI",
- env: "OPENAI_API_KEY",
- also: &["CODEX_AUTH_JSON"],
- used_by: "Codex. Hermes and other apps that use OpenAI models need an API key.",
- key_help: "Create a key at platform.openai.com. Every app that uses OpenAI can use it.",
- placeholder: "sk-…",
- ways: &[CODEX_DEVICE, Way::Key, Way::Shell],
- },
- Provider {
- id: "google",
- label: "Google",
- env: "GEMINI_API_KEY",
- also: &["GOOGLE_API_KEY"],
- used_by: "Gemini CLI, Google Antigravity, OpenCode and Pi.",
- key_help: "Create a key at aistudio.google.com/apikey. Every app that uses Gemini can use it.",
- placeholder: "AIza\u{2026}",
- ways: &[Way::Key, Way::Shell],
- },
- Provider {
- id: "openrouter",
- label: "OpenRouter",
- env: "OPENROUTER_API_KEY",
- also: &[],
- used_by: "OpenCode, Goose, Pi, Hermes and OpenClaw.",
- key_help: "Create a key at openrouter.ai/keys. Every app that uses OpenRouter can use it.",
- placeholder: "sk-or-\u{2026}",
- ways: &[Way::Key, Way::Shell],
- },
- Provider {
- id: "github",
- label: "GitHub",
- env: "COPILOT_GITHUB_TOKEN",
- also: &[],
- used_by: "GitHub Copilot CLI.",
- key_help: "Create a fine-grained token with the Copilot Requests permission at github.com/settings/tokens.",
- placeholder: "github_pat_…",
- ways: &[Way::Key, Way::Shell],
- },
-];
+ /// The sign-in the app already has on this machine, imported once the
+ /// person agrees; saved under the method's env and only that app uses it.
+ AppToken(&'static reg::Method),
+ /// The app's own device-code sign-in, run on This Mac in a folder Cua
+ /// owns (Codex: `codex login --device-auth`); the person enters a code on
+ /// the provider's page. Only that app uses it.
+ AppDevice(&'static reg::Method),
+}
/// Which providers an app signs in to, and the way its Connect uses.
struct AppSignIn {
- app: &'static str,
- /// Any one of these connected is enough.
- providers: &'static [&'static str],
+ /// Any one of these connected is enough: the providers that deliver a
+ /// variable to the app, then those it can be pointed at by wire.
+ providers: Vec<&'static reg::Provider>,
/// The way Connect starts when none is connected (`None`: it asks with
/// the provider's sheet).
way: Option<Way>,
@@ -175,95 +69,41 @@ struct AppSignIn {
reads: &'static [&'static str],
}
-const APPS: &[AppSignIn] = &[
- AppSignIn {
- app: "claude-code",
- providers: &["anthropic"],
- way: Some(CLAUDE_TOKEN),
- reads: &[
- "ANTHROPIC_API_KEY",
- "CLAUDE_CODE_OAUTH_TOKEN",
- "ANTHROPIC_AUTH_TOKEN",
- ],
- },
- AppSignIn {
- app: "codex",
- providers: &["openai"],
- way: Some(CODEX_DEVICE),
- reads: &["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_AUTH_JSON"],
- },
- AppSignIn {
- app: "copilot-cli",
- providers: &["github"],
- way: None,
- reads: &[],
- },
- AppSignIn {
- app: "gemini-cli",
- providers: &["google"],
- way: None,
- reads: &["GEMINI_API_KEY", "GOOGLE_API_KEY"],
- },
- AppSignIn {
- app: "antigravity",
- providers: &["google"],
- way: None,
- reads: &["GEMINI_API_KEY"],
- },
- AppSignIn {
- app: "opencode",
- providers: &["anthropic", "openai", "google", "openrouter"],
- way: None,
- reads: &[
- "ANTHROPIC_API_KEY",
- "OPENAI_API_KEY",
- "GEMINI_API_KEY",
- "OPENROUTER_API_KEY",
- ],
- },
- AppSignIn {
- app: "goose",
- // Not Google: it reads GOOGLE_API_KEY, which the Google row does not save.
- providers: &["openai", "anthropic", "openrouter"],
- way: None,
- reads: &[
- "OPENAI_API_KEY",
- "ANTHROPIC_API_KEY",
- "GOOGLE_API_KEY",
- "OPENROUTER_API_KEY",
- ],
- },
- AppSignIn {
- app: "pi",
- providers: &["anthropic", "openai", "google", "openrouter"],
- way: None,
- reads: &[
- "ANTHROPIC_API_KEY",
- "OPENAI_API_KEY",
- "GEMINI_API_KEY",
- "OPENROUTER_API_KEY",
- ],
- },
- AppSignIn {
- app: "openclaw",
- providers: &["anthropic", "openai", "openrouter"],
- way: None,
- reads: &["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY"],
- },
- AppSignIn {
- app: "hermes",
- providers: &["anthropic", "openai"],
- way: None,
- // API keys only: the Claude Code and ChatGPT sign-ins are not Hermes'.
- reads: &["OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"],
- },
- AppSignIn {
- app: "t3code",
- providers: &["anthropic", "openai"],
- way: None,
- reads: &[],
- },
-];
+/// Apps that are not agent harnesses but read a provider's variable.
+fn is_provider_app(app: &str) -> bool {
+ reg::PROVIDERS.iter().any(|p| p.apps.contains(&app))
+}
+
+fn app_way(app: &str) -> Option<Way> {
+ reg::visible()
+ .flat_map(|p| p.offered())
+ .filter(|m| m.app == app)
+ .find_map(|m| match (m.kind, m.flow) {
+ (reg::MethodKind::ImportLogin, "") => Some(Way::AppToken(m)),
+ (reg::MethodKind::SubscriptionLogin, "device_code") => Some(Way::AppDevice(m)),
+ _ => None,
+ })
+}
+
+fn app_sign_in(app: &str) -> Option<AppSignIn> {
+ if let Some(h) = HARNESS_APPS.iter().find(|h| h.app == app) {
+ return Some(AppSignIn {
+ providers: reg::visible()
+ .filter(|p| reg::works_with(p).contains(&h.harness))
+ .collect(),
+ way: app_way(app),
+ reads: reg::reads(h.harness),
+ });
+ }
+ if is_provider_app(app) {
+ return Some(AppSignIn {
+ providers: reg::visible().filter(|p| p.apps.contains(&app)).collect(),
+ way: None,
+ reads: &[],
+ });
+ }
+ None
+}
/// Every agent harness that can run in a Space (`cua_agents::harness`), with
/// the setup id of its Connectors row, in the order the page lists them. A
@@ -328,7 +168,7 @@ pub struct HarnessApp {
pub name: &'static str,
}
-/// The Connectors row (setup id) of `harness` (`openai-codex` is `codex`).
+/// The Connections row (setup id) of `harness` (`openai-codex` is `codex`).
pub fn app_for_harness(harness: &str) -> Option<&'static str> {
HARNESS_APPS
.iter()
@@ -344,6 +184,15 @@ pub fn harness_of_app(app: &str) -> Option<&'static str> {
.map(|h| h.harness)
}
+/// `names` as "A", "A and B", "A, B and C".
+pub fn and_list(names: &[&str]) -> String {
+ match names {
+ [] => String::new(),
+ [one] => (*one).to_string(),
+ [rest @ .., last] => format!("{} and {last}", rest.join(", ")),
+ }
+}
+
/// `names` as "A", "A or B", "A, B or C".
pub fn or_list(names: &[&str]) -> String {
match names {
@@ -353,19 +202,36 @@ pub fn or_list(names: &[&str]) -> String {
}
}
-fn provider(id: &str) -> Option<&'static Provider> {
- PROVIDERS.iter().find(|p| p.id == id)
-}
-
-fn app_sign_in(app: &str) -> Option<&'static AppSignIn> {
- APPS.iter().find(|a| a.app == app)
+fn provider(id: &str) -> Option<&'static reg::Provider> {
+ reg::provider(id).filter(|p| p.visible())
}
/// Every variable the providers own (they are not listed under Other keys).
fn provider_env(env: &str) -> bool {
- PROVIDERS
+ reg::provider_of_env(env).is_some()
+}
+
+/// A provider's saved names in the order a credential is preferred: what the
+/// person pasted as a key, then a sign-in.
+fn provider_envs(p: &reg::Provider) -> Vec<&'static str> {
+ let mut v: Vec<&'static str> = p
+ .methods
.iter()
- .any(|p| p.env == env || p.also.contains(&env))
+ .filter(|m| {
+ !m.terms_review
+ && matches!(
+ m.kind,
+ reg::MethodKind::ApiKey | reg::MethodKind::CustomEndpoint
+ )
+ })
+ .flat_map(|m| std::iter::once(m.env).chain(m.aliases.iter().copied()))
+ .collect();
+ for e in p.envs() {
+ if !v.contains(&e) {
+ v.push(e);
+ }
+ }
+ v
}
/// One coding app on this computer (`agents.setup`, plus what the page knows).
@@ -418,6 +284,10 @@ pub struct ConnectorsInput {
pub off: Vec<String>,
pub busy: Vec<ConnectorBusy>,
pub failures: Vec<ConnectorFailure>,
+ /// What is typed in the search of More providers.
+ pub query: String,
+ /// More providers is open (a search is open too).
+ pub more_open: bool,
}
impl ConnectorsInput {
@@ -458,19 +328,20 @@ impl ConnectorsInput {
/// The saved credential that connects a provider, first match wins: the
/// pasted key, then a sign-in token.
-fn provider_credential<'a>(input: &'a ConnectorsInput, p: &Provider) -> Option<&'a AgentKeyInput> {
- input.key(p.env).filter(|k| !k.expired).or_else(|| {
- p.also
- .iter()
- .find_map(|e| input.key(e).filter(|k| !k.expired))
- })
+fn provider_credential<'a>(
+ input: &'a ConnectorsInput,
+ p: &reg::Provider,
+) -> Option<&'a AgentKeyInput> {
+ provider_envs(p)
+ .into_iter()
+ .find_map(|e| input.key(e).filter(|k| !k.expired))
}
/// A sign-in saved for the provider has expired (and none that works is).
-fn provider_expired(input: &ConnectorsInput, p: &Provider) -> bool {
+fn provider_expired(input: &ConnectorsInput, p: &reg::Provider) -> bool {
provider_credential(input, p).is_none()
- && std::iter::once(p.env)
- .chain(p.also.iter().copied())
+ && provider_envs(p)
+ .into_iter()
.any(|e| input.key(e).is_some_and(|k| k.expired))
}
@@ -478,6 +349,20 @@ fn provider_connected(input: &ConnectorsInput, id: &str) -> bool {
provider(id).is_some_and(|p| provider_credential(input, p).is_some())
}
+/// An app with no variable of its own for `p` is pointed at its endpoint, so a
+/// connected `p` (with its URL and model, for a custom endpoint) is enough.
+fn endpoint_connected(input: &ConnectorsInput, p: &reg::Provider, harness: &str) -> bool {
+ if !p.delivery_for(harness).is_empty() {
+ return false;
+ }
+ let Some(k) = provider_credential(input, p) else {
+ return false;
+ };
+ p.kind != reg::Kind::Custom
+ || (k.fields.get("base_url").is_some_and(|v| !v.is_empty())
+ && k.fields.get("model").is_some_and(|v| !v.is_empty()))
+}
+
/// The app's sign-in is in place: one of its providers is connected, or it
/// signs in on its own.
///
@@ -489,11 +374,15 @@ fn app_signed_in(input: &ConnectorsInput, app: &str) -> bool {
return true;
};
if a.reads.is_empty() {
- return a.providers.iter().any(|p| provider_connected(input, p));
+ return a.providers.iter().any(|p| provider_connected(input, p.id));
}
+ let harness = harness_of_app(app).unwrap_or_default();
a.reads
.iter()
.any(|k| input.key(k).is_some_and(|k| !k.expired))
+ || a.providers
+ .iter()
+ .any(|p| endpoint_connected(input, p, harness))
}
/// An app's sign-in is saved but expired.
@@ -508,10 +397,7 @@ fn app_expired(input: &ConnectorsInput, app: &str) -> bool {
.iter()
.any(|k| input.key(k).is_some_and(|k| k.expired));
}
- a.providers
- .iter()
- .filter_map(|p| provider(p))
- .any(|p| provider_expired(input, p))
+ a.providers.iter().any(|p| provider_expired(input, p))
})
}
@@ -536,7 +422,13 @@ fn dots(k: &AgentKeyInput) -> String {
}
/// How a saved credential reads on its provider's row.
-fn credential_text(p: &Provider, k: &AgentKeyInput) -> String {
+fn credential_text(p: &reg::Provider, k: &AgentKeyInput) -> String {
+ let plan = k
+ .region
+ .as_deref()
+ .and_then(|r| p.regions.iter().find(|x| x.id == r))
+ .map(|r| format!(", {}", r.name))
+ .unwrap_or_default();
match k.env.as_str() {
"CLAUDE_CODE_OAUTH_TOKEN" => k
.label
@@ -544,7 +436,11 @@ fn credential_text(p: &Provider, k: &AgentKeyInput) -> String {
.filter(|l| !l.is_empty())
.unwrap_or_else(|| "Signed in to Claude".into()),
"CODEX_AUTH_JSON" => "Signed in with ChatGPT, for Codex".into(),
- e if e == p.env => format!("API key {}", dots(k)),
+ _ if p.kind == reg::Kind::Custom => match k.fields.get("base_url") {
+ Some(u) if !u.is_empty() => u.clone(),
+ _ => "Saved".into(),
+ },
+ e if p.key_method().is_some_and(|m| m.env == e) => format!("API key {}{plan}", dots(k)),
e => format!("{e} {}", dots(k)),
}
}
@@ -585,20 +481,37 @@ pub struct ConnectorAppRow {
pub open_label: String,
}
+/// An app a connection works with (a chip on its row; it opens the app's page).
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkChip {
+ /// The app's setup id (`claude-code`, `codex`, `hermes`).
+ pub agent: String,
+ pub name: String,
+}
+
/// A provider's row.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ConnectorProviderRow {
pub id: String,
pub label: String,
+ /// The icon's key (the app draws it; a mark of the initial when it has none).
+ pub icon: String,
+ /// `top` (up front) or `more` (the searchable list).
+ pub tier: String,
/// `connected`, `not-connected`, `connecting`, `failed`.
pub state: String,
- /// "Not connected", "API key •••• 3f9a", "Claude Code sign-in",
- /// "Reading your Claude Code sign-in…".
+ /// "Connected", "Needs reconnect", "Not connected", or what is happening
+ /// ("Reading your Claude Code sign-in…") or why it failed.
pub status: String,
- /// Who uses it.
- pub detail: String,
- /// Connect, or Sign out.
+ /// What is saved, when connected: "API key •••• 3f9a", "Signed in to Claude".
+ pub credential: Option<String>,
+ /// The apps it works with, computed from the provider file.
+ pub works_with: Vec<WorkChip>,
+ /// "Works with".
+ pub works_with_label: String,
+ /// Connect, Reconnect, or Sign out.
pub button: ConnectorButton,
/// When it was connected (the page writes "Added <date>").
pub added_ms: Option<u64>,
@@ -628,10 +541,24 @@ pub struct ConnectorsView {
pub auto_label: String,
pub auto_help: String,
pub auto: bool,
+ /// "Connections".
pub providers_title: String,
- /// Under Providers: where credentials stay.
+ /// Under Connections: where credentials stay.
pub providers_footer: String,
+ /// The providers up front, then any other that is connected or needs
+ /// reconnecting (so a connected one never hides in the search).
pub providers: Vec<ConnectorProviderRow>,
+ /// "More providers".
+ pub more_title: String,
+ /// The search field's label.
+ pub more_search_label: String,
+ /// The searchable list: every provider not shown above, filtered by the
+ /// query (empty while More providers is closed).
+ pub more_providers: Vec<ConnectorProviderRow>,
+ /// How many providers More providers holds.
+ pub more_count: u32,
+ /// "No provider matches that.", when a search finds none.
+ pub more_empty: Option<String>,
/// Keys under any other variable (`agent_keys`' rows).
pub others: Vec<AgentKeyRow>,
pub add_other_label: String,
@@ -681,18 +608,23 @@ fn app_row(input: &ConnectorsInput, a: &ConnectorAppInput) -> ConnectorAppRow {
harness && signed_in
};
let needs = app_sign_in(&a.agent).filter(|_| !signed_in).map(|s| {
- let names = or_list(
- &s.providers
- .iter()
- .filter_map(|p| provider(p))
- .map(|p| p.label)
- .collect::<Vec<_>>(),
- );
- // An app with no sign-in of its own takes API keys: say so.
- if s.way.is_none() && !s.reads.is_empty() {
- format!("Needs an API key for {names}.")
+ // An app with a sign-in of its own (Claude Code, Codex) names its provider;
+ // one that takes several says so, and names them when there are few.
+ let names = if s.way.is_some() {
+ s.providers.first().map(|p| p.name.to_string())
+ } else if s.providers.len() <= 3 {
+ Some(or_list(
+ &s.providers.iter().map(|p| p.name).collect::<Vec<_>>(),
+ ))
} else {
- format!("Needs a sign-in to {names}.")
+ None
+ };
+ match names {
+ Some(n) if s.way.is_none() && !s.reads.is_empty() => {
+ format!("Needs an API key for {n}.")
+ }
+ Some(n) => format!("Needs a sign-in to {n}."),
+ None => "Needs a connected provider.".to_string(),
}
});
@@ -700,7 +632,7 @@ fn app_row(input: &ConnectorsInput, a: &ConnectorAppInput) -> ConnectorAppRow {
let line = match step {
"signing-in"
if app_sign_in(&a.agent)
- .is_some_and(|s| matches!(s.way, Some(Way::AppDevice { .. }))) =>
+ .is_some_and(|s| matches!(s.way, Some(Way::AppDevice(_)))) =>
{
"Enter the code in your browser…".to_string()
}
@@ -762,14 +694,53 @@ fn app_row(input: &ConnectorsInput, a: &ConnectorAppInput) -> ConnectorAppRow {
}
}
-fn provider_row(input: &ConnectorsInput, p: &Provider, can_edit: bool) -> ConnectorProviderRow {
+/// The chips of an app: the apps a provider works with, by their setup ids.
+fn chips(p: &reg::Provider) -> Vec<WorkChip> {
+ let mut v: Vec<WorkChip> = reg::works_with(p)
+ .into_iter()
+ .filter_map(|h| {
+ HARNESS_APPS
+ .iter()
+ .find(|x| x.harness == h)
+ .map(|x| WorkChip {
+ agent: x.app.into(),
+ name: x.name.into(),
+ })
+ })
+ .collect();
+ for a in p.apps {
+ v.push(WorkChip {
+ agent: (*a).into(),
+ name: provider_app_name(a).into(),
+ });
+ }
+ v
+}
+
+/// The name of an app that is not an agent harness but reads a provider's variable.
+fn provider_app_name(app: &str) -> &'static str {
+ match app {
+ "copilot-cli" => "GitHub Copilot CLI",
+ "t3code" => "T3 Code",
+ _ => "",
+ }
+}
+
+fn provider_row(
+ input: &ConnectorsInput,
+ p: &reg::Provider,
+ can_edit: bool,
+) -> ConnectorProviderRow {
let id = format!("provider:{}", p.id);
let busy = input.busy(&id);
let cred = provider_credential(input, p);
let (state, status, btn) = if let Some(step) = busy {
let status = match step {
"signing-out" => "Signing out…",
- "signing-in" if p.ways.iter().any(|w| matches!(w, Way::AppDevice { .. })) => {
+ "signing-in"
+ if p.offered()
+ .any(|m| m.kind == reg::MethodKind::SubscriptionLogin) =>
+ {
"Enter the code in your browser…"
}
"signing-in" => "Reading your Claude Code sign-in…",
@@ -786,11 +757,11 @@ fn provider_row(input: &ConnectorsInput, p: &Provider, can_edit: bool) -> Connec
why.to_string(),
button("connect", "Try again", can_edit),
)
- } else if let Some(k) = cred {
+ } else if cred.is_some() {
(
"connected",
- credential_text(p, k),
- button("sign-out", "Sign out", can_edit),
+ "Connected".to_string(),
+ button("sign-out", "Disconnect", can_edit),
)
} else if provider_expired(input, p) {
(
@@ -807,20 +778,54 @@ fn provider_row(input: &ConnectorsInput, p: &Provider, can_edit: bool) -> Connec
};
ConnectorProviderRow {
id: p.id.into(),
- label: p.label.into(),
+ label: p.name.into(),
+ icon: p.icon.into(),
+ tier: if p.tier == reg::Tier::Top {
+ "top"
+ } else {
+ "more"
+ }
+ .into(),
state: state.into(),
status,
- detail: format!("For {}", p.used_by),
+ credential: cred
+ .filter(|_| busy.is_none())
+ .map(|k| credential_text(p, k)),
+ works_with: chips(p),
+ works_with_label: "Works with".into(),
button: btn,
added_ms: cred.filter(|_| busy.is_none()).map(|k| k.added_ms),
- sign_out_envs: std::iter::once(p.env)
- .chain(p.also.iter().copied())
+ sign_out_envs: provider_envs(p)
+ .into_iter()
.filter(|e| input.key(e).is_some())
.map(Into::into)
.collect(),
}
}
+/// Whether `p` matches what is typed in the search: every word of the query
+/// is the start of a word of its name, id or an alias.
+pub fn provider_matches(p: &reg::Provider, query: &str) -> bool {
+ let q = query.trim().to_lowercase();
+ if q.is_empty() {
+ return true;
+ }
+ let hay: Vec<String> = std::iter::once(p.name)
+ .chain(std::iter::once(p.id))
+ .chain(p.aliases.iter().copied())
+ .flat_map(|t| {
+ t.to_lowercase()
+ .split(|c: char| !c.is_alphanumeric())
+ .filter(|w| !w.is_empty())
+ .map(str::to_string)
+ .collect::<Vec<_>>()
+ })
+ .collect();
+ q.split_whitespace().all(|w| {
+ hay.iter().any(|h| h.starts_with(w)) || p.name.to_lowercase().contains(w) && w.len() > 2
+ })
+}
+
/// The page on a Mac.
pub fn view(input: &ConnectorsInput) -> ConnectorsView {
view_on(input, SpaceOs::Macos)
@@ -852,6 +857,31 @@ pub fn view_on(input: &ConnectorsInput, os: SpaceOs) -> ConnectorsView {
others.sort_by(|a, b| a.env.cmp(&b.env));
let this = os.this_machine_lower();
let place = vault(os).map(|v| format!(" in {v}")).unwrap_or_default();
+ // Up front: the first tier, plus any other provider that has something saved
+ // or is mid-change; the rest wait in the searchable list.
+ let shown = |p: &reg::Provider| {
+ p.tier == reg::Tier::Top
+ || provider_credential(input, p).is_some()
+ || provider_expired(input, p)
+ || input.busy(&format!("provider:{}", p.id)).is_some()
+ || input.failure(&format!("provider:{}", p.id)).is_some()
+ };
+ // The first tier in its order, then the others that have something to show.
+ let providers: Vec<ConnectorProviderRow> = reg::visible()
+ .filter(|p| shown(p) && p.tier == reg::Tier::Top)
+ .chain(reg::visible().filter(|p| shown(p) && p.tier != reg::Tier::Top))
+ .map(|p| provider_row(input, p, can_edit))
+ .collect();
+ let rest: Vec<&reg::Provider> = reg::visible().filter(|p| !shown(p)).collect();
+ let open = input.more_open || !input.query.trim().is_empty();
+ let more_providers: Vec<ConnectorProviderRow> = if open {
+ rest.iter()
+ .filter(|p| provider_matches(p, &input.query))
+ .map(|p| provider_row(input, p, can_edit))
+ .collect()
+ } else {
+ vec![]
+ };
ConnectorsView {
apps_title: "Coding apps".into(),
apps_empty: apps
@@ -870,14 +900,17 @@ pub fn view_on(input: &ConnectorsInput, os: SpaceOs) -> ConnectorsView {
auto_label: "Set up new apps automatically".into(),
auto_help: "When you install another coding app, Cua adds itself and tells you.".into(),
auto: input.auto,
- providers_title: "Providers".into(),
+ providers_title: "Connections".into(),
providers_footer: format!(
"Sign-ins and keys stay on {this}{place}. Each one is only given to the apps that use it."
),
- providers: PROVIDERS
- .iter()
- .map(|p| provider_row(input, p, can_edit))
- .collect(),
+ providers,
+ more_title: "More providers".into(),
+ more_search_label: "Search providers".into(),
+ more_empty: (open && more_providers.is_empty())
+ .then(|| "No provider matches that.".to_string()),
+ more_count: rest.len() as u32,
+ more_providers,
others: others
.into_iter()
.map(|k| AgentKeyRow {
@@ -892,10 +925,11 @@ pub fn view_on(input: &ConnectorsInput, os: SpaceOs) -> ConnectorsView {
remove_label: Some("Remove".into()),
})
.collect(),
- add_other_label: "Add another key".into(),
- other_help: "For another provider, save its key under the variable its app reads, like \
- GEMINI_API_KEY."
- .into(),
+ add_other_label: "Add a key by variable name".into(),
+ other_help:
+ "For a provider that isn't listed, save its key under the variable its app reads, like \
+ MISTRAL_API_KEY."
+ .into(),
can_edit,
notice,
added_label: "Added".into(),
@@ -915,8 +949,9 @@ pub struct ConnectPlan {
/// Run the app's own device-code sign-in (`agents.signInStart`, then
/// `agents.signInWait`): a code to show, entered on the provider's page.
pub device: bool,
- /// Then open this provider's Connect sheet (the app has no token
- /// command of its own).
+ /// Then open this provider's Connect sheet (the app has no sign-in of
+ /// its own): the first provider it can use, with "Other providers" in
+ /// the sheet for the rest.
pub provider: Option<String>,
/// The provider the token command signs in to (its row shows the approval too).
pub token_provider: Option<String>,
@@ -928,18 +963,21 @@ pub fn connect_plan(input: &ConnectorsInput, agent: &str) -> ConnectPlan {
let configured = app.is_some_and(|a| a.configured);
let signed_in = app_signed_in(input, agent);
let s = app_sign_in(agent);
- // The app's own token command runs on This Mac: only where the app is.
+ // The app's own sign-in is made on This Mac: only where the app is.
let app_token = !signed_in
&& app.is_some()
- && s.is_some_and(|s| matches!(s.way, Some(Way::AppToken { .. })));
+ && s.as_ref()
+ .is_some_and(|s| matches!(s.way, Some(Way::AppToken(_))));
let device = !signed_in
&& app.is_some()
- && s.is_some_and(|s| matches!(s.way, Some(Way::AppDevice { .. })));
+ && s.as_ref()
+ .is_some_and(|s| matches!(s.way, Some(Way::AppDevice(_))));
let provider = if signed_in || app_token || device {
None
} else {
- s.and_then(|s| s.providers.first())
- .map(|p| (*p).to_string())
+ s.as_ref()
+ .and_then(|s| s.providers.first())
+ .map(|p| p.id.to_string())
};
ConnectPlan {
// Cua's tools go into the app where it is on this computer.
@@ -948,8 +986,9 @@ pub fn connect_plan(input: &ConnectorsInput, agent: &str) -> ConnectPlan {
device,
provider,
token_provider: if app_token || device {
- s.and_then(|s| s.providers.first())
- .map(|p| (*p).to_string())
+ s.as_ref()
+ .and_then(|s| s.providers.first())
+ .map(|p| p.id.to_string())
} else {
None
},
@@ -957,12 +996,33 @@ pub fn connect_plan(input: &ConnectorsInput, agent: &str) -> ConnectPlan {
}
/// The provider ids `agent` signs in to (any one is enough; empty: it signs in on its own).
+///
+/// An app with a sign-in of its own (Claude Code, Codex) names its provider
+/// only; one that takes many lists them all (the callers say "a connected
+/// provider" when there are more than three).
pub fn app_providers(agent: &str) -> Vec<String> {
app_sign_in(agent)
- .map(|s| s.providers.iter().map(|p| (*p).to_string()).collect())
+ .map(|s| {
+ let n = if s.way.is_some() {
+ 1
+ } else {
+ s.providers.len()
+ };
+ s.providers
+ .iter()
+ .take(n)
+ .map(|p| p.id.to_string())
+ .collect()
+ })
.unwrap_or_default()
}
+/// Whether `agent` has a saved sign-in that stopped working (the provider refused it, or it ran
+/// out): it needs a reconnect, not a first connect.
+pub fn needs_reconnect(input: &ConnectorsInput, agent: &str) -> bool {
+ !app_signed_in(input, agent) && app_expired(input, agent)
+}
+
/// Whether `agent` has a sign-in it can use in a Space now.
pub fn signed_in(input: &ConnectorsInput, agent: &str) -> bool {
app_signed_in(input, agent)
@@ -970,15 +1030,46 @@ pub fn signed_in(input: &ConnectorsInput, agent: &str) -> bool {
/// A provider's name ("Anthropic").
pub fn provider_label(id: &str) -> Option<&'static str> {
- provider(id).map(|p| p.label)
+ provider(id).map(|p| p.name)
+}
+
+/// One field a way asks for besides the key.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WayField {
+ /// `region` (the plan or region), `model`, `base_url`, `wire`: what
+ /// `agentKeys.set` takes as `region` and `fields`.
+ pub id: String,
+ pub label: String,
+ /// `text`, `url` or `choice`.
+ pub kind: String,
+ pub placeholder: String,
+ pub required: bool,
+ /// For a choice: its options, the first one chosen to start.
+ pub options: Vec<FieldOption>,
+ /// What it starts with.
+ pub value: String,
+}
+
+/// One option of a choice field.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FieldOption {
+ pub id: String,
+ pub label: String,
}
/// One way to connect a provider, as its sheet shows it.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProviderWay {
- /// `app-token`, `app-device`, `token`, `key`, `shell`.
+ /// `app-token`, `app-device`, `token`, `key`, `endpoint`, `shell`.
pub id: String,
+ /// The method kind from the provider file (`api_key`, `import_login`,
+ /// `subscription_login`, `custom_endpoint`; `shell` reads a key from the shell).
+ pub kind: String,
+ /// The method's id in the provider file.
+ pub method: String,
pub label: String,
pub help: String,
pub button: String,
@@ -987,6 +1078,11 @@ pub struct ProviderWay {
pub app: Option<String>,
/// For `shell`: the variable read from the shell.
pub env: Option<String>,
+ /// `required` (a key or token is pasted), `optional` (a key, if the server
+ /// asks for one) or `none`.
+ pub secret: String,
+ /// What it asks for besides the key.
+ pub fields: Vec<WayField>,
}
/// A provider's Connect sheet.
@@ -994,8 +1090,11 @@ pub struct ProviderWay {
#[serde(rename_all = "camelCase")]
pub struct ProviderSheetView {
pub provider: String,
+ pub icon: String,
pub title: String,
+ /// "Works with Claude Code, Hermes and OpenCode."
pub lede: String,
+ pub works_with: Vec<WorkChip>,
pub ways: Vec<ProviderWay>,
pub cancel_label: String,
/// The key field, when the person picks Paste a key.
@@ -1006,22 +1105,40 @@ pub struct ProviderSheetView {
pub token_label: String,
pub token_placeholder: String,
pub save_label: String,
- /// What `agentKeys.set` gets with a pasted key: `anthropic`, `openai`, or `other` with `key_env`.
- pub key_provider: String,
- pub key_env: Option<String>,
- /// "Or choose another provider", when the sheet was opened for an app
- /// that signs in with more than one.
- pub others_label: Option<String>,
- /// The app's other providers, each one a choice that swaps this sheet.
- pub others: Vec<ProviderChoice>,
+ /// A note to read before saving (a server on this machine), when there is one.
+ pub note: Option<String>,
+ /// "Other providers": opens the provider choice (for the app, when opened for one).
+ pub switch_label: String,
}
-/// One provider an app can sign in with.
+/// One provider in a choice.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProviderChoice {
pub provider: String,
pub label: String,
+ pub icon: String,
+ pub tier: String,
+ /// `connected`, `not-connected`.
+ pub state: String,
+ pub status: String,
+}
+
+/// The provider choice: the first tier, then (once More providers is open or
+/// something is typed) the rest, filtered by the search.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ProviderPickerView {
+ pub title: String,
+ /// "Providers Hermes can use", when opened for an app.
+ pub lede: String,
+ pub search_label: String,
+ pub items: Vec<ProviderChoice>,
+ /// "More providers" and how many are hidden, while closed and nothing is typed.
+ pub more_label: Option<String>,
+ pub more_count: u32,
+ pub empty: Option<String>,
+ pub cancel_label: String,
}
/// The sheet for `provider` (None: an unknown provider).
@@ -1029,8 +1146,83 @@ pub fn provider_sheet(input: &ConnectorsInput, provider_id: &str) -> Option<Prov
provider_sheet_on(input, provider_id, SpaceOs::Macos, None)
}
-/// [`provider_sheet`] in a shell on `os`, opened for `for_app` (its other
-/// providers are offered as a choice).
+fn wire_label(w: &str) -> &'static str {
+ match w {
+ "openai-chat" => "OpenAI chat",
+ "openai-responses" => "OpenAI responses",
+ "anthropic" => "Anthropic messages",
+ "gemini" => "Gemini",
+ _ => "Other",
+ }
+}
+
+fn way_fields(p: &reg::Provider, m: &reg::Method) -> Vec<WayField> {
+ let mut out = vec![];
+ if !p.regions.is_empty() {
+ out.push(WayField {
+ id: "region".into(),
+ label: if p.id == "zai" {
+ "Plan".into()
+ } else {
+ "Region".into()
+ },
+ kind: "choice".into(),
+ placeholder: String::new(),
+ required: true,
+ options: p
+ .regions
+ .iter()
+ .map(|r| FieldOption {
+ id: r.id.into(),
+ label: r.name.into(),
+ })
+ .collect(),
+ value: p.regions[0].id.into(),
+ });
+ }
+ for f in m.fields {
+ let options: Vec<FieldOption> = f
+ .options
+ .iter()
+ .map(|o| FieldOption {
+ id: (*o).into(),
+ label: if f.id == "wire" {
+ wire_label(o).into()
+ } else {
+ (*o).into()
+ },
+ })
+ .collect();
+ out.push(WayField {
+ id: f.id.into(),
+ label: f.label.into(),
+ kind: f.kind.into(),
+ placeholder: f.placeholder.into(),
+ required: f.required,
+ value: options.first().map(|o| o.id.clone()).unwrap_or_default(),
+ options,
+ });
+ }
+ // A provider with no default model asks for one when an app is told which to use.
+ if p.default_model.is_empty()
+ && p.kind != reg::Kind::Custom
+ && !p.delivery_for("hermes").is_empty()
+ {
+ out.push(WayField {
+ id: "model".into(),
+ label: "Model".into(),
+ kind: "text".into(),
+ placeholder: "The model id to use".into(),
+ required: true,
+ options: vec![],
+ value: String::new(),
+ });
+ }
+ out
+}
+
+/// [`provider_sheet`] in a shell on `os`, opened for `for_app` (an app's own
+/// sign-in is offered only in its sheet).
pub fn provider_sheet_on(
input: &ConnectorsInput,
provider_id: &str,
@@ -1039,84 +1231,123 @@ pub fn provider_sheet_on(
) -> Option<ProviderSheetView> {
let p = provider(provider_id)?;
let installed = |app: &str| input.app(app).is_some_and(|a| a.installed);
- let ways = p
- .ways
- .iter()
- .filter_map(|w| match *w {
+ let mut ways: Vec<ProviderWay> = vec![];
+ for m in p.offered() {
+ let way = |id: &str,
+ button: &str,
+ secret: &str,
+ app: Option<&str>,
+ env: Option<&str>,
+ fields: Vec<WayField>| ProviderWay {
+ id: id.into(),
+ kind: m.kind.word().into(),
+ method: m.id.into(),
+ label: m.label.into(),
+ help: m.help.into(),
+ button: button.into(),
+ app: app.map(Into::into),
+ env: env.map(Into::into),
+ secret: secret.into(),
+ fields,
+ };
+ match (m.kind, m.flow) {
// An app's own sign-in is that app's alone: another app's sheet offers a key.
- Way::AppToken {
- app, label, help, ..
- } => (installed(app) && for_app.is_none_or(|a| a == app)).then(|| ProviderWay {
- id: "app-token".into(),
- label: label.into(),
- help: help.into(),
- button: "Sign in".into(),
- app: Some(app.into()),
- env: None,
- }),
- Way::AppDevice {
- app, label, help, ..
- } => (installed(app) && for_app.is_none_or(|a| a == app)).then(|| ProviderWay {
- id: "app-device".into(),
- label: label.into(),
- help: help.into(),
- button: "Sign in".into(),
- app: Some(app.into()),
- env: None,
- }),
- Way::Token {
- app, label, help, ..
- } => for_app.is_none_or(|a| a == app).then(|| ProviderWay {
- id: "token".into(),
- label: label.into(),
- help: help.into(),
- button: "Paste token".into(),
- app: Some(app.into()),
- env: None,
- }),
- Way::Key => Some(ProviderWay {
- id: "key".into(),
- label: "Paste an API key".into(),
- help: p.key_help.into(),
- button: "Paste key".into(),
- app: None,
- env: None,
- }),
- Way::Shell => input
- .shell_keys
- .iter()
- .any(|k| k == p.env)
- .then(|| ProviderWay {
- id: "shell".into(),
- label: format!("Use {} from your shell", p.env),
- help: "Cua saves a copy now. It doesn't follow later changes in your shell."
- .into(),
- button: "Use it".into(),
- app: None,
- env: Some(p.env.into()),
- }),
- })
- .collect();
- let others: Vec<ProviderChoice> = for_app
- .and_then(app_sign_in)
- .map(|a| {
- a.providers
- .iter()
- .filter(|id| **id != p.id)
- .filter_map(|id| provider(id))
- .map(|o| ProviderChoice {
- provider: o.id.into(),
- label: o.label.into(),
- })
- .collect()
- })
- .unwrap_or_default();
+ (reg::MethodKind::ImportLogin, "") => {
+ if installed(m.app) && for_app.is_none_or(|a| a == m.app) {
+ ways.push(way(
+ "app-token",
+ "Sign in",
+ "none",
+ Some(m.app),
+ None,
+ vec![],
+ ));
+ }
+ }
+ (reg::MethodKind::ImportLogin, "paste") => {
+ if for_app.is_none_or(|a| a == m.app) {
+ ways.push(way(
+ "token",
+ "Paste token",
+ "required",
+ Some(m.app),
+ None,
+ vec![],
+ ));
+ }
+ }
+ (reg::MethodKind::SubscriptionLogin, "device_code") => {
+ if installed(m.app) && for_app.is_none_or(|a| a == m.app) {
+ ways.push(way(
+ "app-device",
+ "Sign in",
+ "none",
+ Some(m.app),
+ None,
+ vec![],
+ ));
+ }
+ }
+ (reg::MethodKind::ApiKey, _) => {
+ let mut w = way("key", "Paste key", "required", None, None, way_fields(p, m));
+ w.label = "Paste an API key".into();
+ w.help = p.key_help.into();
+ ways.push(w);
+ if input.shell_keys.iter().any(|k| k == m.env) {
+ let mut sh = way("shell", "Use it", "none", None, Some(m.env), vec![]);
+ sh.kind = "api_key".into();
+ sh.label = format!("Use {} from your shell", m.env);
+ sh.help =
+ "Cua saves a copy now. It doesn't follow later changes in your shell."
+ .into();
+ sh.fields = way_fields(p, m);
+ ways.push(sh);
+ }
+ }
+ (reg::MethodKind::CustomEndpoint, _) => {
+ let mut w = way(
+ "endpoint",
+ "Set up",
+ if m.secret_optional {
+ "optional"
+ } else {
+ "required"
+ },
+ None,
+ None,
+ way_fields(p, m),
+ );
+ w.label = "Connect a server by its base URL".into();
+ w.help = p.key_help.into();
+ ways.push(w);
+ }
+ // Methods Cua does not run yet (browser approval, cloud credentials,
+ // a local server probe) are not offered.
+ _ => {}
+ }
+ }
+ let works_with = chips(p);
+ let lede = if works_with.is_empty() {
+ String::new()
+ } else {
+ format!(
+ "Works with {}.",
+ and_list(
+ &works_with
+ .iter()
+ .map(|c| c.name.as_str())
+ .collect::<Vec<_>>()
+ )
+ )
+ };
let this = os.this_machine_lower();
let place = vault(os).map(|v| format!("in {v} ")).unwrap_or_default();
Some(ProviderSheetView {
provider: p.id.into(),
- title: format!("Connect {}", p.label),
- lede: format!("For {}", p.used_by),
+ icon: p.icon.into(),
+ title: format!("Connect {}", p.name),
+ lede,
+ works_with,
ways,
cancel_label: "Cancel".into(),
key_label: "API key".into(),
@@ -1125,18 +1356,65 @@ pub fn provider_sheet_on(
token_label: "Claude token".into(),
token_placeholder: "sk-ant-oat01-\u{2026}".into(),
save_label: "Save".into(),
- key_provider: if matches!(p.id, "anthropic" | "openai") {
- p.id
- } else {
- "other"
- }
- .into(),
- key_env: (!matches!(p.id, "anthropic" | "openai")).then(|| p.env.into()),
- others_label: (!others.is_empty()).then(|| "Or choose another provider".into()),
- others,
+ note: (p.kind == reg::Kind::Custom).then(|| {
+ format!(
+ "A server on {this} is only reachable from a Space that is allowed to reach that port. Cua doesn't open it for you."
+ )
+ }),
+ switch_label: "Other providers".into(),
})
}
+/// The provider choice, for `for_app` when given (only providers it can use).
+/// Closed and with no search it lists the first tier and counts the rest;
+/// `expanded` or a typed `query` lists every match.
+pub fn provider_picker(
+ input: &ConnectorsInput,
+ for_app: Option<&str>,
+ query: &str,
+ expanded: bool,
+) -> ProviderPickerView {
+ let usable: Vec<&'static reg::Provider> = match for_app.and_then(app_sign_in) {
+ Some(a) => a.providers.clone(),
+ None => reg::visible().collect(),
+ };
+ let choice = |p: &reg::Provider| {
+ let row = provider_row(input, p, true);
+ ProviderChoice {
+ provider: p.id.into(),
+ label: p.name.into(),
+ icon: p.icon.into(),
+ tier: row.tier,
+ state: row.state,
+ status: row.status,
+ }
+ };
+ let searching = !query.trim().is_empty();
+ let open = expanded || searching;
+ let up_front =
+ |p: &reg::Provider| p.tier == reg::Tier::Top || provider_credential(input, p).is_some();
+ let items: Vec<ProviderChoice> = usable
+ .iter()
+ .filter(|p| provider_matches(p, query))
+ .filter(|p| open || up_front(p))
+ .map(|p| choice(p))
+ .collect();
+ let hidden = usable.iter().filter(|p| !up_front(p)).count() as u32;
+ ProviderPickerView {
+ title: "Connect a provider".into(),
+ lede: match for_app.and_then(|a| input.row_app(a)) {
+ Some(a) if for_app.is_some() => format!("Providers {} can use.", a.name),
+ _ => String::new(),
+ },
+ search_label: "Search providers".into(),
+ empty: (open && items.is_empty()).then(|| "No provider matches that.".to_string()),
+ more_label: (!open && hidden > 0).then(|| "More providers".to_string()),
+ more_count: if open { 0 } else { hidden },
+ items,
+ cancel_label: "Cancel".into(),
+ }
+}
+
/// What importing Claude Code's sign-in says before it reads anything, and
/// what it offers when there is nothing to import.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@@ -1294,7 +1572,7 @@ fn way_text(app: &str) -> &'static str {
}
"copilot-cli" => "Connect asks for a GitHub token with the Copilot Requests permission.",
"hermes" | "opencode" | "goose" | "pi" | "openclaw" => {
- "It runs in your Spaces with a key from any of these providers."
+ "It runs in your Spaces with a key from any provider you connect."
}
_ => "It uses whichever of these providers you connect.",
}
@@ -1338,25 +1616,27 @@ pub fn app_detail(input: &ConnectorsInput, agent: &str) -> Option<AppDetailView>
}
let sign_in = app_sign_in(agent).map(|s| {
// The provider it uses: the first connected one, else the first.
- let pid = s
+ let p = s
.providers
.iter()
- .find(|p| provider_connected(input, p))
+ .find(|p| provider_connected(input, p.id))
.or(s.providers.first())
- .copied()
- .unwrap_or_default();
- let p = provider(pid);
+ .copied();
+ let pid = p.map(|p| p.id).unwrap_or_default();
let prow = p.map(|p| provider_row(input, p, can_edit));
let connected = prow.as_ref().is_some_and(|r| r.state == "connected");
- let names: Vec<&str> = s
- .providers
- .iter()
- .filter_map(|p| provider(p))
- .map(|p| p.label)
- .collect();
+ let names: Vec<&str> = s.providers.iter().map(|p| p.name).collect();
+ let names = if names.len() > 3 && s.way.is_none() {
+ "a connected provider".to_string()
+ } else {
+ or_list(&names)
+ };
ConnectorSignIn {
- title: format!("Signs in with {}", or_list(&names)),
- status: prow.as_ref().map(|r| r.status.clone()).unwrap_or_default(),
+ title: format!("Signs in with {names}"),
+ status: prow
+ .as_ref()
+ .map(|r| r.credential.clone().unwrap_or_else(|| r.status.clone()))
+ .unwrap_or_default(),
connected,
way: way_text(agent).into(),
provider: pid.into(),
@@ -1376,7 +1656,7 @@ pub fn app_detail(input: &ConnectorsInput, agent: &str) -> Option<AppDetailView>
Some(AppDetailView {
agent: a.agent.clone(),
name: a.name.clone(),
- back_label: "Connectors".into(),
+ back_label: "Connections".into(),
status: match row.state.as_str() {
"connected" => signed_in_as(input, agent).unwrap_or_else(|| "Connected".into()),
_ => row.line.clone().unwrap_or_else(|| "Not connected".into()),
@@ -1417,12 +1697,28 @@ pub struct SetupCardView {
}
/// The card for a task whose app `agent` (called `name`) can't sign in.
+/// `provider` is the provider that refused it, when a run said which.
pub fn setup_card(input: &ConnectorsInput, agent: &str, name: &str) -> SetupCardView {
+ setup_card_for(input, agent, name, None)
+}
+
+/// [`setup_card`] for a failure that named `provider`.
+pub fn setup_card_for(
+ input: &ConnectorsInput,
+ agent: &str,
+ name: &str,
+ provider_id: Option<&str>,
+) -> SetupCardView {
let plan = connect_plan(input, agent);
- let provider = app_sign_in(agent)
- .and_then(|s| s.providers.first())
- .and_then(|p| provider(p))
- .map(|p| p.label);
+ let s = app_sign_in(agent);
+ let provider = provider_id
+ .and_then(provider)
+ .or_else(|| {
+ s.as_ref()
+ .filter(|s| s.providers.len() == 1 || s.way.is_some())
+ .and_then(|s| s.providers.first().copied())
+ })
+ .map(|p| p.name);
let body = match provider {
Some(p) if plan.app_token => format!(
"{name} needs a sign-in to {p} to work here. Connect it once: Cua uses the sign-in {name} already has on this machine, and every Space can use it."
@@ -1430,6 +1726,9 @@ pub fn setup_card(input: &ConnectorsInput, agent: &str, name: &str) -> SetupCard
Some(p) => format!(
"{name} needs a sign-in to {p} to work here. Connect it once and every Space can use it."
),
+ None if s.as_ref().is_some_and(|s| s.providers.len() > 1) => format!(
+ "{name} needs a connected provider to work here. Connect one once and every Space can use it."
+ ),
None => format!("Connect {name} once and every Space can use it."),
};
SetupCardView {
@@ -1480,6 +1779,8 @@ mod tests {
added_ms: 1_000,
expired: false,
label: None,
+ region: None,
+ fields: Default::default(),
}
}
@@ -1535,20 +1836,28 @@ mod tests {
assert!(shown.button.as_ref().is_some_and(|b| b.enabled));
}
assert_eq!(HARNESS_APPS.len(), cua_agents::harness::HARNESSES.len());
- // Each provider an app offers saves a credential the app reads, so
- // connecting it connects the app.
+ // Each provider an app offers connects it: it delivers a variable the app
+ // reads, or the app is pointed at the provider's endpoint.
for h in HARNESS_APPS {
let a = app_sign_in(h.app).unwrap();
- for id in a.providers {
- let p = provider(id).unwrap();
- let saves_a_read = a.reads.contains(&p.env)
- || p.ways.iter().any(|w| match w {
- Way::AppToken { env, .. } | Way::AppDevice { env, .. } => {
- a.reads.contains(env)
- }
- _ => false,
- });
- assert!(saves_a_read, "{}: {id} saves nothing it reads", h.app);
+ assert!(!a.providers.is_empty(), "{}", h.app);
+ for p in &a.providers {
+ let native = p.delivery_for(h.harness);
+ if native.is_empty() {
+ assert!(
+ reg::ENDPOINT_HARNESSES.iter().any(|(x, _)| *x == h.harness),
+ "{}: {} saves nothing it reads",
+ h.app,
+ p.id
+ );
+ } else {
+ assert!(
+ native.iter().all(|e| a.reads.contains(&e.dest)),
+ "{}: {}",
+ h.app,
+ p.id
+ );
+ }
}
}
}
@@ -1574,10 +1883,7 @@ mod tests {
);
let hermes = v.apps.iter().find(|a| a.agent == "hermes").unwrap();
assert_eq!(hermes.name, "Hermes");
- assert_eq!(
- hermes.line.as_deref(),
- Some("Needs an API key for Anthropic or OpenAI.")
- );
+ assert_eq!(hermes.line.as_deref(), Some("Needs a connected provider."));
// The other apps Cua knows (not agents) wait under Show all with where to get them.
let mut i = input();
i.apps.push(ConnectorAppInput {
@@ -1640,23 +1946,61 @@ mod tests {
token_provider: None
}
);
- let s = provider_sheet_on(&i, "anthropic", SpaceOs::Macos, Some("opencode")).unwrap();
- let others: Vec<_> = s.others.iter().map(|o| o.provider.as_str()).collect();
- assert_eq!(others, ["openai", "google", "openrouter"]);
+ // The choice lists the first tier for the app, then the rest on request.
+ let pick = provider_picker(&i, Some("opencode"), "", false);
+ let up_front: Vec<_> = pick.items.iter().map(|c| c.provider.as_str()).collect();
assert_eq!(
- s.others_label.as_deref(),
- Some("Or choose another provider")
+ up_front,
+ [
+ "anthropic",
+ "openai",
+ "openrouter",
+ "google",
+ "xai",
+ "deepseek",
+ "kimi",
+ "custom"
+ ]
);
- // OpenRouter is a key, saved under the variable its apps read.
- let o = provider_sheet_on(&i, "openrouter", SpaceOs::Macos, Some("hermes")).unwrap();
+ assert_eq!(pick.more_label.as_deref(), Some("More providers"));
+ assert!(pick.more_count > 10);
+ let found = provider_picker(&i, Some("opencode"), "fire", false);
+ assert_eq!(
+ found
+ .items
+ .iter()
+ .map(|c| c.provider.as_str())
+ .collect::<Vec<_>>(),
+ ["fireworks"]
+ );
+ assert!(found.more_label.is_none());
+ assert!(
+ provider_picker(&i, Some("opencode"), "zzzz", false)
+ .empty
+ .is_some()
+ );
+ // Claude Code takes Anthropic only, so there is nothing to choose.
+ let cc = provider_picker(&i, Some("claude-code"), "", true);
assert_eq!(
- (o.key_provider.as_str(), o.key_env.as_deref()),
- ("other", Some("OPENROUTER_API_KEY"))
+ cc.items
+ .iter()
+ .map(|c| c.provider.as_str())
+ .collect::<Vec<_>>(),
+ ["anthropic"]
);
+ let s = provider_sheet_on(&i, "anthropic", SpaceOs::Macos, Some("opencode")).unwrap();
+ assert_eq!(s.switch_label, "Other providers");
+ // OpenRouter is an API key.
+ let o = provider_sheet_on(&i, "openrouter", SpaceOs::Macos, Some("hermes")).unwrap();
let ids: Vec<_> = o.ways.iter().map(|w| w.id.as_str()).collect();
assert_eq!(ids, ["key"]);
- // Without an app there is no choice to offer.
- assert!(provider_sheet(&i, "anthropic").unwrap().others.is_empty());
+ assert_eq!(o.ways[0].kind, "api_key");
+ assert_eq!(o.ways[0].secret, "required");
+ assert!(
+ o.lede.starts_with("Works with ") && o.lede.contains("Hermes"),
+ "{}",
+ o.lede
+ );
}
#[test]
@@ -1666,7 +2010,7 @@ mod tests {
assert!(d.toggles.is_empty() && d.tools_title.is_empty());
assert_eq!(
d.sign_in.as_ref().unwrap().title,
- "Signs in with OpenAI, Anthropic or OpenRouter"
+ "Signs in with a connected provider"
);
assert_eq!(d.connect.as_ref().unwrap().label, "Connect");
assert!(d.remove_label.is_none() && d.settings_file.is_none());
@@ -1721,7 +2065,7 @@ mod tests {
fn apps_start_with_connect_and_providers_not_connected() {
let v = view(&input());
assert_eq!(v.apps_title, "Coding apps");
- assert_eq!(v.providers_title, "Providers");
+ assert_eq!(v.providers_title, "Connections");
let claude = &v.apps[0];
assert_eq!(claude.state, "not-connected");
assert_eq!(claude.button.as_ref().unwrap().label, "Connect");
@@ -1734,13 +2078,22 @@ mod tests {
let ids: Vec<_> = v.providers.iter().map(|p| p.id.as_str()).collect();
assert_eq!(
ids,
- ["anthropic", "openai", "google", "openrouter", "github"]
- );
- assert!(
- v.providers
- .iter()
- .all(|p| p.status == "Not connected" && p.button.label == "Connect")
+ [
+ "anthropic",
+ "openai",
+ "openrouter",
+ "google",
+ "xai",
+ "deepseek",
+ "kimi",
+ "custom"
+ ]
);
+ assert!(v.providers.iter().all(|p| p.status == "Not connected"
+ && p.button.label == "Connect"
+ && p.credential.is_none()));
+ // Everything else waits in the searchable list, closed until opened.
+ assert!(v.more_providers.is_empty() && v.more_count > 10);
}
#[test]
@@ -1763,8 +2116,9 @@ mod tests {
assert_eq!(v.apps[0].state, "connected");
let a = &v.providers[0];
assert_eq!(a.state, "connected");
- assert_eq!(a.status, "Signed in to Claude");
- assert_eq!(a.button.label, "Sign out");
+ assert_eq!(a.status, "Connected");
+ assert_eq!(a.credential.as_deref(), Some("Signed in to Claude"));
+ assert_eq!(a.button.label, "Disconnect");
assert_eq!(a.sign_out_envs, ["CLAUDE_CODE_OAUTH_TOKEN"]);
// The sign-in token is the provider's, not an Other key.
assert!(v.others.is_empty());
@@ -1776,9 +2130,10 @@ mod tests {
i.keys.keys.push(key("OPENAI_API_KEY", "3f9a"));
i.keys.keys.push(key("MISTRAL_API_KEY", "9999"));
let v = view(&i);
+ assert_eq!(v.providers[1].status, "Connected");
assert_eq!(
- v.providers[1].status,
- "API key \u{2022}\u{2022}\u{2022}\u{2022} 3f9a"
+ v.providers[1].credential.as_deref(),
+ Some("API key \u{2022}\u{2022}\u{2022}\u{2022} 3f9a")
);
assert_eq!(v.apps[1].state, "connected");
assert_eq!(v.others.len(), 1);
@@ -1889,11 +2244,11 @@ mod tests {
let ids: Vec<_> = s.ways.iter().map(|w| w.id.as_str()).collect();
// A token from `claude setup-token` can be pasted without Claude Code here.
assert_eq!(ids, ["token", "key"]);
- assert_eq!((s.key_provider.as_str(), s.key_env), ("anthropic", None));
+ assert_eq!(s.provider, "anthropic");
let g = provider_sheet(&i, "github").unwrap();
assert_eq!(
- (g.key_provider.as_str(), g.key_env.as_deref()),
- ("other", Some("COPILOT_GITHUB_TOKEN"))
+ g.ways.iter().map(|w| w.id.as_str()).collect::<Vec<_>>(),
+ ["key"]
);
assert!(provider_sheet(&i, "nope").is_none());
}
@@ -1950,7 +2305,8 @@ mod tests {
let v = view(&i);
assert_eq!(v.apps[0].state, "connected");
assert_eq!(v.apps[0].line.as_deref(), Some(who));
- assert_eq!(v.providers[0].status, who);
+ assert_eq!(v.providers[0].status, "Connected");
+ assert_eq!(v.providers[0].credential.as_deref(), Some(who));
let d = app_detail(&i, "claude-code").unwrap();
assert_eq!(d.status, who);
assert_eq!(d.sign_in.as_ref().unwrap().status, who);
@@ -1959,7 +2315,10 @@ mod tests {
let mut j = input();
j.apps[0].configured = true;
j.keys.keys.push(key("CLAUDE_CODE_OAUTH_TOKEN", "AAAA"));
- assert_eq!(view(&j).providers[0].status, "Signed in to Claude");
+ assert_eq!(
+ view(&j).providers[0].credential.as_deref(),
+ Some("Signed in to Claude")
+ );
}
#[test]
@@ -1990,10 +2349,7 @@ mod tests {
i.keys.keys.push(k);
let v = view(&i);
let hermes = v.apps.iter().find(|a| a.agent == "hermes").unwrap();
- assert_eq!(
- hermes.line.as_deref(),
- Some("Needs an API key for Anthropic or OpenAI.")
- );
+ assert_eq!(hermes.line.as_deref(), Some("Needs a connected provider."));
assert_eq!(hermes.button.as_ref().unwrap().label, "Connect");
let claude = v.apps.iter().find(|a| a.agent == "claude-code").unwrap();
assert_eq!(claude.button.as_ref().unwrap().label, "Reconnect");
@@ -2072,4 +2428,295 @@ mod tests {
);
assert!(v.providers.iter().all(|p| !p.button.enabled));
}
+
+ fn keyed(env: &str, provider: &str) -> AgentKeyInput {
+ let mut k = key(env, "abcd");
+ k.provider = provider.into();
+ k
+ }
+
+ #[test]
+ fn a_row_says_which_apps_it_works_with() {
+ let v = view(&input());
+ let names = |id: &str| -> Vec<String> {
+ v.providers
+ .iter()
+ .find(|p| p.id == id)
+ .unwrap()
+ .works_with
+ .iter()
+ .map(|c| c.name.clone())
+ .collect()
+ };
+ assert_eq!(
+ names("anthropic"),
+ [
+ "Claude Code",
+ "OpenCode",
+ "Goose",
+ "Pi",
+ "Hermes",
+ "OpenClaw",
+ "T3 Code"
+ ]
+ );
+ assert_eq!(
+ names("openai"),
+ [
+ "OpenAI Codex",
+ "OpenCode",
+ "Goose",
+ "Pi",
+ "Hermes",
+ "OpenClaw",
+ "T3 Code"
+ ]
+ );
+ assert_eq!(
+ names("deepseek"),
+ ["OpenCode", "Goose", "Pi", "Hermes", "OpenClaw"]
+ );
+ // Only Claude Code takes the Anthropic sign-in, and the chips never claim it elsewhere.
+ for row in v.providers.iter().chain(v.more_providers.iter()) {
+ assert_eq!(row.works_with_label, "Works with");
+ assert_eq!(
+ row.works_with.iter().any(|c| c.agent == "claude-code"),
+ row.id == "anthropic",
+ "{}",
+ row.id
+ );
+ }
+ // A chip opens its app's page: it is the app's setup id.
+ let c = &v.providers[0].works_with[0];
+ assert_eq!(
+ (c.agent.as_str(), c.name.as_str()),
+ ("claude-code", "Claude Code")
+ );
+ }
+
+ #[test]
+ fn more_providers_is_a_closed_searchable_list_and_a_connected_one_never_hides_in_it() {
+ let mut i = input();
+ let v = view(&i);
+ assert!(v.more_providers.is_empty());
+ assert!(v.more_count as usize >= 20, "{}", v.more_count);
+ i.more_open = true;
+ let v = view(&i);
+ let ids: Vec<_> = v.more_providers.iter().map(|p| p.id.as_str()).collect();
+ assert!(
+ ids.contains(&"huggingface")
+ && ids.contains(&"zai")
+ && ids.contains(&"fireworks")
+ && ids.contains(&"nvidia")
+ && ids.contains(&"ollama-cloud")
+ );
+ // Hidden providers (unreviewed logins, unverified ones) never show.
+ for hidden in [
+ "nous",
+ "qwen-oauth",
+ "minimax-oauth",
+ "xai-oauth",
+ "vertex",
+ "bedrock",
+ "azure-foundry",
+ "meta-ai",
+ ] {
+ assert!(!ids.contains(&hidden), "{hidden} is hidden");
+ assert!(!v.providers.iter().any(|p| p.id == hidden));
+ }
+ // Search by name, id or alias; each word starts a word.
+ for (q, want) in [
+ ("hugg", "huggingface"),
+ ("hf", "huggingface"),
+ ("glm", "zai"),
+ ("z.ai", "zai"),
+ ("nim", "nvidia"),
+ ("fire", "fireworks"),
+ ("together", ""),
+ ] {
+ i.query = q.into();
+ let v = view(&i);
+ let got: Vec<_> = v.more_providers.iter().map(|p| p.id.as_str()).collect();
+ if want.is_empty() {
+ assert!(got.is_empty() && v.more_empty.is_some(), "{q}: {got:?}");
+ } else {
+ assert!(got.contains(&want), "{q}: {got:?}");
+ }
+ }
+ // A search opens the list by itself, and a match for nothing says so.
+ i.more_open = false;
+ i.query = "fireworks".into();
+ assert_eq!(view(&i).more_providers.len(), 1);
+ i.query = "zzz".into();
+ assert_eq!(
+ view(&i).more_empty.as_deref(),
+ Some("No provider matches that.")
+ );
+ // One that is connected moves up front, and one that needs reconnecting too.
+ let mut c = input();
+ c.keys.keys.push(keyed("FIREWORKS_API_KEY", "fireworks"));
+ let mut r = keyed("HF_TOKEN", "huggingface");
+ r.expired = true;
+ c.keys.keys.push(r);
+ let v = view(&c);
+ let up: Vec<_> = v
+ .providers
+ .iter()
+ .map(|p| (p.id.as_str(), p.state.as_str(), p.status.as_str()))
+ .collect();
+ assert!(
+ up.contains(&("fireworks", "connected", "Connected")),
+ "{up:?}"
+ );
+ assert!(
+ up.contains(&("huggingface", "not-connected", "Needs reconnect")),
+ "{up:?}"
+ );
+ assert!(v.providers.len() == 10);
+ }
+
+ #[test]
+ fn an_app_is_connected_by_any_provider_it_is_pointed_at_and_a_custom_endpoint_needs_its_url() {
+ // DeepSeek is no variable OpenCode reads, but OpenCode is pointed at its endpoint.
+ let mut i = ConnectorsInput::default();
+ i.keys.keys.push(keyed("DEEPSEEK_API_KEY", "deepseek"));
+ assert!(app_signed_in(&i, "opencode"));
+ assert!(app_signed_in(&i, "hermes"));
+ // Claude Code, Gemini and Codex (it speaks the Responses wire) are not.
+ for app in ["claude-code", "gemini-cli", "codex"] {
+ assert!(!app_signed_in(&i, app), "{app}");
+ }
+ // A custom endpoint counts only with a URL and a model.
+ let mut c = ConnectorsInput::default();
+ c.keys.keys.push(keyed("CUSTOM_ENDPOINT_API_KEY", "custom"));
+ assert!(!app_signed_in(&c, "opencode"));
+ c.keys.keys[0]
+ .fields
+ .insert("base_url".into(), "http://127.0.0.1:1234/v1".into());
+ c.keys.keys[0].fields.insert("model".into(), "qwen".into());
+ assert!(app_signed_in(&c, "opencode") && app_signed_in(&c, "hermes"));
+ let v = view(&c);
+ let row = v.providers.iter().find(|p| p.id == "custom").unwrap();
+ assert_eq!(
+ (row.state.as_str(), row.credential.as_deref()),
+ ("connected", Some("http://127.0.0.1:1234/v1"))
+ );
+ assert_eq!(row.button.label, "Disconnect");
+ assert_eq!(row.sign_out_envs, ["CUSTOM_ENDPOINT_API_KEY"]);
+ }
+
+ #[test]
+ fn the_sheet_asks_only_for_what_the_method_needs() {
+ let i = input();
+ // A plan chooser for Z.AI, which bills its plans separately.
+ let z = provider_sheet(&i, "zai").unwrap();
+ let key = &z.ways[0];
+ assert_eq!((key.id.as_str(), key.kind.as_str()), ("key", "api_key"));
+ let plan = key.fields.iter().find(|f| f.id == "region").unwrap();
+ assert_eq!(
+ (plan.label.as_str(), plan.kind.as_str(), plan.value.as_str()),
+ ("Plan", "choice", "global")
+ );
+ assert_eq!(
+ plan.options
+ .iter()
+ .map(|o| o.label.as_str())
+ .collect::<Vec<_>>(),
+ [
+ "Global",
+ "China",
+ "Global, Coding Plan",
+ "China, Coding Plan"
+ ]
+ );
+ // A provider with no default model asks for one.
+ let d = provider_sheet(&i, "deepinfra").unwrap();
+ assert!(
+ d.ways[0]
+ .fields
+ .iter()
+ .any(|f| f.id == "model" && f.required)
+ );
+ let o = provider_sheet(&i, "openrouter").unwrap();
+ assert!(o.ways[0].fields.is_empty());
+ // A custom endpoint: URL, model and API style, a key only if the server asks.
+ let c = provider_sheet(&i, "custom").unwrap();
+ let w = &c.ways[0];
+ assert_eq!(
+ (w.id.as_str(), w.kind.as_str(), w.secret.as_str()),
+ ("endpoint", "custom_endpoint", "optional")
+ );
+ let ids: Vec<_> = w.fields.iter().map(|f| f.id.as_str()).collect();
+ assert_eq!(ids, ["base_url", "model", "wire"]);
+ assert!(w.fields.iter().all(|f| f.required));
+ assert_eq!(w.fields[2].value, "openai-chat");
+ let note = c.note.as_deref().unwrap();
+ assert!(
+ note.contains("only reachable from a Space that is allowed to reach that port"),
+ "{note}"
+ );
+ // The Anthropic sheet offers the Claude sign-in only where Claude Code is, and says who uses it.
+ let a = provider_sheet(&i, "anthropic").unwrap();
+ assert_eq!(
+ a.ways.iter().map(|w| w.kind.as_str()).collect::<Vec<_>>(),
+ ["import_login", "import_login", "api_key"]
+ );
+ // Hidden providers have no sheet.
+ for hidden in ["nous", "xai-oauth", "qwen-oauth", "minimax-oauth", "vertex"] {
+ assert!(provider_sheet(&i, hidden).is_none(), "{hidden}");
+ }
+ // OpenAI offers the ChatGPT sign-in to Codex only.
+ let mut j = input();
+ j.apps.push(app("codex", "OpenAI Codex", true));
+ let for_hermes = provider_sheet_on(&j, "openai", SpaceOs::Macos, Some("hermes")).unwrap();
+ assert_eq!(
+ for_hermes
+ .ways
+ .iter()
+ .map(|w| w.id.as_str())
+ .collect::<Vec<_>>(),
+ ["key"]
+ );
+ let for_codex = provider_sheet_on(&j, "openai", SpaceOs::Macos, Some("codex")).unwrap();
+ assert_eq!(
+ for_codex
+ .ways
+ .iter()
+ .map(|w| w.id.as_str())
+ .collect::<Vec<_>>(),
+ ["app-device", "key"]
+ );
+ }
+
+ #[test]
+ fn the_connect_card_for_a_refused_provider_names_it() {
+ let i = ConnectorsInput::default();
+ let c = setup_card_for(&i, "hermes", "Hermes", Some("openrouter"));
+ assert!(c.body.contains("OpenRouter"), "{}", c.body);
+ let c = setup_card(&i, "hermes", "Hermes");
+ assert!(c.body.contains("a connected provider"), "{}", c.body);
+ assert_eq!(c.connect_label, "Connect Hermes");
+ // The plan for Hermes asks which provider.
+ let plan = connect_plan(&i, "hermes");
+ assert_eq!(plan.provider.as_deref(), Some("anthropic"));
+ }
+
+ #[test]
+ fn nothing_the_connections_say_has_a_dot_separator_or_says_devices() {
+ let mut i = input();
+ i.more_open = true;
+ let mut all = format!("{:?}", view(&i));
+ for p in reg::visible() {
+ all += &format!("{:?}", provider_sheet(&i, p.id));
+ }
+ all += &format!("{:?}", provider_picker(&i, None, "", true));
+ assert!(!all.contains('\u{b7}'), "no middle dot");
+ // `app-device` is the way's id, not a word anyone reads.
+ assert!(
+ !all.replace("app-device", "")
+ .to_lowercase()
+ .contains("device"),
+ "machines, not devices"
+ );
+ }
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
index 81d7aeed3d..335137d44b 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
@@ -199,6 +199,7 @@ pub const METHODS: &[&str] = &[
"connectors.view",
"connectors.connectPlan",
"connectors.providerSheet",
+ "connectors.providerPicker",
"connectors.importSheet",
"connectors.appDetail",
"connectors.setupCard",
@@ -1006,6 +1007,12 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
.unwrap_or(SpaceOs::Macos),
a.get::<Option<String>>("forApp")?.as_deref(),
)),
+ "connectors.providerPicker" => out(connectors::provider_picker(
+ &a.get("input")?,
+ a.get::<Option<String>>("forApp")?.as_deref(),
+ &a.get::<Option<String>>("query")?.unwrap_or_default(),
+ a.get::<Option<bool>>("expanded")?.unwrap_or(false),
+ )),
"connectors.importSheet" => out(connectors::import_sheet_on(
a.get::<Option<SpaceOs>>("hostOs")?
.unwrap_or(SpaceOs::Macos),
@@ -1014,10 +1021,11 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
&a.get("input")?,
&a.get::<String>("agent")?,
)),
- "connectors.setupCard" => out(connectors::setup_card(
+ "connectors.setupCard" => out(connectors::setup_card_for(
&a.get("input")?,
&a.get::<String>("agent")?,
&a.get::<String>("name")?,
+ a.get::<Option<String>>("provider")?.as_deref(),
)),
"summon.candidates" => out(summon::candidates(&a.get("input")?)),
"summon.plan" => out(summon::plan(&a.get("input")?, &a.get::<String>("text")?)),
diff --git a/libs/cua/crates/cua-spaces-app-core/src/first_run.rs b/libs/cua/crates/cua-spaces-app-core/src/first_run.rs
index 8b2b16a2b8..e027407141 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/first_run.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/first_run.rs
@@ -2045,6 +2045,8 @@ mod tests {
added_ms: 1,
expired: false,
label: None,
+ region: None,
+ fields: Default::default(),
})
.collect(),
..Default::default()
diff --git a/libs/cua/crates/cua-spaces-app-core/src/lib.rs b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
index 8dc3b07118..3b20d6637a 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
@@ -34,7 +34,7 @@
//! | [`experiments`] | Settings, Experiments: one switch per feature still being built, and what each hides while off |
//! | [`login_item`] | launch at login: the Settings toggle, the first run's Done checkbox, when the app turns it on |
//! | [`agent_keys`] | Settings, Agents: the provider keys agents get (rows, the add or replace sheet, names refused, the remove question) |
-//! | [`connectors`] | Settings, Connectors: coding apps with Connect, their pages, Providers, the provider sheet, a task's setup card |
+//! | [`connectors`] | Settings, Connections: coding apps with Connect, their pages, Providers, the provider sheet, a task's setup card |
//! | [`summon`] | @mentioning agents in a Space: the composer's picker, what sending does, why an agent can't be woken, Ask first's first message |
//! | [`profile_card`] | the card a person or an agent opens to in a Space: access, presence, who runs an agent and on what, its status, Details |
//! | [`agent_list`] | every agent you work with as one list (agents in Spaces and this device's unfinished runs): the Agents page and Home draw it |
diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
index c2e0051fde..1f28967f52 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -5029,7 +5029,7 @@ fn run_pro_banner(f: &Value, h: &dyn Host) -> Result<Value, String> {
Ok(json!({ "flow": "pro-banner", "frames": frames }))
}
-/// Settings, Connectors (redesign), summoning agents and the one agent list.
+/// Settings, Connections (redesign), summoning agents and the one agent list.
fn run_connectors(f: &Value, h: &dyn Host) -> Result<Value, String> {
let line = |parts: &[&Value]| {
parts
@@ -5060,13 +5060,44 @@ fn run_connectors(f: &Value, h: &dyn Host) -> Result<Value, String> {
])
})
.collect();
+ let row = |p: &Value| {
+ let chips: Vec<String> = p["worksWith"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|c| c["name"].as_str().unwrap_or_default().to_string())
+ .collect();
+ line(&[
+ &p["id"],
+ &p["tier"],
+ &p["state"],
+ &p["status"],
+ &p["credential"],
+ &json!(chips.join(", ")),
+ &p["button"]["label"],
+ ])
+ };
let providers: Vec<String> = v["providers"]
.as_array()
.into_iter()
.flatten()
- .map(|p| line(&[&p["id"], &p["state"], &p["status"], &p["button"]["label"]]))
+ .map(row)
.collect();
- frames.push(json!({ "step": step["step"], "apps": apps, "providers": providers, "footer": v["providersFooter"] }));
+ let more: Vec<String> = v["moreProviders"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(row)
+ .collect();
+ frames.push(json!({
+ "step": step["step"],
+ "apps": apps,
+ "title": v["providersTitle"],
+ "providers": providers,
+ "more": line(&[&v["moreTitle"], &v["moreCount"], &v["moreEmpty"]]),
+ "moreProviders": more,
+ "footer": v["providersFooter"],
+ }));
last = step["input"].clone();
}
let first = &f["connectors"][0]["input"];
@@ -5076,13 +5107,59 @@ fn run_connectors(f: &Value, h: &dyn Host) -> Result<Value, String> {
"connectors.providerSheet",
json!({ "input": first, "provider": p }),
)?;
- let ways: Vec<String> = s["ways"]
+ let ways: Vec<Value> = s["ways"]
.as_array()
.into_iter()
.flatten()
- .map(|w| line(&[&w["id"], &w["label"], &w["button"]]))
+ .map(|w| {
+ let fields: Vec<String> = w["fields"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|f| {
+ line(&[
+ &f["id"],
+ &f["label"],
+ &f["kind"],
+ &f["required"],
+ &f["value"],
+ ])
+ })
+ .collect();
+ json!({
+ "way": line(&[&w["id"], &w["kind"], &w["label"], &w["button"], &w["secret"]]),
+ "fields": fields,
+ })
+ })
+ .collect();
+ frames.push(json!({
+ "sheet": p,
+ "title": s["title"],
+ "lede": s["lede"],
+ "ways": ways,
+ "note": s["note"],
+ "switch": s["switchLabel"],
+ }));
+ }
+ for pk in f["pickers"].as_array().into_iter().flatten() {
+ let v = c(
+ h,
+ "connectors.providerPicker",
+ json!({ "input": first, "forApp": pk["forApp"], "query": pk["query"], "expanded": pk["expanded"] }),
+ )?;
+ let items: Vec<String> = v["items"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|i| line(&[&i["provider"], &i["tier"], &i["state"]]))
.collect();
- frames.push(json!({ "sheet": p, "title": s["title"], "ways": ways, "key": line(&[&s["keyProvider"], &s["keyEnv"]]) }));
+ frames.push(json!({
+ "picker": pk,
+ "title": v["title"],
+ "lede": v["lede"],
+ "items": items,
+ "more": line(&[&v["moreLabel"], &v["moreCount"], &v["empty"]]),
+ }));
}
for os in ["macos", "linux"] {
let s = c(h, "connectors.importSheet", json!({ "hostOs": os }))?;
diff --git a/libs/cua/crates/cua-spaces-app-core/src/profile_card.rs b/libs/cua/crates/cua-spaces-app-core/src/profile_card.rs
index 848ec8febc..8e12040335 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/profile_card.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/profile_card.rs
@@ -151,7 +151,7 @@ pub fn person(i: &PersonCardInput) -> PersonCardView {
// ------------------------------------------------------------------ agents
-/// The Connectors row of the harness an agent runs as: every agent harness
+/// The Connections row of the harness an agent runs as: every agent harness
/// ([`connectors::HARNESS_APPS`]), and the apps a connected agent may report.
fn app_of(harness: &str) -> Option<&'static str> {
connectors::app_for_harness(harness).or(match harness {
@@ -217,7 +217,7 @@ pub struct AgentCardView {
pub status_text: String,
/// "Connect Claude Code", while Not connected.
pub connect_label: Option<String>,
- /// The Connectors app it runs as (Connect and Open its settings).
+ /// The Connections app it runs as (Connect and Open its settings).
pub app: Option<String>,
pub settings_label: Option<String>,
pub remove_label: Option<String>,
@@ -441,6 +441,8 @@ mod tests {
added_ms: 1,
expired: false,
label: None,
+ region: None,
+ fields: Default::default(),
}],
..Default::default()
},
diff --git a/libs/cua/crates/cua-spaces-app-core/src/summon.rs b/libs/cua/crates/cua-spaces-app-core/src/summon.rs
index 4adb4a79c4..ec7d7169a5 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/summon.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/summon.rs
@@ -28,7 +28,7 @@ struct Startable {
harness: &'static str,
handle: &'static str,
label: &'static str,
- /// The setup id its sign-in is checked under (Settings, Connectors).
+ /// The setup id its sign-in is checked under (Settings, Connections).
app: &'static str,
}
@@ -130,7 +130,7 @@ pub struct SummonInput {
pub people: Vec<String>,
/// Agents can be added to this Space (`thread.agentAdd` there, and you may post).
pub can_add: bool,
- /// Coding apps and saved sign-ins (Settings, Connectors).
+ /// Coding apps and saved sign-ins (Settings, Connections).
pub connectors: ConnectorsInput,
}
@@ -198,10 +198,13 @@ pub fn candidates(input: &SummonInput) -> Vec<SummonCandidate> {
label: s.label.into(),
harness: s.harness.into(),
member: false,
+ // The Connections words: a sign-in that stopped working needs a reconnect.
detail: if ready {
"Starts in this Space".into()
+ } else if connectors::needs_reconnect(&input.connectors, s.app) {
+ "Needs reconnect".into()
} else {
- "Not connected yet".into()
+ "Not connected".into()
},
});
}
@@ -220,7 +223,7 @@ pub struct CantWake {
pub harness: String,
/// The agent's name ("Claude Code").
pub name: String,
- /// The setup id Connect runs for (Settings, Connectors).
+ /// The setup id Connect runs for (Settings, Connections).
pub app: String,
/// "Claude Code isn't connected yet".
pub text: String,
@@ -229,7 +232,7 @@ pub struct CantWake {
pub connect_label: Option<String>,
/// While Connect runs.
pub connecting_label: String,
- /// The app's page in Settings, Connectors ("Claude Code settings").
+ /// The app's page in Settings, Connections ("Claude Code settings").
pub open_label: Option<String>,
/// Once connected: the message goes again.
pub retry_label: String,
@@ -259,6 +262,10 @@ fn cant_wake(
format!("{name} isn't connected yet"),
if providers.is_empty() {
format!("Connect {name} so it can work in your Spaces.")
+ } else if providers.len() > 3 {
+ format!(
+ "It needs a connected provider to work in your Spaces. Your message is saved: it goes again once {name} is connected."
+ )
} else {
format!(
"It needs a sign-in to {} to work in your Spaces. Your message is saved: it goes again once {name} is connected.",
@@ -497,6 +504,8 @@ mod tests {
added_ms: 1,
expired: false,
label: None,
+ region: None,
+ fields: Default::default(),
})
.collect(),
..Default::default()
@@ -525,7 +534,7 @@ mod tests {
let rest: Vec<_> = c[1..].iter().map(|c| c.handle.as_str()).collect();
assert_eq!(rest, ["claude", "codex", "openclaw"]);
assert_eq!(c[1].label, "Claude Code");
- assert_eq!(c[1].detail, "Not connected yet");
+ assert_eq!(c[1].detail, "Not connected");
let c = candidates(&input(&["CLAUDE_CODE_OAUTH_TOKEN"]));
assert_eq!(c[1].detail, "Starts in this Space");
// A Space that can't add agents offers only its members.
@@ -582,11 +591,11 @@ mod tests {
// A member runs on its owner's keys: woken, never checked against this device's.
let p = plan(&input(&[]), "@hermes go");
assert_eq!(p.steps[0].action, "wake");
- // A new Hermes needs Anthropic or OpenAI.
+ // A new Hermes needs a connected provider.
let mut i = input(&[]);
i.members.clear();
let c = plan(&i, "@hermes go").steps[0].cant_wake.clone().unwrap();
- assert!(c.detail.contains("Anthropic or OpenAI"));
+ assert!(c.detail.contains("a connected provider"));
// Codex isn't on This Mac: no settings page to open; Connect still asks for a key.
let c = plan(&input(&[]), "@codex go").steps[0]
diff --git a/libs/cua/crates/cua-spaces-contract/src/inputs.rs b/libs/cua/crates/cua-spaces-contract/src/inputs.rs
index fa5dc281eb..9fc7f4fa8a 100644
--- a/libs/cua/crates/cua-spaces-contract/src/inputs.rs
+++ b/libs/cua/crates/cua-spaces-contract/src/inputs.rs
@@ -451,7 +451,7 @@ pub struct AgentStart {
/// The task.
pub prompt: String,
/// Provider key variables to forward from this server's environment
- /// (or from the keys saved in Cua Spaces, Settings → Connectors), for
+ /// (or from the keys saved in Cua Spaces, Settings → Connections), for
/// example ["ANTHROPIC_API_KEY"]. Names only; values never pass through
/// the conversation. Saved keys the harness reads are added without
/// being named.
diff --git a/libs/cua/crates/cua-spaces-contract/src/lib.rs b/libs/cua/crates/cua-spaces-contract/src/lib.rs
index a0b39b15aa..ae5fd1d148 100644
--- a/libs/cua/crates/cua-spaces-contract/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-contract/src/lib.rs
@@ -683,7 +683,7 @@ const SEND_FILE_INSTRUCTIONS: &str = "The same transfer the Cua Spaces pop-out's
const LIST_TOOLS_INSTRUCTIONS: &str = "Lists the tools of an MCP service INSIDE the Space. `service` is any service the Space declares (an MCP server the image runs, reached over streamable HTTP; no spacesd needed) or `driver`, the spacesd's own cua-driver registry (screenshot, click, type, launch apps, accessibility, ...). The default is `driver`, or the only declared service of a Space without spacesd. With no `name`, returns a scannable overview; pass name=<substring> for full input schemas. Then invoke them with call_tool. The reply names every service the Space exposes.";
-const AGENT_START_INSTRUCTIONS: &str = "Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connectors) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.";
+const AGENT_START_INSTRUCTIONS: &str = "Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connections) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.";
const AGENT_EVENTS_INSTRUCTIONS: &str = "Normalized events (install, session, turn_started, message, thought, tool_call, tool_update, plan, usage, permission, turn_ended, error, exited, ...) after `cursor`. Pass the returned cursor back to continue; caught_up=true means nothing more is written yet. The same kinds for every harness.";
@@ -1106,7 +1106,7 @@ pub fn tools() -> Vec<Tool> {
.with::<i::SpaceOnly>(),
Spec {
category: Category::Agents,
- result: "JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connectors) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.",
+ result: "JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connections) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.",
instructions: "Every harness: readiness (including whether a credential is available, with a hint when not), what it installs, which key variables it reads, which endpoint wire formats it takes, and its known limits; plus the event kinds and statuses.",
capabilities: &["agent.capabilities"],
sdk_symbol: "space.agents.harnessCapabilities()",
diff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs
index 1ef72b19ca..2c68ff31f5 100644
--- a/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs
+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/members.rs
@@ -2233,14 +2233,12 @@ pub(crate) fn note_rejected(rec: &AgentRecord, f: &ag::failure::Failure) {
}
}
-/// A failed member's status: one short word ("Not connected" when it needs a sign-in, else "Stopped").
+/// A failed member's status: one short word, the Connections words ("Needs reconnect" when the
+/// provider refused its credential, "Not connected" when it has none, else "Stopped").
/// The error itself is never the status; the member's `failure` carries its complete text for Show
/// details.
fn failed_line(harness: &str, e: &str) -> String {
- match ag::failure::classify(harness, e).class {
- ag::failure::FailureClass::NeedsConnect => "Not connected".into(),
- ag::failure::FailureClass::Error => "Stopped".into(),
- }
+ ag::failure::status_word(&ag::failure::classify(harness, e)).into()
}
/// One session of an agent member, as `agent_members` shows it.
diff --git a/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs b/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs
index 4b4534621d..9f4770eacf 100644
--- a/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs
+++ b/libs/cua/crates/cua-spaces-ext/src/persistent/mod.rs
@@ -639,7 +639,7 @@ impl Persistent {
for k in &spec.env_from_host {
if !allowed.contains(&k.as_str()) && !saved.contains(k) {
return Err(Error::invalid(format!(
- "{k} is not a provider key variable (or a key saved in Cua Spaces → Settings → Connectors)"
+ "{k} is not a provider key variable (or a key saved in Cua Spaces → Settings → Connections)"
)));
}
}
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
index 1a27614530..2814b33421 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
@@ -6673,6 +6673,11 @@ pub struct AppAgentKeyInput {
pub expired: bool,
/// A copied sign-in's name ("Signed in as [email protected] (Claude Max)").
pub label: Option<String>,
+ /// The plan or region chosen for it (Z.AI), when the provider has them.
+ pub region: Option<String>,
+ /// Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ /// and `wire`, or a `model`. Never the key.
+ pub fields: std::collections::HashMap<String, String>,
}
/// What the section shows.
diff --git a/libs/cua/crates/cua-spaces/src/agents/keys.rs b/libs/cua/crates/cua-spaces/src/agents/keys.rs
index b366b768a1..9d6f6ae92f 100644
--- a/libs/cua/crates/cua-spaces/src/agents/keys.rs
+++ b/libs/cua/crates/cua-spaces/src/agents/keys.rs
@@ -1,5 +1,5 @@
//! Provider keys for agent runs, kept on this machine (Cua Spaces →
-//! Settings → Connectors).
+//! Settings → Connections).
//!
//! The keys live in the OS credential vault through cua-auth's secret store
//! ([`cua_auth::Store::save_secret`]): one item, `agent-keys`, next to the
@@ -18,6 +18,7 @@
use crate::error::{Error, Result};
use cua_agents::claude_login;
+pub use cua_agents::connections as registry;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::sync::{Mutex, OnceLock};
@@ -39,13 +40,11 @@ pub const APP_METHODS: &[&str] = &[
];
/// The provider keys Cua may read from your login shell, by name (Settings,
-/// Connectors: "Use ANTHROPIC_API_KEY from your shell"). Nothing else is
-/// ever read there.
-pub const SHELL_NAMES: &[&str] = &[
- "ANTHROPIC_API_KEY",
- "OPENAI_API_KEY",
- "COPILOT_GITHUB_TOKEN",
-];
+/// Connections: "Use ANTHROPIC_API_KEY from your shell"): the API key names of
+/// the providers in the registry. Nothing else is ever read there.
+pub fn shell_allowed() -> Vec<&'static str> {
+ registry::shell_names()
+}
/// How long the login shell has to answer.
const SHELL_WAIT: Duration = Duration::from_secs(5);
@@ -62,15 +61,23 @@ pub fn login_shell() -> std::path::PathBuf {
}
/// `name`'s value in a login, interactive `shell` (the profile files your
-/// terminal reads), when it is one of [`SHELL_NAMES`] and set. The shell's
+/// terminal reads), when it is one of [`shell_allowed`] and set. The shell's
/// stdin is closed and it is stopped after [`SHELL_WAIT`].
pub fn shell_value(shell: &std::path::Path, name: &str) -> Option<String> {
- if !SHELL_NAMES.contains(&name) {
+ if !shell_allowed().contains(&name) {
return None;
}
let script = format!("printf '\\n{SHELL_MARK}%s' \"${{{name}-}}\"");
+ let text = run_shell(shell, &script)?;
+ let value = text.rsplit_once(SHELL_MARK)?.1.trim().to_string();
+ (!value.is_empty()).then_some(value)
+}
+
+/// Runs `script` in a login, interactive `shell` with stdin closed, stopped
+/// after [`SHELL_WAIT`]; what it printed.
+fn run_shell(shell: &std::path::Path, script: &str) -> Option<String> {
let mut child = std::process::Command::new(shell)
- .args(["-l", "-i", "-c", &script])
+ .args(["-l", "-i", "-c", script])
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::null())
@@ -96,17 +103,27 @@ pub fn shell_value(shell: &std::path::Path, name: &str) -> Option<String> {
}
}
}
- let text = reader.join().ok()?;
- let value = text.rsplit_once(SHELL_MARK)?.1.trim().to_string();
- (!value.is_empty()).then_some(value)
+ reader.join().ok()
}
-/// Which of [`SHELL_NAMES`] your login shell has set (names only).
+/// Which of [`shell_allowed`] your login shell has set (names only), in one
+/// shell start: the shell prints the names that are set, never a value.
pub fn shell_names(shell: &std::path::Path) -> Vec<String> {
- SHELL_NAMES
- .iter()
- .filter(|n| shell_value(shell, n).is_some())
- .map(|n| (*n).to_string())
+ let allowed = shell_allowed();
+ let script = format!(
+ "printf '\\n{SHELL_MARK}'; for n in {}; do eval \"v=\\${{$n-}}\"; [ -n \"$v\" ] && printf ' %s' \"$n\"; done; true",
+ allowed.join(" ")
+ );
+ let Some(text) = run_shell(shell, &script) else {
+ return vec![];
+ };
+ let Some((_, names)) = text.rsplit_once(SHELL_MARK) else {
+ return vec![];
+ };
+ names
+ .split_whitespace()
+ .filter(|n| allowed.contains(n))
+ .map(str::to_string)
.collect()
}
@@ -115,7 +132,7 @@ pub fn is_app_method(name: &str) -> bool {
APP_METHODS.contains(&name)
}
-/// A provider with its own row in Settings.
+/// A provider with its own row in Settings: the registry's visible providers.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
pub struct Provider {
pub id: &'static str,
@@ -123,27 +140,23 @@ pub struct Provider {
pub env: &'static str,
}
-/// Anthropic and OpenAI; anything else is `other` with its own name.
-pub const PROVIDERS: &[Provider] = &[
- Provider {
- id: "anthropic",
- label: "Anthropic",
- env: "ANTHROPIC_API_KEY",
- },
- Provider {
- id: "openai",
- label: "OpenAI",
- env: "OPENAI_API_KEY",
- },
-];
+/// The providers a key can be saved for (`cua_connections`, visible ones with
+/// a key to save); anything else is `other` with its own name.
+pub fn providers() -> Vec<Provider> {
+ registry::visible()
+ .filter_map(|p| {
+ p.key_method().map(|m| Provider {
+ id: p.id,
+ label: p.name,
+ env: m.env,
+ })
+ })
+ .collect()
+}
-/// The provider id for a variable: its row's, else `other`.
+/// The provider id for a variable: its provider's, else `other`.
pub fn provider_of(env: &str) -> &'static str {
- PROVIDERS
- .iter()
- .find(|p| p.env == env)
- .map(|p| p.id)
- .unwrap_or("other")
+ registry::provider_of_env(env).map_or("other", |p| p.id)
}
/// Names a stored key may not take: they would change how a run's shell,
@@ -267,6 +280,13 @@ pub struct KeyInfo {
pub expires_ms: Option<u64>,
/// It has stopped working (`expires_ms` has passed): runs no longer get it.
pub expired: bool,
+ /// The region or plan chosen for it (Z.AI), when the provider has them.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub region: Option<String>,
+ /// Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ /// and `wire`, or a `model` chosen for a provider. Never the key.
+ #[serde(skip_serializing_if = "BTreeMap::is_empty")]
+ pub fields: BTreeMap<String, String>,
}
/// `agent_keys.list`: the stored keys and whether this machine can store
@@ -303,6 +323,12 @@ struct Stored {
/// Code's own sign-in when it runs out ([`AgentKeys::sync_claude_login`]).
#[serde(default, skip_serializing_if = "Option::is_none")]
origin: Option<String>,
+ /// The region or plan chosen for a provider that has them.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ region: Option<String>,
+ /// Non-secret values saved with the key (a custom endpoint's URL, model and wire).
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ fields: BTreeMap<String, String>,
}
impl std::fmt::Debug for Stored {
@@ -343,6 +369,8 @@ impl Stored {
expires_ms: self.expires_ms,
// A rejected credential reads like an expired one: it no longer works, Reconnect.
expired: !self.usable(),
+ region: self.region.clone(),
+ fields: self.fields.clone(),
}
}
}
@@ -534,15 +562,33 @@ impl AgentKeys {
pub fn report(&self) -> Result<KeysReport> {
Ok(KeysReport {
keys: self.list()?,
- providers: PROVIDERS.to_vec(),
+ providers: providers(),
available: self.available(),
unavailable: self.unavailable.clone(),
})
}
- /// Adds or replaces a key. `provider` is `anthropic`, `openai` or
- /// `other`; `other` needs `env` (checked by [`validate_name`]).
+ /// Adds or replaces a key. `provider` is a provider id of the registry
+ /// (`anthropic`, `deepseek`, ...) or `other`; `other` needs `env` (checked
+ /// by [`validate_name`]).
pub fn set(&self, provider: &str, env: Option<&str>, value: &str) -> Result<KeyInfo> {
+ self.set_with(provider, env, value, None, &BTreeMap::new())
+ }
+
+ /// [`AgentKeys::set`] with the non-secret choices a connection can carry: a
+ /// `region` (a plan or endpoint the provider lists) and `fields`
+ /// (`model`, and for a custom endpoint its `base_url` and `wire`). Saving
+ /// never asks the provider anything; a check runs later, in the
+ /// background ([`AgentKeys::recheck`]).
+ pub fn set_with(
+ &self,
+ provider: &str,
+ env: Option<&str>,
+ value: &str,
+ region: Option<&str>,
+ fields: &BTreeMap<String, String>,
+ ) -> Result<KeyInfo> {
+ let mut optional_secret = false;
// A Claude token (`sk-ant-oat...`, from `claude setup-token`) pasted where an API
// key goes is a sign-in for Claude Code, not an API key: saved as one, so it
// works for Claude Code and is never offered to another app as a key.
@@ -558,28 +604,35 @@ impl AgentKeys {
copy.origin.as_deref(),
);
}
- let env = match (provider, env.map(str::trim).filter(|e| !e.is_empty())) {
+ let (env, id) = match (provider, env.map(str::trim).filter(|e| !e.is_empty())) {
("other", Some(e)) => {
validate_name(e)?;
- e.to_string()
+ (e.to_string(), "other".to_string())
}
("other", None) => {
return Err(Error::InvalidArgument(
"an Other key needs its environment variable name".into(),
));
}
- (p, _) => PROVIDERS
- .iter()
- .find(|x| x.id == p)
- .ok_or_else(|| {
+ (p, _) => {
+ let def = registry::provider(p).filter(|d| d.visible()).ok_or_else(|| {
Error::InvalidArgument(format!(
- "unknown provider {p:?}: use anthropic, openai or other"
+ "unknown provider {p:?}: use a provider from `cua connections list`, or other"
))
- })?
- .env
- .to_string(),
+ })?;
+ let m = def.key_method().ok_or_else(|| {
+ Error::InvalidArgument(format!("{} is connected another way", def.name))
+ })?;
+ optional_secret = m.secret_optional;
+ check_choices(def, m, region, fields)?;
+ (m.env.to_string(), def.id.to_string())
+ }
+ };
+ let value = if optional_secret && value.trim().is_empty() {
+ ""
+ } else {
+ validate_value(value)?
};
- let value = validate_value(value)?;
if self.store.is_none() {
return Err(self.refusal());
}
@@ -587,7 +640,7 @@ impl AgentKeys {
let mut keys = self.read(&mut g, true)?;
keys.retain(|k| k.env != env);
let stored = Stored {
- provider: provider_of(&env).into(),
+ provider: id,
env,
value: value.into(),
added_ms: now_ms(),
@@ -596,6 +649,12 @@ impl AgentKeys {
expires_ms: None,
rejected_ms: None,
origin: None,
+ region: region.filter(|r| !r.is_empty()).map(str::to_string),
+ fields: fields
+ .iter()
+ .filter(|(_, v)| !v.trim().is_empty())
+ .map(|(k, v)| (k.clone(), v.trim().to_string()))
+ .collect(),
};
let info = stored.info();
keys.push(stored);
@@ -645,7 +704,7 @@ impl AgentKeys {
.any(|k| k.env == env && k.source.as_deref() != Some(source))
{
return Err(Error::InvalidArgument(format!(
- "{env} is already in Keyvault; remove it in Settings → Connectors to copy this one"
+ "{env} is already in Keyvault; remove it in Settings → Connections to copy this one"
)));
}
keys.retain(|k| k.source.as_deref() != Some(source));
@@ -659,6 +718,8 @@ impl AgentKeys {
expires_ms,
rejected_ms: None,
origin: origin.map(str::to_string),
+ region: None,
+ fields: BTreeMap::new(),
};
let info = stored.info();
keys.push(stored);
@@ -832,6 +893,50 @@ impl AgentKeys {
}
}
+impl AgentKeys {
+ /// The connections the saved keys make: one per provider that has a usable
+ /// credential a run may be given (a sign-in scoped to one app counts for
+ /// that app's provider too), with the region and non-secret fields saved
+ /// with it. Never a value.
+ pub fn connections(&self) -> Vec<registry::Connected> {
+ let mut g = self.lock();
+ let keys = match self.read(&mut g, false) {
+ Ok(k) => k,
+ Err(e) => {
+ tracing::warn!(error = %e, "agent keys: the store can't be read");
+ return vec![];
+ }
+ };
+ let mut out: Vec<registry::Connected> = vec![];
+ for k in keys.into_iter().filter(Stored::usable) {
+ let Some(def) = registry::provider_of_env(&k.env) else {
+ continue;
+ };
+ // The empty key of a server that needs none still connects it.
+ if k.value.is_empty() && !def.key_method().is_some_and(|m| m.secret_optional) {
+ continue;
+ }
+ match out.iter_mut().find(|c| c.provider == def.id) {
+ Some(c) => {
+ // A sign-in saved beside a key never overwrites the key's choices.
+ if c.region.is_none() {
+ c.region = k.region.clone();
+ }
+ for (f, v) in &k.fields {
+ c.fields.entry(f.clone()).or_insert_with(|| v.clone());
+ }
+ }
+ None => out.push(registry::Connected {
+ provider: def.id.to_string(),
+ region: k.region.clone(),
+ fields: k.fields.clone(),
+ }),
+ }
+ }
+ out
+ }
+}
+
impl AgentKeys {
/// Notes that the credentials named in `envs` were rejected by their provider (a run of an
/// agent got an authentication failure with them): they read as needing a reconnect and no run
@@ -870,22 +975,44 @@ impl AgentKeys {
Ok(changed)
}
- /// The API keys to check against their provider: `(env, added_ms, value)`. A sign-in token
+ /// The API keys to check against their provider. A sign-in token
/// (`CLAUDE_CODE_OAUTH_TOKEN`, `CODEX_AUTH_JSON`) has no check that is known to accept it,
- /// so it is not asked about.
- fn checkable(&self) -> Vec<(String, u64, String)> {
+ /// so it is not asked about; nor is a custom endpoint, which Cua never probes.
+ fn checkable(&self) -> Vec<Checkable> {
let mut g = self.lock();
match self.read(&mut g, true) {
Ok(keys) => keys
.into_iter()
- .filter(|k| endpoint_for(&k.env).is_some() && !k.expired())
- .map(|k| (k.env, k.added_ms, k.value))
+ .filter(|k| !k.expired() && !k.value.is_empty())
+ .filter_map(|k| {
+ let def = registry::provider_of_env(&k.env)?;
+ def.check?;
+ if def.scope_of(&k.env).is_some() {
+ return None;
+ }
+ Some(Checkable {
+ provider: def.id,
+ env: k.env,
+ added_ms: k.added_ms,
+ value: k.value,
+ region: k.region,
+ })
+ })
.collect(),
Err(_) => vec![],
}
}
}
+/// A saved API key a provider can be asked about.
+struct Checkable {
+ provider: &'static str,
+ env: String,
+ added_ms: u64,
+ value: String,
+ region: Option<String>,
+}
+
/// What the provider said of a key.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KeyCheck {
@@ -897,32 +1024,27 @@ pub enum KeyCheck {
Unknown,
}
-/// The providers' read-only "list models" requests: free, about 100 ms, and they answer 401 for a
-/// key that does not work. Only API keys are asked about (see [`AgentKeys::checkable`]).
-#[derive(Clone, Debug)]
+/// Where the providers' read-only requests go: each provider's own host from
+/// its file (a request is a cheap "list models" style GET that answers 401 for
+/// a key that does not work). `overrides` replaces a provider's whole check
+/// URL by provider id, for a test's local server.
+#[derive(Clone, Debug, Default)]
pub struct CheckEndpoints {
- pub anthropic: String,
- pub openai: String,
+ pub overrides: BTreeMap<String, String>,
}
-impl Default for CheckEndpoints {
- fn default() -> Self {
+impl CheckEndpoints {
+ /// Every provider checked at `url` (a test's local server).
+ pub fn all_at(url: &str) -> Self {
Self {
- anthropic: "https://api.anthropic.com/v1/models?limit=1".into(),
- openai: "https://api.openai.com/v1/models".into(),
+ overrides: registry::PROVIDERS
+ .iter()
+ .map(|p| (p.id.to_string(), url.to_string()))
+ .collect(),
}
}
}
-/// Which provider's request checks `env`, if it is an API key we can check.
-fn endpoint_for(env: &str) -> Option<&'static str> {
- match env {
- "ANTHROPIC_API_KEY" => Some("anthropic"),
- "OPENAI_API_KEY" => Some("openai"),
- _ => None,
- }
-}
-
/// How long an answer is reused (Settings opens and the Agents page opens ask often).
const CHECK_CACHE: Duration = Duration::from_secs(5 * 60);
@@ -935,19 +1057,25 @@ fn check_cache() -> &'static CheckCache {
/// Asks the provider about one key. The value only goes into the request's header; nothing here
/// logs it, and an error is reported without its text.
-async fn ask_provider(
- client: &reqwest::Client,
- ep: &CheckEndpoints,
- env: &str,
- value: &str,
-) -> KeyCheck {
- let request = match endpoint_for(env) {
- Some("anthropic") => client
- .get(&ep.anthropic)
- .header("x-api-key", value)
+async fn ask_provider(client: &reqwest::Client, ep: &CheckEndpoints, c: &Checkable) -> KeyCheck {
+ let Some(def) = registry::provider(c.provider) else {
+ return KeyCheck::Unknown;
+ };
+ let Some(check) = def.check else {
+ return KeyCheck::Unknown;
+ };
+ let url = ep
+ .overrides
+ .get(def.id)
+ .cloned()
+ .unwrap_or_else(|| format!("{}{}", def.base_url_for(c.region.as_deref()), check.path));
+ let request = client.get(&url);
+ let request = match check.auth {
+ "x-api-key" => request
+ .header("x-api-key", &c.value)
.header("anthropic-version", "2023-06-01"),
- Some(_) => client.get(&ep.openai).bearer_auth(value),
- None => return KeyCheck::Unknown,
+ "x-goog-api-key" => request.header("x-goog-api-key", &c.value),
+ _ => request.bearer_auth(&c.value),
};
match request.send().await {
Ok(r) if r.status().is_success() => KeyCheck::Valid,
@@ -970,7 +1098,8 @@ impl AgentKeys {
.map_err(|e| Error::Agent(e.to_string()))?;
let mut rejected: Vec<(String, u64)> = vec![];
let mut accepted: Vec<(String, u64)> = vec![];
- for (env, added, value) in todo {
+ for c in todo {
+ let (env, added) = (c.env.clone(), c.added_ms);
let cached = check_cache()
.lock()
.unwrap_or_else(|p| p.into_inner())
@@ -980,14 +1109,14 @@ impl AgentKeys {
let answer = match cached {
Some(c) => c,
None => {
- let c = ask_provider(&client, ep, &env, &value).await;
- if c != KeyCheck::Unknown {
+ let a = ask_provider(&client, ep, &c).await;
+ if a != KeyCheck::Unknown {
check_cache()
.lock()
.unwrap_or_else(|p| p.into_inner())
- .insert((env.clone(), added), (Instant::now(), c));
+ .insert((env.clone(), added), (Instant::now(), a));
}
- c
+ a
}
};
match answer {
@@ -996,10 +1125,13 @@ impl AgentKeys {
KeyCheck::Unknown => {}
}
}
- self.set_rejected(
+ for env in self.set_rejected(
rejected.iter().map(|(e, a)| (e.as_str(), Some(*a))),
Some(now_ms()),
- )?;
+ )? {
+ // A key the provider refused: only that it happened, for which provider.
+ note_connection(&env, "check", "needs_reconnect");
+ }
self.set_rejected(accepted.iter().map(|(e, a)| (e.as_str(), Some(*a))), None)?;
}
self.report()
@@ -1012,27 +1144,108 @@ pub fn mark_rejected_for_run(harness: &str, provider: &str) {
let Some(h) = super::harness::harness(harness) else {
return;
};
+ let Some(def) = registry::provider(provider) else {
+ return;
+ };
let envs: Vec<&str> = h
.keys
.iter()
.copied()
- .filter(|k| provider_envs(provider).contains(k))
+ .filter(|k| def.envs().any(|e| e == *k))
+ .chain(
+ // The app reads the credential under another name than the one saved
+ // (Goose's GOOGLE_API_KEY comes from the saved GEMINI_API_KEY).
+ def.delivery_for(harness)
+ .iter()
+ .filter(|e| def.scope_of(e.src).is_none_or(|s| s == harness))
+ .map(|e| e.src),
+ )
.collect();
if envs.is_empty() {
return;
}
+ let mut envs = envs;
+ envs.sort_unstable();
+ envs.dedup();
if let Err(e) = global().mark_rejected(&envs) {
tracing::warn!(error = %e, "agent keys: could not note a rejected credential");
}
}
-/// The variables that hold a provider's credentials (a key, a sign-in token).
-fn provider_envs(provider: &str) -> &'static [&'static str] {
- match provider {
- "anthropic" => &["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
- "openai" => &["OPENAI_API_KEY", "CODEX_AUTH_JSON"],
- _ => &[],
+/// Checks the non-secret choices saved with a connection against its
+/// provider file: a region it lists, fields it asks for, URLs that are URLs.
+fn check_choices(
+ def: &registry::Provider,
+ m: &registry::Method,
+ region: Option<&str>,
+ fields: &BTreeMap<String, String>,
+) -> Result<()> {
+ let bad = |m: String| Err(Error::InvalidArgument(m));
+ if let Some(r) = region.filter(|r| !r.is_empty())
+ && !def.regions.iter().any(|x| x.id == r)
+ {
+ return bad(format!("{} has no region or plan {r:?}", def.name));
+ }
+ for (k, v) in fields {
+ let known = k == "model" || m.fields.iter().any(|f| f.id == *k);
+ if !known {
+ return bad(format!("{} has no field {k:?}", def.name));
+ }
+ if v.len() > 512 || v.chars().any(|c| c.is_control()) {
+ return bad(format!("{k} must be one line of at most 512 characters"));
+ }
}
+ for f in m.fields {
+ let v = fields.get(f.id).map(|v| v.trim()).unwrap_or_default();
+ if f.required && v.is_empty() {
+ return bad(format!("{} needs {}", def.name, f.label.to_lowercase()));
+ }
+ if f.kind == "url"
+ && !v.is_empty()
+ && !(v.starts_with("http://") || v.starts_with("https://"))
+ {
+ return bad(format!("{} must start with http:// or https://", f.label));
+ }
+ if f.kind == "choice" && !v.is_empty() && !f.options.contains(&v) {
+ return bad(format!(
+ "{} must be one of {}",
+ f.label,
+ f.options.join(", ")
+ ));
+ }
+ }
+ // A provider with no default model needs one chosen when an app is told which to use.
+ if def.default_model.is_empty()
+ && def.kind != registry::Kind::Custom
+ && !def.delivery_for("hermes").is_empty()
+ && fields.get("model").is_none_or(|v| v.trim().is_empty())
+ {
+ return bad(format!("{} needs a model", def.name));
+ }
+ Ok(())
+}
+
+/// Tells telemetry a connection changed: only the registry's provider id and
+/// the kind of method, the action and how it ended (`cua_connection_changed`).
+/// Never a key, a URL, an account or an error text.
+fn note_connection(env_or_provider: &str, action: &str, outcome: &str) {
+ let def =
+ registry::provider(env_or_provider).or_else(|| registry::provider_of_env(env_or_provider));
+ let (provider, method) = match def {
+ Some(d) => {
+ let kind = d
+ .methods
+ .iter()
+ .find(|m| m.env == env_or_provider || m.aliases.contains(&env_or_provider))
+ .or_else(|| d.key_method())
+ .map_or("other", |m| m.kind.word());
+ (d.id, kind)
+ }
+ None => ("other", "api_key"),
+ };
+ cua_telemetry::capture(cua_telemetry::events::connection_changed(
+ provider, method, action, outcome,
+ ));
}
fn store_err(e: cua_auth::Error) -> Error {
@@ -1066,7 +1279,12 @@ struct SetArgs {
provider: String,
#[serde(default)]
env: Option<String>,
+ #[serde(default)]
value: String,
+ #[serde(default)]
+ region: Option<String>,
+ #[serde(default)]
+ fields: BTreeMap<String, String>,
}
#[derive(Deserialize)]
@@ -1075,6 +1293,16 @@ struct RemoveArgs {
env: String,
}
+#[derive(Deserialize)]
+#[serde(deny_unknown_fields)]
+struct FromShellArgs {
+ env: String,
+ #[serde(default)]
+ region: Option<String>,
+ #[serde(default)]
+ fields: BTreeMap<String, String>,
+}
+
#[derive(Serialize)]
struct ShellReport {
/// The provider keys your login shell has set (names; never a value).
@@ -1107,18 +1335,45 @@ pub fn app_call(
keys.sync_claude_login(&HostClaudeLogin, false);
report(keys.report())
}
- "agent_keys.set" => report(
- serde_json::from_value::<SetArgs>(args)
- .map_err(|e| {
- Error::InvalidArgument(format!("agent_keys.set: {}", redact_serde(&e)))
- })
- .and_then(|a| keys.set(&a.provider, a.env.as_deref(), &a.value))
- .and_then(|_| keys.report()),
- ),
+ "agent_keys.set" => {
+ let parsed = serde_json::from_value::<SetArgs>(args).map_err(|e| {
+ Error::InvalidArgument(format!("agent_keys.set: {}", redact_serde(&e)))
+ });
+ let provider = parsed
+ .as_ref()
+ .map(|a| a.provider.clone())
+ .unwrap_or_default();
+ // A key saved again (or one that was refused) is a reconnect.
+ let had = keys
+ .list()
+ .map(|l| l.iter().any(|k| k.provider == provider))
+ .unwrap_or(false);
+ let saved = parsed.and_then(|a| {
+ keys.set_with(
+ &a.provider,
+ a.env.as_deref(),
+ &a.value,
+ a.region.as_deref(),
+ &a.fields,
+ )
+ });
+ note_connection(
+ &provider,
+ if had { "reconnect" } else { "connect" },
+ if saved.is_ok() { "ok" } else { "failed" },
+ );
+ report(saved.and_then(|_| keys.report()))
+ }
"agent_keys.remove" => report(
serde_json::from_value::<RemoveArgs>(args)
.map_err(|e| Error::InvalidArgument(format!("agent_keys.remove: {e}")))
- .and_then(|a| keys.remove(&a.env))
+ .and_then(|a| {
+ let removed = keys.remove(&a.env)?;
+ if removed {
+ note_connection(&a.env, "remove", "ok");
+ }
+ Ok(removed)
+ })
.and_then(|_| keys.report()),
),
"agent_keys.shell" => serde_json::to_value(ShellReport {
@@ -1127,18 +1382,26 @@ pub fn app_call(
.map_err(|e| Error::Agent(e.to_string())),
// The value goes straight from your shell into the store; it is never answered.
"agent_keys.from_shell" => report(
- serde_json::from_value::<RemoveArgs>(args)
+ serde_json::from_value::<FromShellArgs>(args)
.map_err(|e| Error::InvalidArgument(format!("agent_keys.from_shell: {e}")))
.and_then(|a| {
let value = shell_value(shell, &a.env).ok_or_else(|| {
Error::InvalidArgument(format!("{} isn't set in your shell", a.env))
})?;
let provider = provider_of(&a.env);
- keys.set(
+ let saved = keys.set_with(
provider,
(provider == "other").then_some(a.env.as_str()),
&value,
- )
+ a.region.as_deref(),
+ &a.fields,
+ );
+ note_connection(
+ provider,
+ "connect",
+ if saved.is_ok() { "ok" } else { "failed" },
+ );
+ saved
})
.and_then(|_| keys.report()),
),
@@ -1182,7 +1445,7 @@ fn redact_serde(e: &serde_json::Error) -> String {
if s.contains("missing field") || s.contains("unknown field") {
s
} else {
- "expected {provider, env?, value} as strings".into()
+ "expected {provider, env?, value, region?, fields?} as strings".into()
}
}
@@ -1353,10 +1616,7 @@ mod tests {
async fn a_saved_key_the_provider_refuses_needs_a_reconnect() {
let (keys, dir) = temp_keys();
let (url, hits) = provider().await;
- let ep = CheckEndpoints {
- anthropic: url.clone(),
- openai: url,
- };
+ let ep = CheckEndpoints::all_at(&url);
keys.set("anthropic", None, "sk-ant-stale-0000-abcd")
.unwrap();
keys.set("openai", None, "sk-good-1111-wxyz").unwrap();
@@ -1399,16 +1659,10 @@ mod tests {
async fn an_unreachable_provider_flags_nothing() {
let (keys, dir) = temp_keys();
let (url, _) = provider().await;
- let ep = CheckEndpoints {
- anthropic: url.clone(),
- openai: url,
- };
+ let ep = CheckEndpoints::all_at(&url);
keys.set("openai", None, "sk-flaky-3333-wxyz").unwrap();
assert!(!keys.recheck(&ep).await.unwrap().keys[0].expired);
- let offline = CheckEndpoints {
- anthropic: "http://127.0.0.1:1/x".into(),
- openai: "http://127.0.0.1:1/x".into(),
- };
+ let offline = CheckEndpoints::all_at("http://127.0.0.1:1/x");
keys.set("anthropic", None, "sk-ant-offline-4444").unwrap();
assert!(
!keys
@@ -1443,7 +1697,12 @@ mod tests {
.keys
.iter()
.copied()
- .filter(|k| provider_envs("anthropic").contains(k))
+ .filter(|k| {
+ registry::provider("anthropic")
+ .unwrap()
+ .envs()
+ .any(|e| e == *k)
+ })
.collect();
assert!(envs.contains(&"ANTHROPIC_API_KEY"));
keys.mark_rejected(&envs).unwrap();
@@ -1931,4 +2190,72 @@ mod tests {
assert_eq!(HostClaudeLogin.lookup(), claude_login::Lookup::NotSignedIn);
assert!(!HostClaudeLogin.ask_to_refresh());
}
+
+ /// Any provider that declares a check is asked on its own host, the others never are, and a
+ /// custom endpoint is never probed. A refusal marks only that provider's key.
+ #[tokio::test]
+ async fn every_provider_that_declares_a_check_is_checked_and_only_those() {
+ let (keys, dir) = temp_keys();
+ let (url, hits) = provider().await;
+ let ep = CheckEndpoints::all_at(&url);
+ keys.set("deepseek", None, "ds-stale-0000-abcd").unwrap();
+ keys.set("openrouter", None, "sk-or-good-1111-wxyz")
+ .unwrap();
+ // No check declared (Fireworks): never asked, so it is never marked.
+ keys.set("fireworks", None, "fw-stale-2222-abcd").unwrap();
+ let mut f = BTreeMap::new();
+ f.insert("base_url".to_string(), "http://127.0.0.1:1/v1".to_string());
+ f.insert("model".to_string(), "m".to_string());
+ f.insert("wire".to_string(), "openai-chat".to_string());
+ keys.set_with("custom", None, "stale-key-3333-abcd", None, &f)
+ .unwrap();
+ let report = keys.recheck(&ep).await.unwrap();
+ let by = |env: &str| report.keys.iter().find(|k| k.env == env).unwrap().expired;
+ assert!(by("DEEPSEEK_API_KEY"));
+ assert!(!by("OPENROUTER_API_KEY"));
+ assert!(
+ !by("FIREWORKS_API_KEY"),
+ "a provider with no declared check is left alone"
+ );
+ assert!(
+ !by("CUSTOM_ENDPOINT_API_KEY"),
+ "a custom endpoint is never probed"
+ );
+ assert_eq!(hits.load(std::sync::atomic::Ordering::SeqCst), 2);
+ // Connected means valid: the refused provider's key reaches no run.
+ assert!(keys.values(&["DEEPSEEK_API_KEY"]).is_empty());
+ assert_eq!(
+ keys.connections()
+ .iter()
+ .map(|c| c.provider.as_str())
+ .collect::<Vec<_>>(),
+ ["custom", "fireworks", "openrouter"]
+ );
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+
+ #[test]
+ fn the_shell_may_only_be_asked_for_provider_key_names() {
+ let allowed = shell_allowed();
+ for n in [
+ "ANTHROPIC_API_KEY",
+ "OPENAI_API_KEY",
+ "COPILOT_GITHUB_TOKEN",
+ "DEEPSEEK_API_KEY",
+ "OPENROUTER_API_KEY",
+ ] {
+ assert!(allowed.contains(&n), "{n}");
+ }
+ // Not a sign-in, a hidden provider's name, or anything that is not a provider key.
+ for n in [
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "CODEX_AUTH_JSON",
+ "NOUS_API_KEY",
+ "PATH",
+ "HOME",
+ "AWS_SECRET_ACCESS_KEY",
+ ] {
+ assert!(!allowed.contains(&n), "{n}");
+ }
+ }
}
diff --git a/libs/cua/crates/cua-spaces/src/agents/mod.rs b/libs/cua/crates/cua-spaces/src/agents/mod.rs
index 97b1906481..2081e6b9ae 100644
--- a/libs/cua/crates/cua-spaces/src/agents/mod.rs
+++ b/libs/cua/crates/cua-spaces/src/agents/mod.rs
@@ -7,7 +7,7 @@
//! run only as explicit per-run env (`RunOptions::env`, or on the MCP
//! surface `env_from_host` naming known provider key variables), written
//! 0600 inside the run and redacted from its event log. Keys saved in Cua
-//! Spaces (Settings → Connectors, [`keys`]) reach only the runs whose harness
+//! Spaces (Settings → Connections, [`keys`]) reach only the runs whose harness
//! reads them ([`run_env`]). Moving a signed-in agent session is teleport's
//! job, behind its consent gate.
@@ -217,7 +217,7 @@ pub fn capabilities() -> CapabilitiesReport {
}
/// The first of `h`'s keys this server can give a run: one saved in Cua
-/// Spaces (Settings → Connectors), or one set in this process's environment
+/// Spaces (Settings → Connections), or one set in this process's environment
/// (`env_from_host` forwards it).
pub fn host_key(h: &harness::Harness) -> Option<&'static str> {
host_key_with(h, &keys::global().names())
@@ -269,7 +269,7 @@ pub fn env_from_host_with(
if !allowed.contains(&n.as_str()) && !saved_names.contains(n) {
return Err(Error::InvalidArgument(format!(
"{n} is not a provider key variable this server forwards; allowed: {} \
- (or a key saved in Cua Spaces → Settings → Connectors)",
+ (or a key saved in Cua Spaces → Settings → Connections)",
allowed.join(", ")
)));
}
@@ -320,14 +320,17 @@ pub fn run_env_with(
}
let mut out = env.clone();
out.extend(host_env);
- if !custom_endpoint && let Some(h) = harness::harness(harness) {
- let wanted: Vec<&str> = h
- .keys
- .iter()
- .copied()
- .filter(|k| out.get(*k).is_none_or(|v| v.is_empty()))
- .collect();
- out.extend(saved.values(&wanted));
+ if !custom_endpoint && harness::harness(harness).is_some() {
+ // Every saved credential the app can use, by the registry's delivery
+ // rules (a sign-in scoped to another app is never among them).
+ let names = keys::registry::all_env_names();
+ let saved_values = saved.values(&names);
+ let delivered = keys::registry::deliver(harness, &|n| saved_values.get(n).cloned());
+ for (dest, value) in delivered {
+ if out.get(&dest).is_none_or(|v| v.is_empty()) {
+ out.insert(dest, value);
+ }
+ }
}
oauth_token_as_api_key(harness, &mut out);
Ok((out, missing))
@@ -353,6 +356,89 @@ fn oauth_token_as_api_key(harness: &str, env: &mut BTreeMap<String, String>) {
}
}
+/// What the person's connections add to a run beyond its env: an endpoint for
+/// an app that has no variable of its own for the connected provider, and the
+/// config Hermes starts from.
+#[derive(Clone, Debug, Default, PartialEq, Eq)]
+pub struct ConnectionPlan {
+ /// Variables to add (the endpoint's key under the name the app reads it as).
+ pub env: BTreeMap<String, String>,
+ pub endpoint: Option<Endpoint>,
+ /// Hermes's generated `config.yaml`.
+ pub hermes_config: Option<String>,
+}
+
+/// The [`ConnectionPlan`] for a run of `harness` whose env is `env` (after
+/// [`run_env_with`]). Nothing for a run with a custom endpoint of its own.
+pub fn connection_plan(
+ saved: &keys::AgentKeys,
+ harness: &str,
+ env: &BTreeMap<String, String>,
+ custom_endpoint: bool,
+) -> ConnectionPlan {
+ use keys::registry as reg;
+ let mut plan = ConnectionPlan::default();
+ if custom_endpoint || harness::harness(harness).is_none() {
+ return plan;
+ }
+ let names = reg::all_env_names();
+ let saved_values = saved.values(&names);
+ let has = |n: &str| {
+ env.get(n).is_some_and(|v| !v.is_empty())
+ || saved_values.get(n).is_some_and(|v| !v.is_empty())
+ };
+ // What is connected: the saved connections, and the providers whose key the
+ // caller passed in the run's env (never a sign-in scoped to another app).
+ let mut connected = saved.connections();
+ for name in env.keys() {
+ if let Some(def) = reg::provider_of_env(name)
+ && def.scope_of(name).is_none()
+ && !connected.iter().any(|c| c.provider == def.id)
+ && has(name)
+ {
+ connected.push(reg::Connected {
+ provider: def.id.to_string(),
+ ..Default::default()
+ });
+ }
+ }
+ if harness == "hermes" {
+ let picks = reg::hermes::select(&connected, &has);
+ plan.hermes_config = reg::hermes::config_yaml(&picks);
+ // A custom endpoint with no key still needs the variable Hermes's file names.
+ return plan;
+ }
+ let h = harness::harness(harness).expect("checked");
+ // An app that has a credential of its own is left to use it.
+ let own = h
+ .keys
+ .iter()
+ .any(|k| env.get(*k).is_some_and(|v| !v.is_empty()));
+ if own {
+ return plan;
+ }
+ if let Some(e) = reg::endpoint_for(harness, &connected, &has) {
+ let wire = Wire::parse(e.wire);
+ let var = harness::endpoint_key_var(h, wire);
+ let key = e
+ .key_src
+ .and_then(|s| {
+ env.get(s)
+ .filter(|v| !v.is_empty())
+ .cloned()
+ .or_else(|| saved_values.get(s).cloned())
+ })
+ .unwrap_or_else(|| "no-key-required".to_string());
+ plan.env.insert(var.to_string(), key);
+ plan.endpoint = Some(Endpoint {
+ base_url: e.base_url,
+ wire,
+ model: Some(e.model),
+ });
+ }
+ plan
+}
+
/// Largest host file `agent_start.files` attaches.
const MAX_ATTACHMENT: u64 = 8 * 1024 * 1024;
@@ -371,7 +457,7 @@ pub fn start_options_with(
saved: &keys::AgentKeys,
a: &cua_spaces_contract::inputs::AgentStart,
) -> Result<(RunOptions, Vec<String>)> {
- let (env, missing) = run_env_with(
+ let (mut env, missing) = run_env_with(
saved,
&a.agent,
&a.env,
@@ -385,11 +471,23 @@ pub fn start_options_with(
Error::InvalidArgument(format!("agent_start: unknown wire {w:?}"))
})?),
};
- let endpoint = a.base_url.clone().map(|base_url| Endpoint {
- base_url,
- wire,
- model: a.model.clone(),
- });
+ let plan = connection_plan(saved, &a.agent, &env, a.base_url.is_some());
+ for (k, v) in plan.env {
+ env.entry(k).or_insert(v);
+ }
+ let endpoint = match a.base_url.clone() {
+ Some(base_url) => Some(Endpoint {
+ base_url,
+ wire,
+ model: a.model.clone(),
+ }),
+ None => plan.endpoint.map(|mut e| {
+ if a.model.is_some() {
+ e.model = a.model.clone();
+ }
+ e
+ }),
+ };
let opts = RunOptions {
cwd: a.cwd.clone(),
repo: a.repo.clone(),
@@ -408,6 +506,7 @@ pub fn start_options_with(
.collect(),
endpoint,
model: a.model.clone(),
+ hermes_config: plan.hermes_config,
files: attachments(&a.files)?,
sandbox_mcp: a.sandbox_mcp,
skills: a.skills,
@@ -678,7 +777,7 @@ mod tests {
let info = claude.info_with_host_key(None);
assert!(!info.ready);
let hint = info.auth_hint.unwrap();
- assert!(hint.contains("Settings → Connectors"), "{hint}");
+ assert!(hint.contains("Settings → Connections"), "{hint}");
}
let gemini = harness::harness("gemini-cli").unwrap();
if host_key_with(gemini, &[]).is_none() {
@@ -697,4 +796,256 @@ mod tests {
.unwrap();
assert!(env.len() + missing.len() == 1);
}
+
+ /// A key saved for any provider reaches only the apps the provider file delivers it to, and the
+ /// two sign-ins reach their own app only.
+ #[test]
+ fn every_provider_key_reaches_only_the_apps_that_can_use_it() {
+ let none = BTreeMap::new();
+ for p in keys::registry::visible() {
+ if p.key_method().is_none() {
+ continue;
+ }
+ let (k, dir) = saved(&[]);
+ let mut fields = BTreeMap::new();
+ if p.kind == keys::registry::Kind::Custom {
+ fields.insert(
+ "base_url".to_string(),
+ "http://127.0.0.1:1234/v1".to_string(),
+ );
+ fields.insert("model".to_string(), "m".to_string());
+ fields.insert("wire".to_string(), "openai-chat".to_string());
+ } else if p.default_model.is_empty() {
+ fields.insert("model".to_string(), "some-model".to_string());
+ }
+ k.set_with(p.id, None, "secret-value-0000", None, &fields)
+ .unwrap();
+ for h in harness::HARNESSES {
+ let (env, _) = run_env_with(&k, h.id, &none, &[], false).unwrap();
+ let allowed: Vec<&str> = p.delivery_for(h.id).iter().map(|e| e.dest).collect();
+ for name in env.keys() {
+ assert!(
+ allowed.contains(&name.as_str()),
+ "{}: {} reached {name}",
+ p.id,
+ h.id
+ );
+ assert!(
+ h.keys.contains(&name.as_str()),
+ "{}: {name} is not one {} reads",
+ p.id,
+ h.id
+ );
+ }
+ if allowed.is_empty() {
+ assert!(
+ env.is_empty(),
+ "{} reached {} without a delivery entry",
+ p.id,
+ h.id
+ );
+ }
+ }
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+ // The Claude sign-in and the ChatGPT sign-in, beside a key for the same provider.
+ let (k, dir) = saved(&[
+ ("anthropic", None, "sk-ant-test-0000-aaaa"),
+ ("openai", None, "sk-test-0000-bbbb"),
+ ]);
+ k.import(
+ "claude-code",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "Claude sign-in",
+ "sk-ant-oat01-whatever",
+ None,
+ None,
+ )
+ .unwrap();
+ k.import(
+ "codex",
+ "CODEX_AUTH_JSON",
+ "ChatGPT sign-in",
+ "{\"tokens\":{}}",
+ None,
+ None,
+ )
+ .unwrap();
+ for h in harness::HARNESSES {
+ let (env, _) = run_env_with(&k, h.id, &none, &[], false).unwrap();
+ assert_eq!(
+ env.contains_key("CLAUDE_CODE_OAUTH_TOKEN"),
+ h.id == "claude-code",
+ "{}",
+ h.id
+ );
+ assert_eq!(
+ env.contains_key("CODEX_AUTH_JSON"),
+ h.id == "openai-codex",
+ "{}",
+ h.id
+ );
+ }
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+
+ #[test]
+ fn hermes_is_told_which_provider_to_use() {
+ let none = BTreeMap::new();
+ let (k, dir) = saved(&[("openrouter", None, "sk-or-test-0000-aaaa")]);
+ let (env, _) = run_env_with(&k, "hermes", &none, &[], false).unwrap();
+ let plan = connection_plan(&k, "hermes", &env, false);
+ let y = plan.hermes_config.unwrap();
+ assert!(
+ y.contains("provider: \"openrouter\"") && y.contains("adopt_external_logins: false"),
+ "{y}"
+ );
+ assert!(plan.endpoint.is_none() && plan.env.is_empty());
+ // Through the options an agent_start gets.
+ let a: cua_spaces_contract::inputs::AgentStart =
+ serde_json::from_value(serde_json::json!({
+ "space": "local:dev", "agent": "hermes", "prompt": "hi"}))
+ .unwrap();
+ let (opts, _) = start_options_with(&k, &a).unwrap();
+ assert_eq!(opts.env.keys().collect::<Vec<_>>(), ["OPENROUTER_API_KEY"]);
+ assert!(opts.hermes_config.unwrap().contains("openrouter"));
+ // A Claude sign-in alone is nothing Hermes can use: no config, no key.
+ let (k2, dir2) = saved(&[]);
+ k2.import(
+ "claude-code",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "Claude sign-in",
+ "sk-ant-oat01-x",
+ None,
+ None,
+ )
+ .unwrap();
+ let (opts, _) = start_options_with(&k2, &a).unwrap();
+ assert!(opts.env.is_empty() && opts.hermes_config.is_none());
+ // A custom endpoint of the caller's own is left alone.
+ let mut ep = a.clone();
+ ep.base_url = Some("http://127.0.0.1:9".into());
+ let (opts, _) = start_options_with(&k, &ep).unwrap();
+ assert!(opts.hermes_config.is_none() && opts.env.is_empty());
+ let _ = std::fs::remove_dir_all(&dir);
+ let _ = std::fs::remove_dir_all(&dir2);
+ }
+
+ #[test]
+ fn an_app_without_a_variable_for_the_provider_is_pointed_at_its_endpoint() {
+ let (k, dir) = saved(&[("deepseek", None, "ds-test-0000-aaaa")]);
+ let start = |agent: &str| {
+ let a: cua_spaces_contract::inputs::AgentStart =
+ serde_json::from_value(serde_json::json!({
+ "space": "local:dev", "agent": agent, "prompt": "hi"}))
+ .unwrap();
+ start_options_with(&k, &a).unwrap().0
+ };
+ let o = start("opencode");
+ let e = o.endpoint.unwrap();
+ assert_eq!(
+ (e.base_url.as_str(), e.wire, e.model.as_deref()),
+ (
+ "https://api.deepseek.com/v1",
+ Some(Wire::OpenaiChat),
+ Some("deepseek-flash")
+ )
+ );
+ assert_eq!(o.env["OPENAI_API_KEY"], "ds-test-0000-aaaa");
+ // Claude Code and Gemini take no such provider: nothing is added, nothing is pointed anywhere.
+ for agent in ["claude-code", "gemini-cli", "google-antigravity"] {
+ let o = start(agent);
+ assert!(o.endpoint.is_none() && o.env.is_empty(), "{agent}");
+ }
+ // Codex speaks the Responses wire, which DeepSeek does not serve.
+ assert!(start("openai-codex").endpoint.is_none());
+ // A key the app reads itself is used as it always was, with no endpoint.
+ k.set("openrouter", None, "sk-or-test-0000-bbbb").unwrap();
+ let o = start("opencode");
+ assert!(o.endpoint.is_none());
+ assert_eq!(o.env.keys().collect::<Vec<_>>(), ["OPENROUTER_API_KEY"]);
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+
+ #[test]
+ fn a_custom_endpoint_is_saved_with_its_url_and_model_and_needs_no_key() {
+ let (k, dir) = saved(&[]);
+ let mut f = BTreeMap::new();
+ // The URL and model are required; the wire is one of the closed set.
+ assert!(k.set_with("custom", None, "", None, &f).is_err());
+ f.insert(
+ "base_url".to_string(),
+ "http://127.0.0.1:1234/v1".to_string(),
+ );
+ f.insert("model".to_string(), "qwen".to_string());
+ f.insert("wire".to_string(), "carrier-pigeon".to_string());
+ assert!(k.set_with("custom", None, "", None, &f).is_err());
+ f.insert("wire".to_string(), "openai-chat".to_string());
+ f.insert("base_url".to_string(), "ftp://nope".to_string());
+ assert!(k.set_with("custom", None, "", None, &f).is_err());
+ f.insert(
+ "base_url".to_string(),
+ "http://127.0.0.1:1234/v1".to_string(),
+ );
+ let info = k.set_with("custom", None, "", None, &f).unwrap();
+ assert_eq!(info.env, "CUSTOM_ENDPOINT_API_KEY");
+ assert_eq!(info.fields["base_url"], "http://127.0.0.1:1234/v1");
+ assert_eq!(info.last4, "");
+ // It connects with no key: Hermes and the endpoint apps get its URL.
+ let none = BTreeMap::new();
+ let (env, _) = run_env_with(&k, "hermes", &none, &[], false).unwrap();
+ assert!(env.is_empty(), "no key is delivered when there is none");
+ let y = connection_plan(&k, "hermes", &env, false)
+ .hermes_config
+ .unwrap();
+ assert!(
+ y.contains("provider: \"custom\"")
+ && y.contains("base_url: \"http://127.0.0.1:1234/v1\"")
+ && y.contains("no-key-required"),
+ "{y}"
+ );
+ let plan = connection_plan(&k, "goose", &BTreeMap::new(), false);
+ assert_eq!(plan.endpoint.unwrap().model.as_deref(), Some("qwen"));
+ assert_eq!(plan.env["OPENAI_API_KEY"], "no-key-required");
+ // The key, when there is one, stays out of every report.
+ k.set_with("custom", None, "local-key-1234-abcd", None, &f)
+ .unwrap();
+ let text = serde_json::to_string(&k.report().unwrap()).unwrap();
+ assert!(!text.contains("local-key"), "{text}");
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+
+ #[test]
+ fn a_plan_and_a_model_are_chosen_when_connecting_and_checked() {
+ let (k, dir) = saved(&[]);
+ let mut f = BTreeMap::new();
+ // Z.AI bills its plans separately: the plan must be one it lists.
+ assert!(
+ k.set_with("zai", None, "zai-key-0000-aaaa", Some("moon"), &f)
+ .is_err()
+ );
+ let info = k
+ .set_with("zai", None, "zai-key-0000-aaaa", Some("coding-global"), &f)
+ .unwrap();
+ assert_eq!(info.region.as_deref(), Some("coding-global"));
+ // A provider with no default model asks for one.
+ assert!(
+ k.set_with("deepinfra", None, "di-key-0000-aaaa", None, &f)
+ .is_err()
+ );
+ f.insert("model".to_string(), "meta-llama/x".to_string());
+ assert!(
+ k.set_with("deepinfra", None, "di-key-0000-aaaa", None, &f)
+ .is_ok()
+ );
+ // A field the provider does not ask for is refused; so is a hidden provider.
+ f.insert("base_url".to_string(), "https://evil.example".to_string());
+ assert!(
+ k.set_with("deepinfra", None, "di-key-0000-aaaa", None, &f)
+ .is_err()
+ );
+ assert!(k.set("nous", None, "x-key-0000-aaaa").is_err());
+ assert!(k.set("xai-oauth", None, "x-key-0000-aaaa").is_err());
+ let _ = std::fs::remove_dir_all(&dir);
+ }
}
diff --git a/libs/cua/crates/cua-telemetry/Cargo.toml b/libs/cua/crates/cua-telemetry/Cargo.toml
index 0db9e18b32..7f90d1d105 100644
--- a/libs/cua/crates/cua-telemetry/Cargo.toml
+++ b/libs/cua/crates/cua-telemetry/Cargo.toml
@@ -27,3 +27,5 @@ ureq = { version = "3", optional = true, default-features = false, features = ["
[dev-dependencies]
tempfile.workspace = true
+# The fixed provider words are the registry's ids (tests/privacy.rs).
+cua-connections.workspace = true
diff --git a/libs/cua/crates/cua-telemetry/src/cli_commands.in b/libs/cua/crates/cua-telemetry/src/cli_commands.in
index a9d8088043..07d8e25f46 100644
--- a/libs/cua/crates/cua-telemetry/src/cli_commands.in
+++ b/libs/cua/crates/cua-telemetry/src/cli_commands.in
@@ -74,6 +74,10 @@
"connect.setup",
"connect.status",
"connect.update",
+ "connections.add",
+ "connections.list",
+ "connections.remove",
+ "connections.test",
"daemon.mcp",
"daemon.reap",
"daemon.start",
diff --git a/libs/cua/crates/cua-telemetry/src/events.rs b/libs/cua/crates/cua-telemetry/src/events.rs
index a0c76579f8..9da5efe8a4 100644
--- a/libs/cua/crates/cua-telemetry/src/events.rs
+++ b/libs/cua/crates/cua-telemetry/src/events.rs
@@ -1523,6 +1523,24 @@ pub fn repo_cache(
)
}
+/// `cua_connection_changed`: a provider was connected, reconnected, removed or
+/// checked. Only fixed words leave: the registry's provider id, the kind of
+/// method, the action and the outcome; never a key, a URL, an account or an
+/// error text.
+pub fn connection_changed(provider: &str, method: &str, action: &str, outcome: &str) -> Event {
+ Event::new(event::CONNECTION_CHANGED)
+ .s(
+ "provider",
+ pick(schema::CONNECTION_PROVIDERS, provider, "other"),
+ )
+ .s("method", pick(schema::CONNECTION_METHODS, method, "other"))
+ .s("action", pick(schema::CONNECTION_ACTIONS, action, "check"))
+ .s(
+ "outcome",
+ pick(schema::CONNECTION_OUTCOMES, outcome, "failed"),
+ )
+}
+
/// `cua_agent_used_space`: an agent's tool call reached a Space and worked.
/// None for a tool that does not act inside a Space.
pub fn agent_used_space(tool: &str) -> Option<Event> {
diff --git a/libs/cua/crates/cua-telemetry/src/schema.rs b/libs/cua/crates/cua-telemetry/src/schema.rs
index d280df1ea9..915ccefbd5 100644
--- a/libs/cua/crates/cua-telemetry/src/schema.rs
+++ b/libs/cua/crates/cua-telemetry/src/schema.rs
@@ -750,6 +750,67 @@ pub const SIGNIN_VIAS: &[&str] = &[
];
/// Why Connect did not copy a sign-in (`cua-agent-setup`'s refusal kinds).
pub const SIGNIN_REFUSALS: &[&str] = &["not_signed_in", "cancelled", "not_yet", "failed", "other"];
+/// The providers of the Connections registry (`cua-connections`), or `other`.
+/// A test holds this equal to the registry's ids.
+pub const CONNECTION_PROVIDERS: &[&str] = &[
+ "actual",
+ "ai-gateway",
+ "alibaba",
+ "anthropic",
+ "arcee",
+ "azure-foundry",
+ "bedrock",
+ "commandcode",
+ "custom",
+ "deepinfra",
+ "deepseek",
+ "fireworks",
+ "github",
+ "gmi",
+ "google",
+ "huggingface",
+ "kilocode",
+ "kimi",
+ "meta-ai",
+ "minimax",
+ "minimax-oauth",
+ "nebius-token-factory",
+ "nous",
+ "novita",
+ "nvidia",
+ "ollama-cloud",
+ "openai",
+ "opencode-go",
+ "opencode-zen",
+ "openrouter",
+ "qwen-oauth",
+ "router",
+ "stepfun",
+ "tencent-tokenhub",
+ "upstage",
+ "vertex",
+ "xai",
+ "xai-oauth",
+ "xiaomi",
+ "zai",
+ "other",
+];
+/// The kinds of way to connect a provider (the registry's closed set), or `other`.
+pub const CONNECTION_METHODS: &[&str] = &[
+ "api_key",
+ "import_login",
+ "device_code",
+ "browser_oauth",
+ "subscription_login",
+ "adc",
+ "local_server",
+ "custom_endpoint",
+ "other",
+];
+/// What was done to a connection.
+pub const CONNECTION_ACTIONS: &[&str] = &["connect", "reconnect", "remove", "check"];
+/// How it ended; `needs_reconnect` is a check that found the provider refusing the key.
+pub const CONNECTION_OUTCOMES: &[&str] = &["ok", "failed", "cancelled", "needs_reconnect"];
/// Where an agent run was started from: a Spaces tool call (the MCP
/// `agent_start`, the SDKs' `Space.agent_start`, the Spaces app), the
/// `cua agent` CLI, the SDKs' sandbox `Agents.run`, a persistent agent's
@@ -987,6 +1048,7 @@ pub mod event {
pub const AGENT_USED_SPACE: &str = "cua_agent_used_space";
pub const AGENT_SIGNIN_IMPORTED: &str = "cua_agent_signin_imported";
pub const AGENT_SIGNIN_REFUSED: &str = "cua_agent_signin_refused";
+ pub const CONNECTION_CHANGED: &str = "cua_connection_changed";
pub const PLAN_LIMIT_SHOWN: &str = "cua_plan_limit_shown";
pub const UPGRADE_LINK_OPENED: &str = "cua_upgrade_link_opened";
}
@@ -1321,6 +1383,36 @@ pub const EVENTS: &[EventSpec] = &[
],
purpose: "One-click Connect: how often importing a sign-in fails, and why, so the import can be made to work for more people.",
},
+ EventSpec {
+ name: event::CONNECTION_CHANGED,
+ version: 1,
+ tier: Tier::Usage,
+ sample_rate: 1.0,
+ products: ALL,
+ props: &[
+ p(
+ "provider",
+ Kind::Enum(CONNECTION_PROVIDERS),
+ "The provider, by its id in the Connections registry (a fixed list), or other.",
+ ),
+ p(
+ "method",
+ Kind::Enum(CONNECTION_METHODS),
+ "The kind of way it was connected: an API key, an imported sign-in, a custom endpoint and so on.",
+ ),
+ p(
+ "action",
+ Kind::Enum(CONNECTION_ACTIONS),
+ "Connected, reconnected, removed or checked.",
+ ),
+ p(
+ "outcome",
+ Kind::Enum(CONNECTION_OUTCOMES),
+ "How it ended, or needs_reconnect when a check found the provider refusing the key. Never a key, a URL, an account or error text.",
+ ),
+ ],
+ purpose: "Which providers people connect and how, how often a connect fails, and how often a saved key stops working, so the providers and methods that matter get the work.",
+ },
EventSpec {
name: event::AGENT_RUN_STARTED,
version: 1,
diff --git a/libs/cua/crates/cua-telemetry/tests/privacy.rs b/libs/cua/crates/cua-telemetry/tests/privacy.rs
index 286a088eb8..4891a73131 100644
--- a/libs/cua/crates/cua-telemetry/tests/privacy.rs
+++ b/libs/cua/crates/cua-telemetry/tests/privacy.rs
@@ -327,6 +327,10 @@ fn all_builders(s: &str) -> Vec<Event> {
.unwrap(),
);
assert!(events::repo_cache("https://github.com/o/r", "local", 0, 0, "none").is_none());
+ v.push(events::connection_changed(
+ "deepseek", "api_key", "connect", "ok",
+ ));
+ v.push(events::connection_changed(s, s, s, s));
v.push(events::agent_used_space("space_bash").unwrap());
v.push(events::agent_used_space("computer_click").unwrap());
assert!(events::installer_step(s, "cli", "network", "sh", &[]).is_none());
@@ -1980,3 +1984,40 @@ fn plan_limit_events_keep_their_vocabulary() {
);
}
}
+
+/// The fixed provider words are the registry's ids, and a connection event carries nothing else.
+#[test]
+fn connection_events_use_the_registrys_words_only() {
+ let mut registry: Vec<&str> = cua_connections::PROVIDERS.iter().map(|p| p.id).collect();
+ registry.push("other");
+ registry.sort_unstable();
+ let mut ours: Vec<&str> = schema::CONNECTION_PROVIDERS.to_vec();
+ ours.sort_unstable();
+ assert_eq!(
+ ours, registry,
+ "regenerate schema::CONNECTION_PROVIDERS from providers/*.toml"
+ );
+ let mut kinds: Vec<&str> = cua_connections::MethodKind::ALL
+ .iter()
+ .map(|k| k.word())
+ .collect();
+ kinds.push("other");
+ assert_eq!(schema::CONNECTION_METHODS, kinds.as_slice());
+ // A provider, method or action that is not a fixed word is sent as the fallback, never as typed.
+ let e = events::connection_changed(
+ "http://127.0.0.1:1234/v1",
+ "sk-ant-secret",
+ "401 from api.example",
+ );
+ let text = format!("{e:?}");
+ for leak in ["127.0.0.1", "sk-ant", "ada@", "401", "example"] {
+ assert!(!text.contains(leak), "{text}");
+ }
+ let e = events::connection_changed("openrouter", "api_key", "connect", "ok");
+ let text = format!("{e:?}");
+ assert!(
+ text.contains("openrouter") && text.contains("api_key") && text.contains("connect"),
+ "{text}"
+ );
+}
diff --git a/libs/cua/spaces-contract/manifest.json b/libs/cua/spaces-contract/manifest.json
index 520a316fc5..679ffbc72b 100644
--- a/libs/cua/spaces-contract/manifest.json
+++ b/libs/cua/spaces-contract/manifest.json
@@ -1574,7 +1574,7 @@
"name": "agent_start",
"category": "agents",
"description": "Start a coding agent in the Space.",
- "instructions": "Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connectors) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.",
+ "instructions": "Installs the harness if needed (pinned, checksum-verified), gives it the Space's own MCP tools plus any mcp_servers, and runs it over the Agent Client Protocol as a detached spacesd process with auto-approved permissions (the Space is the sandbox). The run survives this server restarting or the connection dropping. Returns a run_id immediately: follow it with agent_events (cursor) or agent_status, continue it with agent_message, cancel a turn with agent_interrupt. Keys: provider keys saved in Cua Spaces (Settings → Connections) reach the runs whose harness reads them; env_from_host names provider key variables from this server's environment; host credential files are never copied.",
"platforms": [
"macos",
"windows",
@@ -1646,7 +1646,7 @@
},
"env_from_host": {
"default": [],
- "description": "Provider key variables to forward from this server's environment\n(or from the keys saved in Cua Spaces, Settings → Connectors), for\nexample [\"ANTHROPIC_API_KEY\"]. Names only; values never pass through\nthe conversation. Saved keys the harness reads are added without\nbeing named.",
+ "description": "Provider key variables to forward from this server's environment\n(or from the keys saved in Cua Spaces, Settings → Connections), for\nexample [\"ANTHROPIC_API_KEY\"]. Names only; values never pass through\nthe conversation. Saved keys the harness reads are added without\nbeing named.",
"items": {
"type": "string"
},
@@ -2152,7 +2152,7 @@
"sdk_symbol": "space.agents.harnessCapabilities()",
"rust_symbol": "agents::capabilities",
"notes": [],
- "result": "JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connectors) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.",
+ "result": "JSON: `protocol`, `statuses`, `event_kinds`, `harnesses` (each `id`, `name`, `ready` (supported and not `auth: missing`), `supported`, `auth` (`ok`: a key saved in Cua Spaces (Settings → Connections) or one this server can forward with env_from_host; `missing`: none, so a run needs a sign-in inside its Space; `unknown`: the harness may be set up through its own config), `auth_hint`, `installs`, `keys`, `endpoint_wires`, `sandbox_mcp`, `interactive_cli`, `notes`), `forwardable_env` and `runner`.",
"errors": [],
"input_schema": {
"properties": {},
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index b59dfdb897..0cb4bff49b 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -4439,6 +4439,15 @@ public struct AppAgentKeyInput: Equatable, Hashable {
* A copied sign-in's name ("Signed in as [email protected] (Claude Max)").
*/
public var label: String?
+ /**
+ * The plan or region chosen for it (Z.AI), when the provider has them.
+ */
+ public var region: String?
+ /**
+ * Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ * and `wire`, or a `model`. Never the key.
+ */
+ public var fields: [String: String]
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -4460,13 +4469,22 @@ public struct AppAgentKeyInput: Equatable, Hashable {
*/expired: Bool,
/**
* A copied sign-in's name ("Signed in as [email protected] (Claude Max)").
- */label: String?) {
+ */label: String?,
+ /**
+ * The plan or region chosen for it (Z.AI), when the provider has them.
+ */region: String?,
+ /**
+ * Non-secret values saved with it: a custom endpoint's `base_url`, `model`
+ * and `wire`, or a `model`. Never the key.
+ */fields: [String: String]) {
self.provider = provider
self.env = env
self.last4 = last4
self.addedMs = addedMs
self.expired = expired
self.label = label
+ self.region = region
+ self.fields = fields
}
@@ -4490,7 +4508,9 @@ public struct FfiConverterTypeAppAgentKeyInput: FfiConverterRustBuffer {
last4: FfiConverterString.read(from: &buf),
addedMs: FfiConverterUInt64.read(from: &buf),
expired: FfiConverterBool.read(from: &buf),
- label: FfiConverterOptionString.read(from: &buf)
+ label: FfiConverterOptionString.read(from: &buf),
+ region: FfiConverterOptionString.read(from: &buf),
+ fields: FfiConverterDictionaryStringString.read(from: &buf)
)
}
@@ -4501,6 +4521,8 @@ public struct FfiConverterTypeAppAgentKeyInput: FfiConverterRustBuffer {
FfiConverterUInt64.write(value.addedMs, into: &buf)
FfiConverterBool.write(value.expired, into: &buf)
FfiConverterOptionString.write(value.label, into: &buf)
+ FfiConverterOptionString.write(value.region, into: &buf)
+ FfiConverterDictionaryStringString.write(value.fields, into: &buf)
}
}
diff --git a/scripts/docs-generators/cli-specs/cua.json b/scripts/docs-generators/cli-specs/cua.json
index c6aa6d9afa..927cc4b54e 100644
--- a/scripts/docs-generators/cli-specs/cua.json
+++ b/scripts/docs-generators/cli-specs/cua.json
@@ -455,7 +455,7 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connectors). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed",
+ "help": "Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connections). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed",
"hidden": false,
"name": "sign-in",
"repeatable": false,
@@ -729,7 +729,7 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connectors). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed",
+ "help": "Also make a sign-in for each agent's runs in your Spaces and keep it in Keyvault on This Mac: the sign-in Claude Code already has (read from where Claude Code keeps it, as an access token only; Claude Code's own sign-in is never changed) and Codex's own device sign-in (a link and a code to enter there, in a folder Cua owns); Hermes uses the providers connected in Cua Spaces (Settings, Connections). Only Claude Code's own sign-in is read, and only its access token is kept; Codex's own `auth.json` is never read or changed",
"hidden": false,
"name": "sign-in",
"repeatable": false,
@@ -2424,7 +2424,7 @@
"usage": "cua agent harnesses [OPTIONS]"
},
{
- "abstract": "The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connectors). Values are read from stdin and never printed",
+ "abstract": "The provider keys agents get, kept in the Keychain by the Cua daemon (Cua Spaces → Settings → Connections). Values are read from stdin and never printed",
"after_help": "Examples:\n cua agent keys\n cua agent keys set anthropic\n cua agent keys rm OPENAI_API_KEY",
"aliases": [],
"arguments": [],
@@ -17524,6 +17524,204 @@
"subcommands": [],
"usage": "cua usage [OPTIONS]"
},
+ {
+ "abstract": "The AI providers connected once for every app that can use them: list, add (a key from stdin), test, remove. What Cua Spaces shows in Settings, Connections. (`cua connect` connects your coding apps to Cua.)",
+ "after_help": "Examples:\n cua connections list\n cua connections add deepseek\n cua connections test\n cua connections remove deepseek",
+ "aliases": [],
+ "arguments": [],
+ "flags": [],
+ "hidden": false,
+ "hidden_aliases": [],
+ "name": "connections",
+ "options": [],
+ "subcommand_optional": false,
+ "subcommands": [
+ {
+ "abstract": "List the providers with their state (Connected, Needs reconnect, Not connected) and the apps each works with. Never prints a key",
+ "after_help": "Examples:\n cua connections list\n cua connections list --all\n cua --json connections list",
+ "aliases": [],
+ "arguments": [],
+ "flags": [
+ {
+ "aliases": [],
+ "default_value": false,
+ "env": null,
+ "help": "Also list every provider that is not connected (by default: the ones up front and the ones with something saved)",
+ "hidden": false,
+ "name": "all",
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": false
+ }
+ ],
+ "hidden": false,
+ "hidden_aliases": [],
+ "name": "list",
+ "options": [],
+ "subcommand_optional": false,
+ "subcommands": [],
+ "usage": "cua connections list [OPTIONS]"
+ },
+ {
+ "abstract": "Connect a provider. The key is read from stdin (pipe it in; a terminal is refused so it isn't echoed). Saving never waits on the provider: `cua connections test` asks it afterwards",
+ "after_help": "Examples:\n cua connections add deepseek\n cua connections add zai --region coding-global\n cua connections add deepinfra --model meta-llama/Meta-Llama-3.1-70B-Instruct\n cua connections add custom --base-url http://host:1234/v1 --model qwen",
+ "aliases": [],
+ "arguments": [
+ {
+ "default_value": null,
+ "help": "The provider id (`cua connections list --all`)",
+ "hidden": false,
+ "is_optional": false,
+ "name": "PROVIDER",
+ "possible_values": [],
+ "repeatable": false,
+ "type": "string"
+ }
+ ],
+ "discussion": ".\n\nThe provider is one of the ids `cua connections list --all` prints. Pipe the key in: `pbpaste | cua connections add deepseek`. Sign-ins another app made on this machine are imported with `cua connect setup <app> --sign-in`.",
+ "flags": [],
+ "hidden": false,
+ "hidden_aliases": [],
+ "name": "add",
+ "options": [
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "How: `key` (an API key from stdin; the default) or `endpoint` (a custom endpoint: its base URL, model and API style; a key is optional)",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "method",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "METHOD"
+ },
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "The plan or region, for a provider that has them (Z.AI: global, cn, coding-global, coding-cn)",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "region",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "REGION"
+ },
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "The model to use, for a provider with no default model or to choose another",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "model",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "MODEL"
+ },
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "A custom endpoint's base URL",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "base-url",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "BASE_URL"
+ },
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "A custom endpoint's API style: openai-chat (default), openai-responses or anthropic",
+ "hidden": false,
+ "is_optional": true,
+ "multiple_values": false,
+ "name": "wire",
+ "possible_values": [],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "string",
+ "value_name": "WIRE"
+ }
+ ],
+ "subcommand_optional": false,
+ "subcommands": [],
+ "usage": "cua connections add [OPTIONS] <PROVIDER>"
+ },
+ {
+ "abstract": "Ask each provider whether its saved key still works (a read-only request on the provider's own host, bounded in time; offline is not a failure). A key the provider refuses is listed as Needs reconnect",
+ "after_help": "Examples:\n cua connections test\n cua connections test openrouter",
+ "aliases": [],
+ "arguments": [
+ {
+ "default_value": null,
+ "help": "Only this provider",
+ "hidden": false,
+ "is_optional": true,
+ "name": "PROVIDER",
+ "possible_values": [],
+ "repeatable": false,
+ "type": "string"
+ }
+ ],
+ "flags": [],
+ "hidden": false,
+ "hidden_aliases": [],
+ "name": "test",
+ "options": [],
+ "subcommand_optional": false,
+ "subcommands": [],
+ "usage": "cua connections test [OPTIONS] [PROVIDER]"
+ },
+ {
+ "abstract": "Disconnect a provider: remove what is saved for it",
+ "after_help": "Examples:\n cua connections remove deepseek",
+ "aliases": [],
+ "arguments": [
+ {
+ "default_value": null,
+ "help": "",
+ "hidden": false,
+ "is_optional": false,
+ "name": "PROVIDER",
+ "possible_values": [],
+ "repeatable": false,
+ "type": "string"
+ }
+ ],
+ "flags": [],
+ "hidden": false,
+ "hidden_aliases": [],
+ "name": "remove",
+ "options": [],
+ "subcommand_optional": false,
+ "subcommands": [],
+ "usage": "cua connections remove [OPTIONS] <PROVIDER>"
+ }
+ ],
+ "usage": "cua connections [OPTIONS] <COMMAND>"
+ },
{
"abstract": "Move a desktop app session (tabs, profile, sign-in) into a sandbox",
"aliases": [],
diff --git a/scripts/docs-generators/cua-cli.ts b/scripts/docs-generators/cua-cli.ts
index a5dbfb4a96..4c36a08175 100644
--- a/scripts/docs-generators/cua-cli.ts
+++ b/scripts/docs-generators/cua-cli.ts
@@ -127,8 +127,8 @@ export const CLI_GROUPS: CliGroup[] = [
{
slug: 'agents',
title: 'Agents, MCP and skills',
- summary: 'Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded skills',
- commands: ['agent', 'thread', 'join', 'connect', 'agents', 'mcp', 'skills'],
+ summary: 'Agents in a Space, connecting your AI agents and the AI providers they use, the stdio MCP server, and recorded skills',
+ commands: ['agent', 'thread', 'join', 'connect', 'connections', 'agents', 'mcp', 'skills'],
},
{
slug: 'account-and-setup',
diff --git a/tests/e2e/cua-sdk/rust/Cargo.lock b/tests/e2e/cua-sdk/rust/Cargo.lock
index f04162e12b..db734490ec 100644
--- a/tests/e2e/cua-sdk/rust/Cargo.lock
+++ b/tests/e2e/cua-sdk/rust/Cargo.lock
@@ -1324,6 +1324,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1418,6 +1419,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml 1.1.8+spec-1.1.0",
+]
+
[[package]]
name = "cua-contrib"
version = "0.9.0"
@@ -2798,7 +2808,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
- "windows-core 0.58.0",
+ "windows-core",
]
[[package]]
@@ -4687,9 +4697,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
@@ -5232,6 +5242,21 @@ dependencies = [
"winnow 0.7.15",
]
+[[package]]
+name = "toml"
+version = "1.1.8+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime 1.1.2+spec-1.1.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 1.0.4",
+]
+
[[package]]
name = "toml_datetime"
version = "0.7.5+spec-1.1.0"
@@ -5243,9 +5268,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "1.1.1+spec-1.1.0"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [
"serde_core",
]
@@ -5257,7 +5282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
dependencies = [
"indexmap",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
@@ -5265,18 +5290,18 @@ dependencies = [
[[package]]
name = "toml_parser"
-version = "1.1.3+spec-1.1.0"
+version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [
"winnow 1.0.4",
]
[[package]]
name = "toml_writer"
-version = "1.1.2+spec-1.1.0"
+version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "tonic"
@@ -5570,7 +5595,7 @@ dependencies = [
"serde",
"tempfile",
"textwrap",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_internal_macros",
"uniffi_meta",
"uniffi_pipeline",
@@ -5615,7 +5640,7 @@ dependencies = [
"quote",
"serde",
"syn 2.0.119",
- "toml",
+ "toml 0.9.12+spec-1.1.0",
"uniffi_meta",
]
@@ -6001,7 +6026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
dependencies = [
"windows-collections",
- "windows-core 0.61.2",
+ "windows-core",
"windows-future",
"windows-link 0.1.3",
"windows-numerics",
@@ -6013,20 +6038,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
dependencies = [
- "windows-core 0.61.2",
-]
-
-[[package]]
-name = "windows-core"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
-dependencies = [
- "windows-implement 0.58.0",
- "windows-interface 0.58.0",
- "windows-result 0.2.0",
- "windows-strings 0.1.0",
- "windows-targets 0.52.6",
+ "windows-core",
]
[[package]]
@@ -6035,11 +6047,11 @@ version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
dependencies = [
- "windows-implement 0.60.2",
- "windows-interface 0.59.3",
+ "windows-implement",
+ "windows-interface",
"windows-link 0.1.3",
- "windows-result 0.3.4",
- "windows-strings 0.4.2",
+ "windows-result",
+ "windows-strings",
]
[[package]]
@@ -6048,22 +6060,11 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
dependencies = [
- "windows-core 0.61.2",
+ "windows-core",
"windows-link 0.1.3",
"windows-threading",
]
-[[package]]
-name = "windows-implement"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.119",
-]
-
[[package]]
name = "windows-implement"
version = "0.60.2"
@@ -6075,17 +6076,6 @@ dependencies = [
"syn 2.0.119",
]
-[[package]]
-name = "windows-interface"
-version = "0.58.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.119",
-]
-
[[package]]
name = "windows-interface"
version = "0.59.3"
@@ -6115,19 +6105,10 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
- "windows-core 0.61.2",
+ "windows-core",
"windows-link 0.1.3",
]
-[[package]]
-name = "windows-result"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
-dependencies = [
- "windows-targets 0.52.6",
-]
-
[[package]]
name = "windows-result"
version = "0.3.4"
@@ -6137,16 +6118,6 @@ dependencies = [
"windows-link 0.1.3",
]
-[[package]]
-name = "windows-strings"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
-dependencies = [
- "windows-result 0.2.0",
- "windows-targets 0.52.6",
-]
-
[[package]]
name = "windows-strings"
version = "0.4.2"
diff --git a/tests/e2e/local-runtimes/Cargo.lock b/tests/e2e/local-runtimes/Cargo.lock
index 930491f869..474a17a2a1 100644
--- a/tests/e2e/local-runtimes/Cargo.lock
+++ b/tests/e2e/local-runtimes/Cargo.lock
@@ -1151,6 +1151,7 @@ version = "0.9.0"
dependencies = [
"base64 0.22.1",
"cua-agent-setup",
+ "cua-connections",
"cua-proto",
"cua-spacesd-client",
"flate2",
@@ -1217,6 +1218,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "cua-connections"
+version = "0.9.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "toml",
+]
+
[[package]]
name = "cua-create-failure"
version = "0.9.0"
@@ -4229,6 +4239,15 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "serde_spanned"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
+dependencies = [
+ "serde_core",
+]
+
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@@ -4722,6 +4741,21 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "toml"
+version = "1.1.6+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_parser",
+ "toml_writer",
+ "winnow",
+]
+
[[package]]
name = "toml_datetime"
version = "1.1.1+spec-1.1.0"