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(spaces): onboarding agents step: pick any agents or none, per computer, with Codex's ChatGPT sign-in (CUA-1995) (#5707)

ddupont4a44f4d39677
diff --git a/apps/cua-spaces-desktop/src/bridge/agents.ts b/apps/cua-spaces-desktop/src/bridge/agents.ts
index 1329a3ab48..af2a85af34 100644
--- a/apps/cua-spaces-desktop/src/bridge/agents.ts
+++ b/apps/cua-spaces-desktop/src/bridge/agents.ts
@@ -82,6 +82,12 @@ export function agentsMethods({ model }: BridgeContext): Handlers {
else await coding.act(strings(args, "agents"), false);
return encode(coding.rows ?? []);
},
+ "agents.signIn": async (args) => {
+ needSetup();
+ const coding = model.agents.coding;
+ await coding.signIn(string(args, "agent"));
+ return encode(coding.rows ?? []);
+ },
// A persistent agent's Memory, Routines and Access: what the native
// Agents page reads and the changes it runs, one method each.
"agents.detail": async (args) => {
diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.ts
index cfcc9ec0da..5ccc624d59 100644
--- a/apps/cua-spaces-desktop/src/bridge/methods.ts
+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts
@@ -16,7 +16,7 @@ export const METHODS = [
"spaces.setPower", "spaces.delete", "spaces.cancelCreate",
"machines.list", "host.status",
"agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume",
- "agents.setup", "agents.configure",
+ "agents.setup", "agents.configure", "agents.signIn",
"agents.detail", "agents.readFile", "agents.restoreFile", "agents.addRoutine", "agents.setRoutine",
"agents.removeRoutine", "agents.allowComputer", "agents.revokeComputer",
"agentKeys.list", "agentKeys.set", "agentKeys.remove",
diff --git a/apps/cua-spaces-desktop/src/model/agents.ts b/apps/cua-spaces-desktop/src/model/agents.ts
index 6dad7fff2b..65e90ed1ca 100644
--- a/apps/cua-spaces-desktop/src/model/agents.ts
+++ b/apps/cua-spaces-desktop/src/model/agents.ts
@@ -376,6 +376,8 @@ export interface AgentSetupRunning {
setUpCuaDriver(agents: string[]): Promise<AppAgentSetupOutcomeInput[]>;
/** Removes what cua added for `agents`. */
remove(agents: string[]): Promise<AppAgentSetupOutcomeInput[]>;
+ /** Starts `agent`'s own sign-in on this computer (`codex login`); returns once it runs. */
+ signIn(agent: string): Promise<void>;
}
/** The SDK's `AgentSetup`, registering the app's own `cua` as the MCP server. */
@@ -416,6 +418,10 @@ export class LiveAgentSetup implements AgentSetupRunning {
async remove(agents: string[]): Promise<AppAgentSetupOutcomeInput[]> {
return this.outcomes(await this.inner.remove(agents, true, true));
}
+
+ async signIn(agent: string): Promise<void> {
+ this.inner.signIn(agent);
+ }
}
/** The coding agents' setup until the SDK is in. */
@@ -439,6 +445,7 @@ export class PendingAgentSetup implements AgentSetupRunning {
setUp = async (agents: string[], skills: boolean, mcp: boolean) => (await this.s()).setUp(agents, skills, mcp);
setUpCuaDriver = async (agents: string[]) => (await this.s()).setUpCuaDriver(agents);
remove = async (agents: string[]) => (await this.s()).remove(agents);
+ signIn = async (agent: string) => (await this.s()).signIn(agent);
}
/** The Settings rows for the coding agents, and the changes made to them (the SwiftUI app's `AppModel.agentRows`, `configureAllAgents`, `agentAction`). */
@@ -512,6 +519,13 @@ export class CodingAgents {
}
}
+ /** Starts `agent`'s own sign-in (`codex login` opens the browser); the rows follow when it is done. */
+ async signIn(agent: string): Promise<void> {
+ if (!this.setup) return;
+ await this.setup.signIn(agent);
+ await this.reload();
+ }
+
/** A Settings row was pressed (`agent:<id>`): configure it, or remove what cua added when it is configured. */
async press(row: string): Promise<void> {
if (!row.startsWith("agent:")) return;
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
index 62a745cac5..c4d002532c 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts
@@ -964,6 +964,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_agentsetup_sign_in": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Void,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_sdk_fn_method_agentsetup_skills": {
args: [FfiType.Handle],
ret: FfiType.RustBuffer,
@@ -3059,6 +3064,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_agentsetup_sign_in": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_agentsetup_skills": {
args: [],
ret: FfiType.UInt16,
@@ -5110,6 +5120,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_agentsetup_select(uniffiSelf: bigint, selection: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_set_onboarding_declined(uniffiSelf: bigint, declined: number, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver(uniffiSelf: bigint, agents: Uint8Array, command: Uint8Array, skills: number, mcp: number): bigint;
+ uniffi_cua_sdk_fn_method_agentsetup_sign_in(uniffiSelf: bigint, agent: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_sdk_fn_method_agentsetup_skills(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_status(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_update(uniffiSelf: bigint, server: Uint8Array): bigint;
@@ -5529,6 +5540,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_agentsetup_select(): number;
uniffi_cua_sdk_checksum_method_agentsetup_set_onboarding_declined(): number;
uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver(): number;
+ uniffi_cua_sdk_checksum_method_agentsetup_sign_in(): number;
uniffi_cua_sdk_checksum_method_agentsetup_skills(): number;
uniffi_cua_sdk_checksum_method_agentsetup_status(): number;
uniffi_cua_sdk_checksum_method_agentsetup_update(): number;
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
index bb2b4129b4..ed8550964a 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
@@ -1653,7 +1653,16 @@ export type AgentInfo = {
/**
* What could not be verified from the agent's official docs.
*/
- unverified?: string
+ unverified?: string,
+ /**
+ * The account the agent signs in with on its own (`ChatGPT` for
+ * Codex), when cua can see that sign-in.
+ */
+ signIn?: string,
+ /**
+ * That sign-in is on this computer.
+ */
+ signedIn: boolean
}
/**
@@ -1661,6 +1670,8 @@ export type AgentInfo = {
*/
export const AgentInfo = (() => {
const defaults = () => ({
+ signIn: undefined,
+ signedIn: false
});
const create = (() => {
return uniffiCreateRecord<AgentInfo, ReturnType<typeof defaults>>(defaults);
@@ -1690,7 +1701,9 @@ const FfiConverterTypeAgentInfo = (() => {
skillsInstalled: FfiConverterSequenceString.read(from),
skillsOutdated: FfiConverterSequenceString.read(from),
error: FfiConverterOptionalString.read(from),
- unverified: FfiConverterOptionalString.read(from)
+ unverified: FfiConverterOptionalString.read(from),
+ signIn: FfiConverterOptionalString.read(from),
+ signedIn: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -1708,6 +1721,8 @@ const FfiConverterTypeAgentInfo = (() => {
FfiConverterSequenceString.write(value.skillsOutdated, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterOptionalString.write(value.unverified, into);
+ FfiConverterOptionalString.write(value.signIn, into);
+ FfiConverterBool.write(value.signedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
@@ -1723,7 +1738,9 @@ const FfiConverterTypeAgentInfo = (() => {
FfiConverterSequenceString.allocationSize(value.skillsInstalled) +
FfiConverterSequenceString.allocationSize(value.skillsOutdated) +
FfiConverterOptionalString.allocationSize(value.error) +
- FfiConverterOptionalString.allocationSize(value.unverified);
+ FfiConverterOptionalString.allocationSize(value.unverified) +
+ FfiConverterOptionalString.allocationSize(value.signIn) +
+ FfiConverterBool.allocationSize(value.signedIn);
}
};
@@ -19064,6 +19081,12 @@ export interface AgentSetupLike {
* `cua agents setup --cua-driver` and the installers' `cua-driver` item.
*/
setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
+/**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ signIn(agent: string) /*throws*/: void;
/**
* The skills bundled with this SDK.
*/
@@ -19316,6 +19339,22 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ signIn(agent: string): void /*throws*/ {uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agentsetup_sign_in(
+ uniffiTypeAgentSetupObjectFactory.clonePointer(this),
+ FfiConverterString.lower(agent, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ );
+ }
+
/**
* The skills bundled with this SDK.
*/
@@ -35705,6 +35744,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver() !== 33764) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_sign_in() !== 10179) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_sign_in");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_skills() !== 53692) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_skills");
}
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 feb81ec200..5d62686526 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
@@ -8428,7 +8428,15 @@ export type AppAgentSettingsRow = {
/**
* Skills directory.
*/
- skillsDir?: string
+ skillsDir?: string,
+ /**
+ * The account it signs in with on its own (`ChatGPT`), when known.
+ */
+ signIn?: string,
+ /**
+ * That sign-in is on this computer.
+ */
+ signedIn: boolean
}
/**
@@ -8460,7 +8468,9 @@ const FfiConverterTypeAppAgentSettingsRow = (() => {
skillsInstalled: FfiConverterUInt32.read(from),
skillsTotal: FfiConverterUInt32.read(from),
mcpConfig: FfiConverterOptionalString.read(from),
- skillsDir: FfiConverterOptionalString.read(from)
+ skillsDir: FfiConverterOptionalString.read(from),
+ signIn: FfiConverterOptionalString.read(from),
+ signedIn: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -8473,6 +8483,8 @@ const FfiConverterTypeAppAgentSettingsRow = (() => {
FfiConverterUInt32.write(value.skillsTotal, into);
FfiConverterOptionalString.write(value.mcpConfig, into);
FfiConverterOptionalString.write(value.skillsDir, into);
+ FfiConverterOptionalString.write(value.signIn, into);
+ FfiConverterBool.write(value.signedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.agent) +
@@ -8483,7 +8495,9 @@ const FfiConverterTypeAppAgentSettingsRow = (() => {
FfiConverterUInt32.allocationSize(value.skillsInstalled) +
FfiConverterUInt32.allocationSize(value.skillsTotal) +
FfiConverterOptionalString.allocationSize(value.mcpConfig) +
- FfiConverterOptionalString.allocationSize(value.skillsDir);
+ FfiConverterOptionalString.allocationSize(value.skillsDir) +
+ FfiConverterOptionalString.allocationSize(value.signIn) +
+ FfiConverterBool.allocationSize(value.signedIn);
}
};
@@ -8596,7 +8610,16 @@ export type AppAgentSetupStatus = {
/**
* Problem reading its config.
*/
- error?: string
+ error?: string,
+ /**
+ * The account it signs in with on its own (`ChatGPT` for Codex), when
+ * the setup can see that sign-in.
+ */
+ signIn?: string,
+ /**
+ * That sign-in is on this computer.
+ */
+ signedIn: boolean
}
/**
@@ -8628,7 +8651,9 @@ const FfiConverterTypeAppAgentSetupStatus = (() => {
cuaConfigured: FfiConverterBool.read(from),
skillsInstalled: FfiConverterSequenceString.read(from),
skillsOutdated: FfiConverterSequenceString.read(from),
- error: FfiConverterOptionalString.read(from)
+ error: FfiConverterOptionalString.read(from),
+ signIn: FfiConverterOptionalString.read(from),
+ signedIn: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -8641,6 +8666,8 @@ const FfiConverterTypeAppAgentSetupStatus = (() => {
FfiConverterSequenceString.write(value.skillsInstalled, into);
FfiConverterSequenceString.write(value.skillsOutdated, into);
FfiConverterOptionalString.write(value.error, into);
+ FfiConverterOptionalString.write(value.signIn, into);
+ FfiConverterBool.write(value.signedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
@@ -8651,7 +8678,9 @@ const FfiConverterTypeAppAgentSetupStatus = (() => {
FfiConverterBool.allocationSize(value.cuaConfigured) +
FfiConverterSequenceString.allocationSize(value.skillsInstalled) +
FfiConverterSequenceString.allocationSize(value.skillsOutdated) +
- FfiConverterOptionalString.allocationSize(value.error);
+ FfiConverterOptionalString.allocationSize(value.error) +
+ FfiConverterOptionalString.allocationSize(value.signIn) +
+ FfiConverterBool.allocationSize(value.signedIn);
}
};
diff --git a/apps/cua-spaces-desktop/test/agents-fixtures.ts b/apps/cua-spaces-desktop/test/agents-fixtures.ts
index fccb35639a..2204ff8924 100644
--- a/apps/cua-spaces-desktop/test/agents-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/agents-fixtures.ts
@@ -115,9 +115,9 @@ export class FixtureAgentSetup implements AgentSetupRunning {
constructor(statuses?: AppAgentSetupStatus[]) {
this.current = statuses ?? [
- { id: "claude-code", name: "Claude Code", installed: true, skillsDir: "~/.claude/skills", mcpConfig: "~/.claude.json", cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: undefined },
- { id: "codex", name: "Codex", installed: true, skillsDir: "~/.agents/skills", mcpConfig: "~/.codex/config.toml", cuaConfigured: true, skillsInstalled: ["cua-spaces", "cua-sandbox"], skillsOutdated: [], error: undefined },
- { id: "cursor", name: "Cursor", installed: false, skillsDir: undefined, mcpConfig: undefined, cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: undefined },
+ { id: "claude-code", name: "Claude Code", installed: true, skillsDir: "~/.claude/skills", mcpConfig: "~/.claude.json", cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: undefined, signIn: undefined, signedIn: false },
+ { id: "codex", name: "Codex", installed: true, skillsDir: "~/.agents/skills", mcpConfig: "~/.codex/config.toml", cuaConfigured: true, skillsInstalled: ["cua-spaces", "cua-sandbox"], skillsOutdated: [], error: undefined, signIn: "ChatGPT", signedIn: false },
+ { id: "cursor", name: "Cursor", installed: false, skillsDir: undefined, mcpConfig: undefined, cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: undefined, signIn: undefined, signedIn: false },
];
}
@@ -155,6 +155,14 @@ export class FixtureAgentSetup implements AgentSetupRunning {
return out;
}
+ /** The sign-in finishes at once (no browser in a fixture). */
+ async signIn(agent: string) {
+ this.calls.push(`sign-in:${agent}`);
+ const a = this.current.find((s) => s.id === agent);
+ if (!a?.signIn) throw new Error(`${a?.name ?? agent} has no sign-in cua can start`);
+ a.signedIn = true;
+ }
+
async remove(agents: string[]) {
this.calls.push(`remove:${agents.join(",")}`);
for (const a of this.current.filter((s) => agents.includes(s.id))) {
@@ -167,7 +175,7 @@ export class FixtureAgentSetup implements AgentSetupRunning {
/** The methods test/agents.test.ts checks (their answers need a daemon's tools, which the shared bridge test has none of). */
export const AGENT_METHODS = [
- "agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume", "agents.setup", "agents.configure", "agents.setupDriver",
+ "agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume", "agents.setup", "agents.configure", "agents.signIn", "agents.setupDriver",
"agents.detail", "agents.readFile", "agents.restoreFile", "agents.addRoutine", "agents.setRoutine", "agents.removeRoutine",
"agents.allowComputer", "agents.revokeComputer",
"agentKeys.list", "agentKeys.set", "agentKeys.remove",
diff --git a/apps/cua-spaces-desktop/test/agents.test.ts b/apps/cua-spaces-desktop/test/agents.test.ts
index 92e6a51e17..a9bf8e50cc 100644
--- a/apps/cua-spaces-desktop/test/agents.test.ts
+++ b/apps/cua-spaces-desktop/test/agents.test.ts
@@ -240,6 +240,7 @@ describe.skipIf(!built)("agents", () => {
expect(await code(bridge, "agents.setup")).toBe("unsupported");
expect(await code(bridge, "agents.configure", {})).toBe("unsupported");
expect(await code(bridge, "agents.setupDriver", { agents: ["codex"] })).toBe("unsupported");
+ expect(await code(bridge, "agents.signIn", { agent: "codex" })).toBe("unsupported");
expect(await code(bridge, "agents.runs", {})).toBe("bad_args");
expect(await code(bridge, "agents.pause", {})).toBe("bad_args");
});
@@ -259,6 +260,18 @@ describe.skipIf(!built)("agents", () => {
expect(await code(bridge, "agents.configure", { agents: "codex" })).toBe("bad_args");
});
+ it("starts an agent's own sign-in on this computer, and the rows say when it is done", async () => {
+ const { bridge } = makeBridge();
+ const rows = (await call(bridge, "agents.setup")) as { agent: string; signIn: string | null; signedIn: boolean }[];
+ expect(rows.find((r) => r.agent === "codex")).toMatchObject({ signIn: "ChatGPT", signedIn: false });
+ expect(rows.find((r) => r.agent === "claude-code")).toMatchObject({ signIn: null, signedIn: false });
+ const after = (await call(bridge, "agents.signIn", { agent: "codex" })) as typeof rows;
+ expect(setup.calls).toEqual(["sign-in:codex"]);
+ expect(after.find((r) => r.agent === "codex")?.signedIn).toBe(true);
+ expect(shapeProblems("agents.signIn", after)).toEqual([]);
+ expect(await code(bridge, "agents.signIn", {})).toBe("bad_args");
+ });
+
it("configures every detected agent when none are named", async () => {
const { bridge } = makeBridge();
await call(bridge, "agents.setup");
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index b537d2c8fd..80c522c7e9 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -1707,6 +1707,14 @@ public final class AppModel {
agentsBusy = false
}
+ /// Starts the agent's own sign-in on this Mac (`codex login`); the rows
+ /// show `signedIn` once the agent wrote it.
+ func agentSignIn(_ agent: String) async throws {
+ guard let agentSetup else { return }
+ try await agentSetup.signIn(agent: agent)
+ await reloadAgents()
+ }
+
func agentAction(_ ids: [String], remove: Bool) async {
guard let agentSetup, !ids.isEmpty else { return }
agentsPending += ids
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
index bcc3034d94..ee69d1e9c3 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
@@ -23,6 +23,9 @@ public protocol AgentSetupRunning: AnyObject, Sendable {
func setUpCuaDriver(agents: [String]) async throws -> [AppAgentSetupOutcomeInput]
/// Removes what cua added.
func remove(agents: [String]) async throws -> [AppAgentSetupOutcomeInput]
+ /// Starts the agent's own sign-in on this Mac (`codex login` opens the
+ /// browser); returns once it runs. The sign-in stays the agent's own.
+ func signIn(agent: String) async throws
}
/// The SDK's `AgentSetup`, registering the app's own `cua` as the MCP
@@ -54,6 +57,8 @@ public final class LiveAgentSetup: AgentSetupRunning, @unchecked Sendable {
public func remove(agents: [String]) async throws -> [AppAgentSetupOutcomeInput] {
try await inner.remove(agents: agents, skills: true, mcp: true).map { appAgentSetupOutcome(outcome: $0) }
}
+
+ public func signIn(agent: String) async throws { try inner.signIn(agent: agent) }
}
/// In-memory agents for fixtures and tests: nothing on disk is read or written.
@@ -65,12 +70,14 @@ public final class FixtureAgentSetup: AgentSetupRunning, @unchecked Sendable {
current = statuses ?? [
AppAgentSetupStatus(id: "claude-code", name: "Claude Code", installed: true, skillsDir: "~/.claude/skills",
mcpConfig: "~/.claude.json", cuaConfigured: false, skillsInstalled: [],
- skillsOutdated: [], error: nil),
+ skillsOutdated: [], error: nil, signIn: nil, signedIn: false),
AppAgentSetupStatus(id: "codex", name: "Codex", installed: true, skillsDir: "~/.agents/skills",
mcpConfig: "~/.codex/config.toml", cuaConfigured: true,
- skillsInstalled: ["cua-spaces", "cua-sandbox"], skillsOutdated: [], error: nil),
+ skillsInstalled: ["cua-spaces", "cua-sandbox"], skillsOutdated: [], error: nil,
+ signIn: "ChatGPT", signedIn: false),
AppAgentSetupStatus(id: "cursor", name: "Cursor", installed: false, skillsDir: nil, mcpConfig: nil,
- cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: nil),
+ cuaConfigured: false, skillsInstalled: [], skillsOutdated: [], error: nil,
+ signIn: nil, signedIn: false),
]
}
@@ -111,6 +118,16 @@ public final class FixtureAgentSetup: AgentSetupRunning, @unchecked Sendable {
return out
}
+ /// The sign-in finishes at once (no browser in a fixture).
+ public func signIn(agent: String) async throws {
+ calls.append("sign-in:\(agent)")
+ guard let i = current.firstIndex(where: { $0.id == agent }), current[i].signIn != nil else {
+ throw NSError(domain: "FixtureAgentSetup", code: 1,
+ userInfo: [NSLocalizedDescriptionKey: "\(agent) has no sign-in cua can start"])
+ }
+ current[i].signedIn = true
+ }
+
public func remove(agents: [String]) async throws -> [AppAgentSetupOutcomeInput] {
calls.append("remove:\(agents.joined(separator: ","))")
for i in current.indices where agents.contains(current[i].id) {
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
index 34f44f9a74..299a40a1a2 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift
@@ -710,6 +710,7 @@ public final class PendingAgentSetup: AgentSetupRunning, @unchecked Sendable {
public func remove(agents: [String]) async throws -> [AppAgentSetupOutcomeInput] {
try await s().remove(agents: agents)
}
+ public func signIn(agent: String) async throws { try await s().signIn(agent: agent) }
}
/// Cua Cloud billing until the SDK is in.
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
index 3e7057089e..58831eb02a 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift
@@ -74,7 +74,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
"spaces.setPower", "spaces.delete", "spaces.cancelCreate",
"machines.list", "host.status",
"agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume",
- "agents.setup", "agents.configure",
+ "agents.setup", "agents.configure", "agents.signIn",
// A persistent agent's Memory, Routines and Access (`PersistentModel`).
"agents.detail", "agents.readFile", "agents.restoreFile", "agents.addRoutine", "agents.setRoutine",
"agents.removeRoutine", "agents.allowComputer", "agents.revokeComputer",
@@ -298,7 +298,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
return hostStatus()
case "agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume",
- "agents.setup", "agents.configure":
+ "agents.setup", "agents.configure", "agents.signIn":
return try await agents(method, args)
case "checklist.get": return ["state": model.checklist.stored]
@@ -708,6 +708,12 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {
await model.agentAction(try strings(args, "agents"), remove: false)
}
return BridgeValue.encode(model.agentRows ?? [])
+ case "agents.signIn":
+ guard model.agentSetup != nil else { throw Failure.unsupported("Agent setup is not available in this build") }
+ do { try await model.agentSignIn(try string(args, "agent")) }
+ catch let f as Failure { throw f }
+ catch { throw Failure(code: "failed", message: LiveSpacesBackend.words(error)) }
+ return BridgeValue.encode(model.agentRows ?? [])
default:
throw Failure.unimplemented(method)
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
index 873f027f2e..f9bdb32e27 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift
@@ -211,7 +211,7 @@ struct BridgeContractTests {
("spaces.open", ["id": space]),
("machines.list", [:]), ("host.status", [:]),
("agents.list", [:]), ("agents.runs", ["spaceId": "local:aurora"]), ("agents.setup", [:]),
- ("agents.configure", ["agents": ["claude-code"]]),
+ ("agents.configure", ["agents": ["claude-code"]]), ("agents.signIn", ["agent": "codex"]),
("agents.detail", ["name": "ada"]), ("agents.readFile", ["path": "agents/ada/hermes/MEMORY.md"]),
("agents.restoreFile", ["path": "agents/ada/hermes/MEMORY.md", "version": "v1"]),
("agents.addRoutine", ["agent": "ada", "title": "Inbox", "prompt": "Sort my inbox", "everyMinutes": NSNull(),
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift
index c1149b28d1..5fadf0e896 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift
@@ -176,7 +176,7 @@ struct WebUIHostTests {
@Test func theContractsOperationsAreRouted() {
for m in ["spaces.cancelCreate", "host.status", "keyvault.approve", "keyvault.deny", "keyvault.revokeGrant",
"agents.list", "agents.runs", "agents.events", "agents.pause", "agents.resume",
- "agents.setup", "agents.configure"] {
+ "agents.setup", "agents.configure", "agents.signIn"] {
#expect(WebUIBridge.methods.contains(m), "\(m)")
}
}
@@ -309,6 +309,12 @@ struct WebUIHostTests {
#expect(rows?.first?["skillsTotal"] != nil)
let configured = try await bridge.handle("agents.configure", ["agents": ["claude-code"]]) as? [[String: Any]]
#expect(configured?.first { $0["agent"] as? String == "claude-code" }?["configured"] as? Bool == true)
+ // Codex's own ChatGPT sign-in: started on this Mac, and the row says when it is there.
+ #expect(rows?.first { $0["agent"] as? String == "codex" }?["signIn"] as? String == "ChatGPT")
+ #expect(rows?.first { $0["agent"] as? String == "codex" }?["signedIn"] as? Bool == false)
+ let signedIn = try await bridge.handle("agents.signIn", ["agent": "codex"]) as? [[String: Any]]
+ #expect(setup.calls.contains("sign-in:codex"))
+ #expect(signedIn?.first { $0["agent"] as? String == "codex" }?["signedIn"] as? Bool == true)
// A Settings row's button, as the native one: Remove on a configured agent.
_ = try await bridge.handle("settings.choose", ["row": "agent:claude-code", "option": "press"])
let removed = try await bridge.handle("agents.setup", [:]) as? [[String: Any]]
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 1c9521dbf2..23de27e4ea 100644
--- a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx
+++ b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-// The 0.10.0 first run on its real route with the wasm core: connect the
-// agent, then "Your agent can use this ..." with This computer as the first
+// The 0.10.0 first run on its real route with the wasm core: pick any
+// agents (or none), then "Your agent can use this ..." with This computer as the first
// Space; the extra Space never blocks Done and asks the host to notify when
// it is ready; a fix left turns Done into Finish later and Home keeps the
// to-do list.
@@ -11,6 +11,7 @@ import { cleanup, fireEvent, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { testCore, wasmBuilt } from "@/bridge/__tests__/testCore";
+import type { AgentSetupRow } from "@/bridge/contracts/agents";
import type { HostStatus } from "@/bridge/contracts/host";
import type { NewSpaceOptions } from "@/bridge/contracts/new-space";
import { readFirstRun, resetFirstRunCache, writeFirstRun } from "@/bridge/first-run";
@@ -29,9 +30,10 @@ afterEach(cleanup);
type Calls = { op: string; args: unknown }[];
-async function mount(opts: { host?: (h: HostStatus) => HostStatus; local?: (l: NonNullable<NewSpaceOptions["local"]>) => NewSpaceOptions["local"] } = {}) {
+async function mount(opts: { host?: (h: HostStatus) => HostStatus; local?: (l: NonNullable<NewSpaceOptions["local"]>) => NewSpaceOptions["local"]; agents?: (rows: AgentSetupRow[]) => AgentSetupRow[] } = {}) {
await testCore();
const calls: Calls = [];
+ let configured = false;
await mountApp("/onboarding", {
failsCreates: false,
listsGhost: false,
@@ -41,6 +43,9 @@ async function mount(opts: { host?: (h: HostStatus) => HostStatus; local?: (l: N
},
answer: (op, out) => {
if (op === "host.status" && opts.host) return opts.host(out as HostStatus);
+ // The agents as the test sets them up, until Continue adds Cua to them.
+ if (op === "agents.configure") configured = true;
+ if ((op === "agents.setup" || op === "agents.signIn") && opts.agents && !configured) return opts.agents(out as AgentSetupRow[]);
if (op === "spaces.createOptions" && opts.local) {
const o = out as NewSpaceOptions;
return { ...o, local: o.local ? opts.local(o.local) : o.local };
@@ -55,14 +60,22 @@ const heading = () => document.querySelector("[data-onboarding-heading]")?.textC
const primary = () => document.querySelector<HTMLButtonElement>("[data-first-run-primary]");
describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {
- it("connects the agent, then says it can use this computer, with Done on", async () => {
- const calls = await mount();
+ it("connects the ticked agents, then says they can use this computer, with Done on", async () => {
+ // Nothing set up yet: every installed agent is ticked.
+ const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });
await waitFor(() => expect(heading()).toBe("A shared Space for every agent."));
- const connect = await screen.findByRole("button", { name: /^Connect / });
- fireEvent.click(connect);
+ expect(document.querySelector("[data-first-run-intro]")!.textContent).toBe("Pick any, or none.");
+ const go = await waitFor(() => {
+ const b = document.querySelector<HTMLButtonElement>("[data-first-run-continue]");
+ expect(b?.dataset.firstRunContinue).toBeTruthy();
+ return b!;
+ });
+ const ticked = go.dataset.firstRunContinue!.split(",");
+ expect(ticked.length).toBeGreaterThan(1);
+ fireEvent.click(go);
await waitFor(() => expect(calls.find((c) => c.op === "agents.configure")).toBeTruthy());
- expect((calls.find((c) => c.op === "agents.configure")!.args as { agents: string[] }).agents).toHaveLength(1);
- await waitFor(() => expect(heading()).toMatch(/^Your agent can use this (Mac|PC|computer)\.$/), { timeout: 5000 });
+ expect((calls.find((c) => c.op === "agents.configure")!.args as { agents: string[] }).agents).toEqual(ticked);
+ await waitFor(() => expect(heading()).toMatch(/^Your agents can use this (Mac|PC|computer)\.$/), { timeout: 5000 });
expect(primary()!.disabled).toBe(false);
expect(primary()!.textContent).toBe("Done");
expect(document.querySelector('[data-first-run-row="computer"]')!.textContent).toMatch(/is your first Space/);
@@ -70,6 +83,45 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {
expect(document.body.textContent).not.toMatch(/\bVM\b|virtual machine|container|daemon|MCP/i);
});
+ it("takes none: nothing is configured and step 2 has no agent row or request", async () => {
+ const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });
+ await waitFor(() => expect(document.querySelectorAll('[data-first-run-pick][data-checked="true"]').length).toBeGreaterThan(0));
+ for (const row of document.querySelectorAll<HTMLElement>('[data-first-run-pick][data-checked="true"]')) {
+ fireEvent.click(row.querySelector('[data-slot="checkbox"]')!);
+ }
+ await waitFor(() => expect(document.querySelector('[data-first-run-pick][data-checked="true"]')).toBeNull());
+ expect(document.querySelector("[data-first-run-credentials]")).toBeNull();
+ fireEvent.click(document.querySelector<HTMLButtonElement>("[data-first-run-continue]")!);
+ await waitFor(() => expect(heading()).toMatch(/^This (Mac|PC|computer) is ready\.$|^Checking your setup\.$/), { timeout: 5000 });
+ await waitFor(() => expect(heading()).toMatch(/^This (Mac|PC|computer) is ready\.$/), { timeout: 5000 });
+ expect(calls.some((c) => c.op === "agents.configure")).toBe(false);
+ expect(document.querySelector('[data-first-run-row="agent"]')).toBeNull();
+ expect(document.querySelector("[data-first-run-copy]")).toBeNull();
+ expect(readFirstRun().picked).toEqual([]);
+ });
+
+ it("Codex only: adds Cua to Codex, and its ChatGPT sign-in starts on this computer", async () => {
+ const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });
+ await waitFor(() => expect(document.querySelector('[data-first-run-pick="codex"][data-checked="true"]')).toBeTruthy());
+ for (const row of document.querySelectorAll<HTMLElement>('[data-first-run-pick][data-checked="true"]')) {
+ if (row.dataset.firstRunPick !== "codex") fireEvent.click(row.querySelector('[data-slot="checkbox"]')!);
+ }
+ await waitFor(() => expect(document.querySelector<HTMLElement>("[data-first-run-continue]")!.dataset.firstRunContinue).toBe("codex"));
+ // The sign-in Codex uses, and where it stays.
+ const signIn = document.querySelector('[data-first-run-credential="sign-in:codex"]')!;
+ expect(signIn.textContent).toMatch(/ChatGPT sign-in/);
+ expect(signIn.textContent).toMatch(/uses it on this (Mac|PC|computer)/);
+ expect(document.querySelector("[data-first-run-credentials-note]")!.textContent).toMatch(/^They stay on this (Mac|PC|computer)\. Other computers keep their own\.$/);
+ expect(document.querySelector('[data-first-run-credential="key:anthropic"]')).toBeNull();
+ fireEvent.click(signIn.querySelector('[data-first-run-credential-action="agent-sign-in"]')!);
+ await waitFor(() => expect(calls.find((c) => c.op === "agents.signIn")?.args).toEqual({ agent: "codex" }));
+ await waitFor(() => expect(signIn.querySelector("[data-first-run-credential-status]")?.textContent).toBe("Signed in"), { timeout: 8000 });
+ fireEvent.click(document.querySelector<HTMLButtonElement>("[data-first-run-continue]")!);
+ await waitFor(() => expect((calls.find((c) => c.op === "agents.configure")?.args as { agents: string[] } | undefined)?.agents).toEqual(["codex"]));
+ await waitFor(() => expect(readFirstRun().step).toBe("setup"));
+ expect(readFirstRun().picked).toEqual(["codex"]);
+ });
+
it("says in plain words that usage data is on and linked to the account, and turns it off with one tap", async () => {
const calls = await mount();
await waitFor(() => expect(heading()).toBe("A shared Space for every agent."));
diff --git a/apps/cua-spaces-web/src/bridge/README.md b/apps/cua-spaces-web/src/bridge/README.md
index d19fdb8570..694863f771 100644
--- a/apps/cua-spaces-web/src/bridge/README.md
+++ b/apps/cua-spaces-web/src/bridge/README.md
@@ -283,6 +283,7 @@ under a host-neutral name; nothing here is a new mechanism. Types are in
| `agents.pause` / `agents.resume` | `{ name }` | `null` | `agent_pause` / `agent_resume` |
| `agents.setup` | `{}` | `AgentSetupRow[]` | `agent_setup_detect` (`cua agents status`) |
| `agents.configure` | `{ agents: string[] \| null }` | `AgentSetupRow[]` | `agent_setup_configure` (`cua agents setup`) |
+| `agents.signIn` | `{ agent }` | `AgentSetupRow[]` | unsupported (no command starts an agent's own sign-in) |
Event: `{ type: "agents.changed" }` when an agent is paused, resumed or saved,
or a run starts or ends. The store refetches `agents.list` and the runs.
@@ -312,6 +313,7 @@ which is the `agent_events` result as is):
| `agents.events` | `{ spaceId, runId, cursor, max? }` | `agent_events` result | the `agent_events` tool (`AgentRun.events(cursor:)` in the SDK) |
| `agents.pause` / `agents.resume` | `{ name }` | `null` | `PersistentModel.send(.pause/.resume)` |
| `agents.setup` / `agents.configure` | `{}` / `{ agents }` | `AgentSettingsRow[]` | the Settings "AI agents" rows |
+| `agents.signIn` | `{ agent }` | `AgentSettingsRow[]` | the agent's own sign-in on this computer (`codex login`; `AgentSetupRunning.signIn`), returning once it runs |
The host sends `agents.changed` when the persistent agents or the AI agents
rows change. Without the daemon (`persistent_agent_list`, `agent_events`) or
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
index 7083287d04..87cc4fc4be 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts
@@ -47,6 +47,7 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {
"agents.resume": { name: "ada" },
"agents.setup": {},
"agents.configure": { agents: null },
+ "agents.signIn": { agent: "codex" },
"agents.detail": { name: "ada" },
"agents.readFile": { path: "agents/ada/MEMORY.md" },
"agents.restoreFile": { path: "agents/ada/MEMORY.md", version: "agents/ada/MEMORY.md@1" },
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
index 379ef3c32a..aaebef9d93 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts
@@ -58,6 +58,7 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {
"agents.resume": { name: "ada" },
"agents.setup": {},
"agents.configure": { agents: null },
+ "agents.signIn": { agent: "codex" },
...AGENT_DETAIL_ARGS,
...NEW_SPACE_ARGS,
...AGENT_KEYS_ARGS,
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts
index a82a0027aa..292af31a27 100644
--- a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts
+++ b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts
@@ -698,7 +698,7 @@ describe("webkit adapter", () => {
const agent = { name: "ada", harness: "claude-code", space: "local:dev", paused: false, spaceState: "running", runId: "r1", savedMs: 0, lastError: null };
const run = { runId: "r1", agent: "claude-code", status: "running", reason: "", summary: "Fix the tests", createdAt: 1, phase: "thinking", turn: 2 };
const page = { run_id: "r1", status: "running", phase: "thinking", events: [], cursor: 4, caught_up: true };
- const row = { agent: "codex", name: "Codex", installed: true, configured: true, detail: "", skillsInstalled: 3, skillsTotal: 3, mcpConfig: null, skillsDir: null };
+ const row = { agent: "codex", name: "Codex", installed: true, configured: true, detail: "", skillsInstalled: 3, skillsTotal: 3, mcpConfig: null, skillsDir: null, signIn: null, signedIn: false };
const { win, sent } = webkitHost((req) => {
switch (req.method) {
case "agents.list":
diff --git a/apps/cua-spaces-web/src/bridge/__tests__/machines-pin.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/machines-pin.test.ts
new file mode 100644
index 0000000000..828afa4335
--- /dev/null
+++ b/apps/cua-spaces-web/src/bridge/__tests__/machines-pin.test.ts
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// Rows shown on purpose (parity, previews: `showMachines`) stay shown when a
+// host read that started before them answers afterwards.
+
+import { describe, expect, it } from "vitest";
+import type { DataAdapter } from "../adapter";
+import { createDemoAdapter } from "../adapters/demo";
+import type { MachineRow } from "../contracts/host";
+import { BridgeStore } from "../store";
+import { testCore, until, wasmBuilt } from "./testCore";
+
+describe.skipIf(!wasmBuilt)("pinned machine rows", () => {
+ it("a machines.list that answers after showMachines doesn't replace them", async () => {
+ const demo = createDemoAdapter({ latencyMs: 0 });
+ let answer: (() => void) | null = null;
+ const adapter: DataAdapter = Object.assign(Object.create(demo), {
+ call: ((method: string, args: unknown) => {
+ if (method === "machines.list") {
+ return new Promise((resolve) => {
+ answer = () => resolve(demo.call("machines.list", {}));
+ });
+ }
+ return demo.call(method as never, args as never);
+ }) as DataAdapter["call"],
+ });
+ const store = new BridgeStore(adapter, await testCore());
+ store.ensure("machines");
+ await until(() => answer !== null);
+ const pinned: MachineRow[] = [{ id: "pinned", name: "Pinned Mac", via: "local", online: true, os: "macos", current: true, limits: [] } as MachineRow];
+ store.showMachines(pinned, 1);
+ answer!();
+ await new Promise((r) => setTimeout(r, 20));
+ const ids = (store.get<{ id: string }[]>("machines").data ?? []).map((m) => m.id);
+ expect(ids).toContain("pinned");
+ expect(ids).not.toContain("mac-mini");
+ });
+});
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts b/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts
index b49cb9bf77..edfcc2d483 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts
@@ -41,6 +41,9 @@ export function demoAgentSetup(): AgentSetupRow[] {
skillsTotal: 6,
mcpConfig,
skillsDir,
+ // Codex signs in with ChatGPT on its own (`codex login`); the demo isn't signed in yet.
+ signIn: agent === "codex" ? "ChatGPT" : null,
+ signedIn: false,
});
return [
row("claude-code", "Claude Code", true, true, "~/.claude.json", "~/.claude/skills"),
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
index 045e1c6e40..1c3daa214e 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
@@ -519,6 +519,16 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
return null;
},
"agents.setup": () => state.agentSetup.map((r) => ({ ...r })),
+ // The demo's browser sign-in finishes a moment later.
+ "agents.signIn": async ({ agent }) => {
+ const row = state.agentSetup.find((r) => r.agent === agent);
+ if (!row?.signIn) throw new Error(`${row?.name ?? agent} has no sign-in Cua can start`);
+ if (!row.installed) throw new Error(`${row.name} isn't installed on this computer`);
+ setTimeout(() => {
+ state.agentSetup = state.agentSetup.map((r) => (r.agent === agent ? { ...r, signedIn: true } : r));
+ }, step * 40);
+ return state.agentSetup.map((r) => ({ ...r }));
+ },
"agents.configure": async ({ agents }) => {
await wait(step);
const wanted = (r: AgentSetupRow) => r.installed && (agents === null || agents.includes(r.agent));
diff --git a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
index 30755b55a4..9f0e0a4d9b 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/tauri.ts
@@ -88,6 +88,7 @@ export const TAURI_UNSUPPORTED: readonly OpName[] = [
"settings.choose",
"agents.events",
"agents.setupDriver",
+ "agents.signIn",
"host.joinWithCode",
...TELEPORT_TAURI_UNSUPPORTED,
...KEYVAULT_MANAGE_TAURI_UNSUPPORTED,
diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
index f1f7dc4b38..aa73b888ab 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
@@ -658,6 +658,7 @@ export function createWebkitAdapter(
},
"agents.setup": async () => list(await request("agents.setup")) as AgentSetupRow[],
"agents.configure": async ({ agents }) => list(await request("agents.configure", { agents: agents ?? null })) as AgentSetupRow[],
+ "agents.signIn": async ({ agent }) => list(await request("agents.signIn", { agent })) as AgentSetupRow[],
"session.openExternal": async ({ url }) => {
win.open?.(url, "_blank", "noopener");
return null;
diff --git a/apps/cua-spaces-web/src/bridge/contracts/agents.ts b/apps/cua-spaces-web/src/bridge/contracts/agents.ts
index b84ac466a7..95305d4640 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/agents.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/agents.ts
@@ -103,6 +103,10 @@ export interface AgentSetupRow {
/** The MCP config file cua edits, when the agent has one. */
mcpConfig: string | null;
skillsDir: string | null;
+ /** The account it signs in with on its own (`ChatGPT` for Codex), when the setup can see that sign-in. */
+ signIn: string | null;
+ /** That sign-in is on this computer. */
+ signedIn: boolean;
}
/* ---- One persistent agent's detail ---------------------------------------------
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 de08b8238a..83e4940775 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -329,6 +329,15 @@
"string",
"null"
]
+ },
+ "signIn": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "signedIn": {
+ "type": "boolean"
}
},
"required": [
@@ -340,7 +349,9 @@
"skillsInstalled",
"skillsTotal",
"mcpConfig",
- "skillsDir"
+ "skillsDir",
+ "signIn",
+ "signedIn"
]
},
"CatalogEntry": {
@@ -5185,6 +5196,12 @@
]
}
},
+ "agents.signIn": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/AgentSetupRow"
+ }
+ },
"checklist.get": {
"type": "object",
"properties": {
@@ -6767,6 +6784,12 @@
]
}
},
+ "agents.signIn": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/AgentSetupRow"
+ }
+ },
"app.info": {
"type": "object",
"properties": {
diff --git a/apps/cua-spaces-web/src/bridge/contracts/first-run.ts b/apps/cua-spaces-web/src/bridge/contracts/first-run.ts
index 811285514f..09f1f41ae6 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/first-run.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/first-run.ts
@@ -14,6 +14,9 @@ export interface FirstRunAgent {
name: string;
installed: boolean;
configured: boolean;
+ /** The account it signs in with on its own (`ChatGPT` for Codex). */
+ signIn?: string | null;
+ signedIn?: boolean;
}
export interface FirstRunPermission {
@@ -63,6 +66,13 @@ export interface FirstRunInput {
hostOs: string;
agents: FirstRunAgent[] | null;
agent: string | null;
+ /** Step 1: the ticks (null: not changed, so the installed ones). Step 2: the agents connected. */
+ picked: string[] | null;
+ /** The provider keys saved on this computer (null: not read, or this app can't). */
+ keys: { keys: { provider: string; env: string; last4: string; addedMs: number }[]; unavailable?: string | null; error?: string | null } | null;
+ /** The agent whose own sign-in is waiting for the browser. */
+ agentSigningIn: string | null;
+ agentSignInError: string | null;
connecting: boolean;
connectError: string | null;
agentOpenBeforeSetup: boolean | null;
@@ -81,23 +91,49 @@ export interface FirstRunButton {
label: string;
}
-export interface FirstRunAgentChoice {
+/** An agent on step 1. */
+export interface FirstRunAgentPick {
agent: string;
name: string;
+ checked: boolean;
installed: boolean;
+ /** Cua is in its settings already: it stays ticked. */
+ locked: boolean;
+ note: string | null;
+}
+
+/** A sign-in or a provider key on step 1. */
+export interface FirstRunCredential {
+ /** `sign-in:codex`, `key:anthropic`, `key:openai`. */
+ id: string;
+ title: string;
+ note: string;
+ status: string | null;
+ /** The status is a done one ("Signed in", "Saved"), not a wait. */
+ ok: boolean;
+ /** `agent-sign-in` (with `agent`) or `add-key` (with `provider`). */
+ action: FirstRunButton | null;
+ agent: string | null;
+ provider: string | null;
+ error: string | null;
}
export interface FirstRunConnectView {
title: string;
accent: string;
lede: string;
+ intro: string;
+ agentsLabel: string;
+ agents: FirstRunAgentPick[];
+ moreLabel: string;
+ more: FirstRunAgentPick[];
+ agentsNote: string;
+ credentialsLabel: string;
+ credentialsNote: string;
+ credentials: FirstRunCredential[];
primary: FirstRunButton;
- agent: FirstRunAgentChoice;
- note: string;
- noteMore: string;
- orLabel: string;
- others: FirstRunAgentChoice[];
- otherLabel: string;
+ /** The agents Continue connects. */
+ connects: string[];
busy: string | null;
error: string | null;
}
@@ -158,7 +194,8 @@ export interface FirstRunPrimary {
export interface FirstRunSetupView {
title: string;
rows: FirstRunRow[];
- prompt: FirstRunPromptView;
+ /** None when no agent was picked. */
+ prompt: FirstRunPromptView | null;
extra: FirstRunExtraView;
upsell: FirstRunUpsell | null;
primary: FirstRunPrimary;
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 5a259b7fe9..bca945f2de 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -604,6 +604,8 @@ const AgentSetupRowShape = ref(
skillsTotal: num,
mcpConfig: nullable(str),
skillsDir: nullable(str),
+ signIn: nullable(str),
+ signedIn: bool,
}),
);
@@ -870,6 +872,7 @@ export const OP_SHAPES: Record<OpName, Schema> = {
"agents.resume": nul,
"agents.setup": agentSetupRows,
"agents.configure": agentSetupRows,
+ "agents.signIn": agentSetupRows,
"agents.detail": AgentDetailShape,
"agents.readFile": AgentOpenFileShape,
"agents.restoreFile": nul,
@@ -1312,6 +1315,7 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {
"agents.resume": any,
"agents.setup": agentSetupRows,
"agents.configure": agentSetupRows,
+ "agents.signIn": agentSetupRows,
"agents.setupDriver": OP_SHAPES["agents.setupDriver"],
"agents.detail": AgentDetailShape,
"agents.readFile": AgentOpenFileShape,
diff --git a/apps/cua-spaces-web/src/bridge/coverage.ts b/apps/cua-spaces-web/src/bridge/coverage.ts
index 553af64845..3010d79c8c 100644
--- a/apps/cua-spaces-web/src/bridge/coverage.ts
+++ b/apps/cua-spaces-web/src/bridge/coverage.ts
@@ -124,6 +124,7 @@ export const HOST_COVERAGE = {
"agents.resume": { webkit: { methods: ["agents.resume"] }, tauri: ["agents_tool"] },
"agents.setup": { webkit: { methods: ["agents.setup"] }, tauri: ["agent_setup_detect"] },
"agents.configure": { webkit: { methods: ["agents.configure"] }, tauri: ["agent_setup_configure"] },
+ "agents.signIn": { webkit: { methods: ["agents.signIn"] }, tauri: [], unsupported: { tauri: "no command starts an agent's own sign-in" } },
...AGENT_DETAIL_COVERAGE,
...NEW_SPACE_COVERAGE,
...TELEPORT_COVERAGE,
diff --git a/apps/cua-spaces-web/src/bridge/first-run.ts b/apps/cua-spaces-web/src/bridge/first-run.ts
index df41b8ac89..5089083bce 100644
--- a/apps/cua-spaces-web/src/bridge/first-run.ts
+++ b/apps/cua-spaces-web/src/bridge/first-run.ts
@@ -2,13 +2,17 @@
// Copyright (c) 2026 Cua AI, Inc.
/**
- * The first run every host shows (0.10.0): connect your agent, then "Your
- * agent can use this Mac". The words, the rows, when Done is on and the
+ * The first run every host shows (0.10.0): pick any agents (or none), then
+ * "Your agent can use this Mac". The words, the rows, when Done is on and the
* to-do list on Home are the app core's (`firstRun.view`, `firstRun.todos`,
* `cua-spaces-app-core/src/first_run.rs`); this module gathers what the
* core reads (the agent setup, `host.status`, the sign-in, the extra
* Space's create) and runs the buttons.
*
+ * Step 1's ticks, the agents' own sign-ins (`agents.signIn` starts
+ * `codex login` on this computer; `agents.setup` reports `signedIn`) and the
+ * provider keys (`agentKeys.list`) are all per computer, and the page says so.
+ *
* What is real and what isn't (see `first_run.rs` for the detail):
* - "Cua is in the agent's settings": `agents.setup`'s `configured`. Real.
* - "The open session reloaded": no process check exists yet, so the row
@@ -45,6 +49,7 @@ import { useFirstSpaceOffers } from "./new-space-hooks";
import { onboardingInitial, onboardingTelemetry, onboardingView, readSavedOnboarding, writeSavedOnboarding } from "./onboarding";
import type { OnboardingFlowState } from "./contracts/onboarding";
import { useRelayUsage } from "./relay-usage";
+import { useAgentKeys } from "./agent-keys";
import { newPendingId } from "./store";
import { extraName, spokenName } from "./space-names";
@@ -85,6 +90,8 @@ function fallbackView(input: FirstRunInput): FirstRunView {
const place = input.hostOs === "macos" ? "this Mac" : input.hostOs === "windows" ? "this PC" : "this computer";
const art = { agent: input.agent ?? "claude-code", computer: "on" as const, extra: "outline" as const };
if (input.step === "connect") {
+ const picked = input.picked ?? (input.agents ?? []).filter((a) => a.installed).map((a) => a.agent);
+ const agents = (input.agents ?? []).map((a) => ({ agent: a.agent, name: a.name, checked: picked.includes(a.agent), installed: a.installed, locked: a.configured, note: null }));
return {
step: "connect",
later: "Skip for now",
@@ -92,13 +99,17 @@ function fallbackView(input: FirstRunInput): FirstRunView {
title: "A shared Space for every agent.",
accent: "agent",
lede: `Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on ${place}.`,
- primary: { id: "connect", label: `Connect ${name}` },
- agent: { agent: input.agent ?? "claude-code", name, installed: true },
- note: `Your agent will use ${place}.`,
- noteMore: "You can add a separate Space later.",
- orLabel: "Or",
- others: [],
- otherLabel: "Other",
+ intro: "Pick any, or none.",
+ agentsLabel: `On ${place}`,
+ agents,
+ moreLabel: "More agents",
+ more: [],
+ agentsNote: `Cua adds its skills and MCP server to each one you pick, on ${place} only. Your other computers set up their own.`,
+ credentialsLabel: "Sign-ins and keys",
+ credentialsNote: `They stay on ${place}. Other computers keep their own.`,
+ credentials: [],
+ primary: { id: "continue", label: "Continue" },
+ connects: picked,
busy: input.connecting ? `Adding Cua to ${name}…` : null,
error: input.connectError,
},
@@ -138,8 +149,10 @@ function fallbackView(input: FirstRunInput): FirstRunView {
* to-do list after Finish later). */
export interface FirstRunSaved {
step: FirstRunStep;
- /** The agent connected (setup id). */
+ /** The agent the first request names: the first one connected (setup id). */
agent: string | null;
+ /** Step 1: the ticks (null: not changed). Step 2: the agents connected. */
+ picked: string[] | null;
/** When the setup screen first showed (the access log counts from here). */
setupStartedMs: number | null;
/** When the agent was first seen using Cua. */
@@ -159,6 +172,7 @@ const KEY = "cua-spaces:first-run";
const EMPTY: FirstRunSaved = {
step: "connect",
agent: null,
+ picked: null,
setupStartedMs: null,
usedAtMs: null,
extraPendingId: null,
@@ -276,9 +290,14 @@ export interface FirstRunHook {
openUsageLink(): void;
input: FirstRunInput;
saved: FirstRunSaved;
- /** Every agent the setup knows (for "Other"). */
+ /** Every agent the setup knows. */
agents: AgentSetupRow[];
- connect(agent?: string): Promise<void>;
+ /** Step 1: tick or untick an agent. */
+ toggle(agent: string, on: boolean): void;
+ /** Step 1's Continue: adds Cua to the ticked agents not set up yet (none: nothing to add), then step 2. */
+ connect(): Promise<void>;
+ /** Starts an agent's own sign-in on this computer (`codex login`). */
+ signIn(agent: string): Promise<void>;
/** A row's or a to-do's button (`sign-in`, `set-up`, `open-settings`, `restart-check`, `connect`). */
act(id: string, settingsUrl?: string | null): Promise<void>;
copyPrompt(): Promise<void>;
@@ -310,6 +329,13 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
const [connectError, setConnectError] = useState<string | null>(null);
const [settingUp, setSettingUp] = useState(false);
const [setupError, setSetupError] = useState<string | null>(null);
+ const [signingAgent, setSigningAgent] = useState<string | null>(null);
+ const [signInError, setSignInError] = useState<string | null>(null);
+ const signingRef = useRef(signingAgent);
+ signingRef.current = signingAgent;
+ // The provider keys saved here (none until read, or where the app can't read them).
+ const agentKeys = useAgentKeys();
+ const keysInput = agentKeys.unsupported || agentKeys.isLoading ? null : agentKeys.input;
const [tick, setTick] = useState(0);
const shownRef = useRef(false);
const agentsRef = useRef(agents);
@@ -324,9 +350,12 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
let live = true;
let n = 0;
const read = () => {
- // The agent setup runs a command on the host: once connected, it's read now and then.
- const connected = agentsRef.current?.some((a) => a.agent === (readFirstRun().agent ?? "") && a.configured);
- if (!connected || n++ % 6 === 0) {
+ // The agent setup runs a command on the host: once connected, it's read now and then
+ // (every time while an agent's own sign-in waits for the browser).
+ const saved = readFirstRun();
+ const want = saved.picked ?? (saved.agent ? [saved.agent] : []);
+ const connected = saved.step === "setup" && Boolean(agentsRef.current) && want.every((id) => agentsRef.current!.some((a) => a.agent === id && a.configured));
+ if (signingRef.current || !connected || n++ % 6 === 0) {
void adapter
.call("agents.setup", {})
.then((rows) => live && setAgents(rows))
@@ -348,14 +377,25 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
}, [active, adapter, s.step, s.finishedLater, tick, pollMs]);
const rows: FirstRunAgent[] | null = agents
- ? agents.map((a) => ({ agent: a.agent, name: a.name, installed: a.installed, configured: a.configured }))
+ ? agents.map((a) => ({ agent: a.agent, name: a.name, installed: a.installed, configured: a.configured, signIn: a.signIn ?? null, signedIn: Boolean(a.signedIn) }))
: null;
const lead = core.tryCall<string>("firstRun.leadAgent", { agents: rows ?? [] }) ?? rows?.find((a) => a.installed)?.agent ?? "claude-code";
- const agentId = s.agent ?? lead;
- const agentName = rows?.find((a) => a.agent === agentId)?.name ?? null;
-
- // The first time the agent uses Cua since the setup screen opened.
- const usedMs = s.usedAtMs ?? (s.setupStartedMs && agentName ? agentUsedMs(core, host, s.setupStartedMs, agentName) : null);
+ // Step 2: the agents connected (an older saved run connected one, `agent`).
+ const connectedIds = s.step === "setup" ? (s.picked ?? (s.agent ? [s.agent] : [lead])) : [];
+ const agentId = s.step === "setup" ? (connectedIds[0] ?? null) : (s.agent ?? lead);
+ const agentNames = connectedIds.map((id) => rows?.find((a) => a.agent === id)?.name).filter((n): n is string => Boolean(n));
+
+ // The first time a connected agent uses Cua since the setup screen opened.
+ const usedMs =
+ s.usedAtMs ??
+ (s.setupStartedMs && agentNames.length
+ ? agentNames.map((n) => agentUsedMs(core, host, s.setupStartedMs!, n)).reduce<number | null>((a, b) => (b !== null && (a === null || b > a) ? b : a), null)
+ : null);
+
+ // An agent's own sign-in finished (its file is there): stop waiting.
+ useEffect(() => {
+ if (signingAgent && agents?.some((a) => a.agent === signingAgent && a.signedIn)) setSigningAgent(null);
+ }, [signingAgent, agents]);
useEffect(() => {
if (usedMs && !s.usedAtMs) writeFirstRun({ usedAtMs: usedMs });
}, [usedMs, s.usedAtMs]);
@@ -404,6 +444,10 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
hostOs: hostOs(),
agents: rows,
agent: agentId,
+ picked: s.picked,
+ keys: keysInput,
+ agentSigningIn: signingAgent,
+ agentSignInError: signInError,
connecting,
connectError,
// No process check yet (see the module comment).
@@ -483,25 +527,48 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [active, s.step, signedIn, host?.configured]);
- const connect = async (agent?: string) => {
- const id = agent ?? agentId;
- if (!adapter || connecting) return;
- setConnecting(true);
- setConnectError(null);
- writeFirstRun({ agent: id });
- try {
- const next = await adapter.call("agents.configure", { agents: [id] });
- setAgents(next);
- writeFirstRun({ step: "setup", agent: id, setupStartedMs: readFirstRun().setupStartedMs ?? Date.now() });
- } catch (e) {
- setConnectError(e instanceof Error ? e.message : String(e));
- } finally {
- setConnecting(false);
- }
+ // Step 1's ticks as the core decided them (the installed ones until the user changes one).
+ const ticked = (): string[] => {
+ const c = view.connect;
+ return c ? [...c.agents, ...c.more].filter((p) => p.checked).map((p) => p.agent) : (s.picked ?? []);
+ };
+
+ const toggle = (agent: string, on: boolean) => {
+ const now = ticked().filter((id) => id !== agent);
+ writeFirstRun({ picked: on ? [...now, agent] : now });
+ };
+
+ const connect = async () => {
+ if (!adapter || connecting) return;
+ // Step 1: the ticked ones; step 2's Connect: the connected ones still without Cua.
+ const picked = s.step === "connect" ? ticked() : connectedIds;
+ const ids = s.step === "connect" ? (view.connect?.connects ?? picked) : picked.filter((id) => !agents?.some((a) => a.agent === id && a.configured));
+ setConnecting(true);
+ setConnectError(null);
+ try {
+ if (ids.length) setAgents(await adapter.call("agents.configure", { agents: ids }));
+ writeFirstRun({ step: "setup", picked, agent: picked[0] ?? null, setupStartedMs: readFirstRun().setupStartedMs ?? Date.now() });
+ } catch (e) {
+ setConnectError(e instanceof Error ? e.message : String(e));
+ } finally {
+ setConnecting(false);
+ }
+ };
+
+ const signIn = async (agent: string) => {
+ if (!adapter) return;
+ setSignInError(null);
+ setSigningAgent(agent);
+ try {
+ setAgents(await adapter.call("agents.signIn", { agent }));
+ } catch (e) {
+ setSigningAgent(null);
+ setSignInError(e instanceof Error ? e.message : String(e));
+ }
};
const copyPrompt = async () => {
- const text = view.setup?.prompt.text ?? firstRunView(core, { ...input, step: "setup" }).setup?.prompt.text ?? "";
+ const text = view.setup?.prompt?.text ?? firstRunView(core, { ...input, step: "setup" }).setup?.prompt?.text ?? "";
await navigator.clipboard?.writeText(text).catch(() => {});
};
@@ -537,7 +604,9 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun
input,
saved: s,
agents: agents ?? [],
+ toggle,
connect,
+ signIn,
copyPrompt,
extra: extraAct,
async act(id, settingsUrl) {
diff --git a/apps/cua-spaces-web/src/bridge/protocol.ts b/apps/cua-spaces-web/src/bridge/protocol.ts
index 5849c5db30..88513e3d34 100644
--- a/apps/cua-spaces-web/src/bridge/protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/protocol.ts
@@ -261,6 +261,8 @@ export interface HostOperations
"agents.setup": { args: Record<string, never>; result: AgentSetupRow[] };
/** Adds the cua skills and MCP server to `agents`, or every installed one (`agent_setup_configure`). */
"agents.configure": { args: { agents: string[] | null }; result: AgentSetupRow[] };
+ /** Starts `agent`'s own sign-in on this computer (`codex login` opens the browser); the rows after. */
+ "agents.signIn": { args: { agent: string }; result: AgentSetupRow[] };
}
export type OpName = keyof HostOperations;
@@ -299,6 +301,7 @@ export const OPERATIONS = [
"agents.resume",
"agents.setup",
"agents.configure",
+ "agents.signIn",
...AGENT_DETAIL_OPERATIONS,
...NEW_SPACE_OPERATIONS,
...TELEPORT_OPERATIONS,
diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
index 57553416ac..43eed66dd5 100644
--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
@@ -68,6 +68,7 @@ export const WEBKIT_METHODS = [
"agents.resume",
"agents.setup",
"agents.configure",
+ "agents.signIn",
...AGENT_DETAIL_WEBKIT_METHODS,
...AGENT_KEYS_WEBKIT_METHODS,
...KEYVAULT_SETUP_WEBKIT_METHODS,
diff --git a/apps/cua-spaces-web/src/components/agents/key-sheet.tsx b/apps/cua-spaces-web/src/components/agents/key-sheet.tsx
new file mode 100644
index 0000000000..05d690b150
--- /dev/null
+++ b/apps/cua-spaces-web/src/components/agents/key-sheet.tsx
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { useState } from "react";
+
+import { agentKeyForm, type AgentKeyProvider, type AgentKeysHook } from "@/bridge";
+import { Button } from "@/components/ui/button";
+import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
+
+/** Add or replace a key. The key stays in this field until Save, then the sheet closes and it is gone. */
+export function KeySheet({ keys, provider, env }: { keys: AgentKeysHook; provider: AgentKeyProvider; env: string | null }) {
+ const [name, setName] = useState("");
+ const [value, setValue] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const v = agentKeyForm(keys.core, keys.input, { provider, env, name, hasValue: value.trim().length > 0 });
+
+ const save = async () => {
+ if (!v?.canSave || busy) return;
+ setBusy(true);
+ setError(null);
+ try {
+ await keys.save(v.provider, value, v.env);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : String(e));
+ setBusy(false);
+ }
+ };
+
+ if (!v) return null;
+ return (
+ <Dialog open onOpenChange={(o) => !o && keys.closeSheet()}>
+ <DialogPopup className="w-[min(440px,calc(100vw-2rem))]" data-agent-key-sheet>
+ <form
+ onSubmit={(e) => {
+ e.preventDefault();
+ void save();
+ }}
+ >
+ <div className="px-5 pt-5 pb-4">
+ <DialogTitle className="text-[15px] font-semibold" data-agent-key-sheet-title>
+ {v.title}
+ </DialogTitle>
+ <p className="mt-1.5 text-[13px] text-muted-foreground" data-agent-key-sheet-lede>
+ {v.lede}
+ </p>
+ {v.nameLabel ? (
+ <label className="mt-4 block">
+ <span className="mb-1 block text-xs font-medium">{v.nameLabel}</span>
+ <Input
+ data-agent-key-name
+ value={name}
+ placeholder={v.namePlaceholder ?? ""}
+ autoComplete="off"
+ spellCheck={false}
+ aria-invalid={v.nameError ? true : undefined}
+ className="font-mono"
+ onChange={(e) => setName(e.currentTarget.value)}
+ />
+ {v.nameError ? (
+ <span className="mt-1 block text-xs text-destructive" data-agent-key-name-error>
+ {v.nameError}
+ </span>
+ ) : null}
+ </label>
+ ) : null}
+ <label className="mt-4 block">
+ <span className="mb-1 block text-xs font-medium">{v.valueLabel}</span>
+ <Input
+ data-agent-key-value
+ type="password"
+ value={value}
+ placeholder={v.valuePlaceholder}
+ autoComplete="off"
+ spellCheck={false}
+ autoFocus={!v.nameLabel}
+ onChange={(e) => setValue(e.currentTarget.value)}
+ />
+ <span className="mt-1 block text-xs text-muted-foreground" data-agent-key-value-help>
+ {v.valueHelp}
+ </span>
+ </label>
+ {error ? (
+ <p className="mt-3 text-[13px] text-destructive" data-agent-key-error>
+ {error}
+ </p>
+ ) : null}
+ </div>
+ <div className="flex justify-end gap-2 border-t bg-muted/60 px-5 py-3">
+ <Button type="button" variant="outline" onClick={() => keys.closeSheet()} data-agent-key-cancel>
+ {v.cancelLabel}
+ </Button>
+ <Button type="submit" disabled={!v.canSave || busy} data-agent-key-save>
+ {busy ? "Saving…" : v.saveLabel}
+ </Button>
+ </div>
+ </form>
+ </DialogPopup>
+ </Dialog>
+ );
+}
diff --git a/apps/cua-spaces-web/src/routes/onboarding/index.tsx b/apps/cua-spaces-web/src/routes/onboarding/index.tsx
index e82e36b5fb..87f35b774c 100644
--- a/apps/cua-spaces-web/src/routes/onboarding/index.tsx
+++ b/apps/cua-spaces-web/src/routes/onboarding/index.tsx
@@ -2,10 +2,12 @@
// Copyright (c) 2026 Cua AI, Inc.
import { createFileRoute, useNavigate } from "@tanstack/react-router";
-import { CheckIcon, CopyIcon, PlusIcon } from "lucide-react";
+import { CheckIcon, ChevronRightIcon, CopyIcon } from "lucide-react";
import { useEffect, useState, type ReactNode } from "react";
-import { useFirstRun, type FirstRunArt, type FirstRunExtraView, type FirstRunHook, type FirstRunRow, type FirstRunUpsell, type FirstRunView } from "@/bridge";
+import { useAgentKeys, useFirstRun, type FirstRunAgentPick, type FirstRunArt, type FirstRunCredential, type FirstRunExtraView, type FirstRunHook, type FirstRunRow, type FirstRunUpsell, type FirstRunView } from "@/bridge";
+import { KeySheet } from "@/components/agents/key-sheet";
+import { Checkbox } from "@/components/ui/checkbox";
import { CuaKey } from "@/components/cua-key";
import { CuaLogo } from "@/components/cua-logo";
import { OsIcon } from "@/components/os-icon";
@@ -18,8 +20,8 @@ import { cn } from "@/lib/utils";
export const Route = createFileRoute("/onboarding/")({ component: OnboardingPage });
/**
- * The first run, the same on macOS, Windows and Linux: connect your agent,
- * then "Your agent can use this Mac". Every word and state is the app
+ * The first run, the same on macOS, Windows and Linux: pick any agents (or
+ * none), then "Your agent can use this Mac". Every word and state is the app
* core's (`firstRun.view`, through `useFirstRun`); this file places them
* beside the keycap art.
*/
@@ -83,22 +85,34 @@ const MARKS: Record<string, string> = {
openclaw: "/onboarding/marks/mark-openclaw.svg",
};
-function AgentMark({ agent, className }: { agent: string; className?: string }) {
+function AgentMark({ agent, name, className }: { agent: string; name?: string; className?: string }) {
const src = MARKS[agent];
- if (!src) return <PlusIcon className={cn("size-4", className)} aria-hidden />;
+ if (!src)
+ return (
+ <span aria-hidden className={cn("flex size-4 shrink-0 items-center justify-center rounded-[4px] bg-foreground/10 text-[9px] font-semibold text-muted-foreground", className)}>
+ {(name ?? agent).trim().charAt(0).toUpperCase()}
+ </span>
+ );
return <img src={src} alt="" aria-hidden className={cn("size-4 shrink-0 object-contain", agent !== "claude-code" && agent !== "openclaw" && "dark:invert", className)} draggable={false} />;
}
function Connect({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {
const c = view.connect!;
- const [others, setOthers] = useState(false);
+ const keys = useAgentKeys();
+ const [moreOpen, setMoreOpen] = useState(false);
const [before, after] = c.title.split(c.accent);
+ const busy = Boolean(c.busy);
+ // A ticked agent from "More agents" stays in view.
+ const more = moreOpen ? c.more : [];
+ // The picker draws once the agents and keys are read, all at once, so nothing on the page moves while
+ // they load (and the page isn't centred vertically: a growing block would move the heading).
+ const ready = fr.input.agents !== null && !keys.isLoading;
return (
- <div className="my-auto flex max-w-[620px] flex-col py-8" data-first-run="connect">
+ <div className="flex max-w-[560px] flex-col py-8" data-first-run="connect">
<h1
tabIndex={-1}
data-onboarding-heading=""
- className="font-display text-[clamp(40px,6vw,64px)] leading-[1.02] font-semibold tracking-[-0.03em] text-balance outline-none"
+ className="font-display text-[clamp(36px,5vw,56px)] leading-[1.02] font-semibold tracking-[-0.03em] text-balance outline-none"
>
{before}
{after !== undefined ? (
@@ -108,92 +122,145 @@ function Connect({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {
</>
) : null}
</h1>
- <p className="mt-5 max-w-[520px] text-[16px] leading-relaxed text-muted-foreground">{c.lede}</p>
- <div className="mt-10">
- <Button
- size="lg"
- className="h-12 gap-2.5 rounded-full px-6 text-[15px]"
- data-onboarding-primary=""
- data-first-run-connect={c.agent.agent}
- disabled={Boolean(c.busy)}
- autoFocus
- onClick={() => void fr.connect()}
- >
- <AgentMark agent={c.agent.agent} className={c.agent.agent === "claude-code" ? "" : "invert dark:invert-0"} />
- {c.busy ?? c.primary.label}
- </Button>
- </div>
- {c.error ? (
- <p role="alert" className="mt-3 text-[13px] text-destructive">
- {c.error}
- </p>
- ) : null}
- <p className="mt-6 flex flex-wrap items-center gap-x-2 text-[13px]">
- <span>{c.note}</span>
- <span className="text-muted-foreground">{c.noteMore}</span>
- </p>
- {fr.usage ? (
- <div className="mt-8 flex max-w-[520px] flex-col gap-3 text-[13px] text-muted-foreground" data-first-run-usage="">
- <p>
- {fr.usage.notice}{" "}
- <button type="button" className="underline hover:text-foreground" onClick={fr.openUsageLink}>
- {fr.usage.linkLabel}
- </button>
+ <p className="mt-4 max-w-[520px] text-[15px] leading-relaxed text-muted-foreground">{c.lede}</p>
+ {ready ? (
+ <>
+ <p className="mt-7 text-[14px] font-medium" data-first-run-intro="">
+ {c.intro}
</p>
- <label className="flex items-center gap-2.5 text-foreground">
- <Switch
- checked={fr.usage.on}
- disabled={!fr.usage.enabled}
- onCheckedChange={(on) => void fr.setUsage(on).catch(() => {})}
- aria-label={fr.usage.label}
- />
- <span>{fr.usage.label}</span>
- {fr.usage.help ? <span className="text-muted-foreground">{fr.usage.help}</span> : null}
- </label>
- </div>
+
+ <section className="mt-3" data-first-run-agents="">
+ <h2 className="mb-1.5 px-1 text-xs font-semibold text-muted-foreground">{c.agentsLabel}</h2>
+ <Card className="p-1.5">
+ {[...c.agents, ...more].map((p) => (
+ <AgentPickRow key={p.agent} pick={p} disabled={busy} onChange={(on) => fr.toggle(p.agent, on)} />
+ ))}
+ {c.more.length ? (
+ <button
+ type="button"
+ className="flex w-full items-center gap-1.5 rounded-lg px-3 py-1.5 text-left text-[13px] text-muted-foreground hover:text-foreground"
+ aria-expanded={moreOpen}
+ data-first-run-more=""
+ onClick={() => setMoreOpen((v) => !v)}
+ >
+ <ChevronRightIcon className={cn("size-3.5 transition-transform", moreOpen && "rotate-90")} aria-hidden />
+ {c.moreLabel} ({c.more.length})
+ </button>
+ ) : null}
+ </Card>
+ <p className="mt-2 px-1 text-xs text-muted-foreground" data-first-run-agents-note="">
+ {c.agentsNote}
+ </p>
+ </section>
+
+ {c.credentials.length ? (
+ <section className="mt-6" data-first-run-credentials="">
+ <h2 className="mb-1.5 px-1 text-xs font-semibold text-muted-foreground">{c.credentialsLabel}</h2>
+ <Card className="divide-y p-0">
+ {c.credentials.map((r) => (
+ <CredentialRowView
+ key={r.id}
+ row={r}
+ onAct={() => {
+ if (r.action?.id === "agent-sign-in" && r.agent) void fr.signIn(r.agent);
+ else if (r.action?.id === "add-key" && (r.provider === "anthropic" || r.provider === "openai")) keys.openSheet(r.provider);
+ }}
+ />
+ ))}
+ </Card>
+ <p className="mt-2 px-1 text-xs text-muted-foreground" data-first-run-credentials-note="">
+ {c.credentialsNote}
+ </p>
+ </section>
+ ) : null}
+
+ <div className="mt-8 flex items-center gap-4">
+ <Button
+ size="lg"
+ className="h-11 min-w-28 rounded-full px-6 text-[15px]"
+ data-onboarding-primary=""
+ data-first-run-continue={c.connects.join(",")}
+ disabled={busy}
+ autoFocus
+ onClick={() => void fr.connect()}
+ >
+ {c.busy ?? c.primary.label}
+ </Button>
+ </div>
+ {c.error ? (
+ <p role="alert" className="mt-3 text-[13px] text-destructive">
+ {c.error}
+ </p>
+ ) : null}
+ {fr.usage ? (
+ <div className="mt-8 flex max-w-[520px] flex-col gap-3 text-[13px] text-muted-foreground" data-first-run-usage="">
+ <p>
+ {fr.usage.notice}{" "}
+ <button type="button" className="underline hover:text-foreground" onClick={fr.openUsageLink}>
+ {fr.usage.linkLabel}
+ </button>
+ </p>
+ <label className="flex items-center gap-2.5 text-foreground">
+ <Switch
+ checked={fr.usage.on}
+ disabled={!fr.usage.enabled}
+ onCheckedChange={(on) => void fr.setUsage(on).catch(() => {})}
+ aria-label={fr.usage.label}
+ />
+ <span>{fr.usage.label}</span>
+ {fr.usage.help ? <span className="text-muted-foreground">{fr.usage.help}</span> : null}
+ </label>
+ </div>
+ ) : null}
+ </>
) : null}
- <div className="mt-8 flex flex-wrap items-center gap-x-5 gap-y-2 text-[13px]">
- <span className="text-muted-foreground">{c.orLabel}</span>
- {c.others.map((o) => (
- <button
- key={o.agent}
- type="button"
- className="flex items-center gap-1.5 hover:underline disabled:opacity-50"
- disabled={Boolean(c.busy)}
- data-first-run-other={o.agent}
- onClick={() => void fr.connect(o.agent)}
- >
- <AgentMark agent={o.agent} />
- {o.name}
- </button>
- ))}
- <button type="button" className="flex items-center gap-1.5 hover:underline" aria-expanded={others} onClick={() => setOthers((v) => !v)}>
- <PlusIcon className="size-3.5" aria-hidden />
- {c.otherLabel}
- </button>
- </div>
- {others ? <OtherAgents fr={fr} known={[c.agent.agent, ...c.others.map((o) => o.agent)]} /> : null}
+ {keys.sheet ? <KeySheet key={keys.sheet.provider} keys={keys} provider={keys.sheet.provider} env={keys.sheet.env} /> : null}
+ </div>
+ );
+}
+
+/** One agent: the box toggles, and so does a click anywhere on the row. */
+function AgentPickRow({ pick: p, disabled, onChange }: { pick: FirstRunAgentPick; disabled: boolean; onChange: (on: boolean) => void }) {
+ const off = p.locked || disabled;
+ return (
+ <div
+ className={cn("flex min-h-9 items-center gap-3 rounded-lg px-3 py-1.5", !off && "cursor-default hover:bg-foreground/[0.03]")}
+ data-first-run-pick={p.agent}
+ data-checked={String(p.checked)}
+ onClick={(e) => {
+ if (!off && !(e.target as HTMLElement).closest('[data-slot="checkbox"]')) onChange(!p.checked);
+ }}
+ >
+ <Checkbox checked={p.checked} disabled={off} aria-label={p.name} onCheckedChange={(on) => onChange(Boolean(on))} />
+ <AgentMark agent={p.agent} name={p.name} />
+ <span className="min-w-0 flex-1 text-[14px] select-none">{p.name}</span>
+ {p.note ? <span className="shrink-0 text-xs text-muted-foreground">{p.note}</span> : null}
</div>
);
}
-/** "Other": every other agent the setup knows, installed ones first. */
-function OtherAgents({ fr, known }: { fr: FirstRunHook; known: string[] }) {
- const rest = fr.agents.filter((a) => !known.includes(a.agent)).sort((a, b) => Number(b.installed) - Number(a.installed));
+function CredentialRowView({ row: r, onAct }: { row: FirstRunCredential; onAct: () => void }) {
return (
- <div className="mt-4 max-w-[520px] rounded-xl border bg-card p-1.5" data-first-run-others="">
- {rest.length === 0 ? <p className="px-3 py-2 text-[13px] text-muted-foreground">No other agents found on this computer.</p> : null}
- {rest.map((a) => (
- <div key={a.agent} className="flex items-center justify-between gap-3 px-3 py-1.5">
- <div className="min-w-0">
- <div className="text-[13px] font-medium">{a.name}</div>
- <div className="truncate text-xs text-muted-foreground">{a.installed ? (a.configured ? "Already uses Cua" : "Installed") : "Not installed"}</div>
+ <div className="flex items-center gap-3 px-4 py-2.5" data-first-run-credential={r.id}>
+ <div className="min-w-0 flex-1">
+ <div className="text-[14px]">{r.title}</div>
+ <div className="text-xs text-muted-foreground">{r.note}</div>
+ {r.error ? (
+ <div role="alert" className="mt-0.5 text-xs text-destructive">
+ {r.error}
</div>
- <Button variant="outline" size="sm" disabled={!a.installed} onClick={() => void fr.connect(a.agent)}>
- Connect
- </Button>
- </div>
- ))}
+ ) : null}
+ </div>
+ {r.status ? (
+ <span className={cn("shrink-0 text-xs", r.ok ? "rounded-full bg-[#1f9d55]/10 px-2 py-0.5 font-medium text-[#1f9d55]" : "text-muted-foreground")} data-first-run-credential-status="">
+ {r.status}
+ </span>
+ ) : null}
+ {r.action ? (
+ <Button size="sm" variant="outline" className="shrink-0 rounded-full" onClick={onAct} data-first-run-credential-action={r.action.id}>
+ {r.action.label}
+ </Button>
+ ) : null}
</div>
);
}
@@ -219,19 +286,23 @@ function Setup({ fr, view, onFinish }: { fr: FirstRunHook; view: FirstRunView; o
))}
</Card>
- <h2 className="mt-7 text-[14px] font-semibold">{s.prompt.heading}</h2>
- {s.prompt.copy ? (
- <Card className="mt-2 flex items-center justify-between gap-3 py-2.5 pr-2.5">
- <span className="min-w-0 text-[14px] select-text">“{s.prompt.text}”</span>
- <Button variant="outline" size="sm" className="shrink-0 gap-1.5 rounded-full" onClick={() => void copy()} data-first-run-copy="">
- {copied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}
- {copied ? "Copied" : s.prompt.copy}
- </Button>
- </Card>
- ) : (
- <p className="mt-1.5 text-[14px] select-text">“{s.prompt.text}”</p>
- )}
- <p className="mt-2 text-[13px] text-muted-foreground">{s.prompt.note}</p>
+ {s.prompt ? (
+ <>
+ <h2 className="mt-7 text-[14px] font-semibold">{s.prompt.heading}</h2>
+ {s.prompt.copy ? (
+ <Card className="mt-2 flex items-center justify-between gap-3 py-2.5 pr-2.5">
+ <span className="min-w-0 text-[14px] select-text">“{s.prompt.text}”</span>
+ <Button variant="outline" size="sm" className="shrink-0 gap-1.5 rounded-full" onClick={() => void copy()} data-first-run-copy="">
+ {copied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}
+ {copied ? "Copied" : s.prompt.copy}
+ </Button>
+ </Card>
+ ) : (
+ <p className="mt-1.5 text-[14px] select-text">“{s.prompt.text}”</p>
+ )}
+ <p className="mt-2 text-[13px] text-muted-foreground">{s.prompt.note}</p>
+ </>
+ ) : null}
<ExtraCard extra={s.extra} fr={fr} />
{s.upsell ? <UpsellCard card={s.upsell} fr={fr} /> : null}
@@ -252,7 +323,7 @@ function Setup({ fr, view, onFinish }: { fr: FirstRunHook; view: FirstRunView; o
</div>
{view.setup && !fr.saved.usedAtMs ? (
<button type="button" onClick={fr.back} className="mt-5 self-start text-xs text-muted-foreground hover:text-foreground">
- Use a different agent
+ Change agents
</button>
) : null}
</div>
diff --git a/apps/cua-spaces-web/src/routes/settings/agents.tsx b/apps/cua-spaces-web/src/routes/settings/agents.tsx
index 7e02f6710b..158bbeec31 100644
--- a/apps/cua-spaces-web/src/routes/settings/agents.tsx
+++ b/apps/cua-spaces-web/src/routes/settings/agents.tsx
@@ -3,13 +3,11 @@
import { createFileRoute } from "@tanstack/react-router";
import { KeyRoundIcon, TriangleAlertIcon } from "lucide-react";
-import { useState } from "react";
-import { agentKeyForm, useAgentKeys, type AgentKeyProvider, type AgentKeyRowView, type AgentKeysHook } from "@/bridge";
+import { useAgentKeys, type AgentKeyRowView } from "@/bridge";
+import { KeySheet } from "@/components/agents/key-sheet";
import { ConfirmDialog } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
-import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
-import { Input } from "@/components/ui/input";
import { toastError } from "@/components/ui/toast";
import { addedText } from "@/lib/agent-keys";
@@ -127,96 +125,3 @@ function KeyRow({ row: r, addedLabel, canEdit, onEdit, onRemove }: { row: AgentK
</div>
);
}
-
-/** Add or replace a key. The key stays in this field until Save, then the sheet closes and it is gone. */
-function KeySheet({ keys, provider, env }: { keys: AgentKeysHook; provider: AgentKeyProvider; env: string | null }) {
- const [name, setName] = useState("");
- const [value, setValue] = useState("");
- const [busy, setBusy] = useState(false);
- const [error, setError] = useState<string | null>(null);
- const v = agentKeyForm(keys.core, keys.input, { provider, env, name, hasValue: value.trim().length > 0 });
-
- const save = async () => {
- if (!v?.canSave || busy) return;
- setBusy(true);
- setError(null);
- try {
- await keys.save(v.provider, value, v.env);
- } catch (e) {
- setError(e instanceof Error ? e.message : String(e));
- setBusy(false);
- }
- };
-
- if (!v) return null;
- return (
- <Dialog open onOpenChange={(o) => !o && keys.closeSheet()}>
- <DialogPopup className="w-[min(440px,calc(100vw-2rem))]" data-agent-key-sheet>
- <form
- onSubmit={(e) => {
- e.preventDefault();
- void save();
- }}
- >
- <div className="px-5 pt-5 pb-4">
- <DialogTitle className="text-[15px] font-semibold" data-agent-key-sheet-title>
- {v.title}
- </DialogTitle>
- <p className="mt-1.5 text-[13px] text-muted-foreground" data-agent-key-sheet-lede>
- {v.lede}
- </p>
- {v.nameLabel ? (
- <label className="mt-4 block">
- <span className="mb-1 block text-xs font-medium">{v.nameLabel}</span>
- <Input
- data-agent-key-name
- value={name}
- placeholder={v.namePlaceholder ?? ""}
- autoComplete="off"
- spellCheck={false}
- aria-invalid={v.nameError ? true : undefined}
- className="font-mono"
- onChange={(e) => setName(e.currentTarget.value)}
- />
- {v.nameError ? (
- <span className="mt-1 block text-xs text-destructive" data-agent-key-name-error>
- {v.nameError}
- </span>
- ) : null}
- </label>
- ) : null}
- <label className="mt-4 block">
- <span className="mb-1 block text-xs font-medium">{v.valueLabel}</span>
- <Input
- data-agent-key-value
- type="password"
- value={value}
- placeholder={v.valuePlaceholder}
- autoComplete="off"
- spellCheck={false}
- autoFocus={!v.nameLabel}
- onChange={(e) => setValue(e.currentTarget.value)}
- />
- <span className="mt-1 block text-xs text-muted-foreground" data-agent-key-value-help>
- {v.valueHelp}
- </span>
- </label>
- {error ? (
- <p className="mt-3 text-[13px] text-destructive" data-agent-key-error>
- {error}
- </p>
- ) : null}
- </div>
- <div className="flex justify-end gap-2 border-t bg-muted/60 px-5 py-3">
- <Button type="button" variant="outline" onClick={() => keys.closeSheet()} data-agent-key-cancel>
- {v.cancelLabel}
- </Button>
- <Button type="submit" disabled={!v.canSave || busy} data-agent-key-save>
- {busy ? "Saving…" : v.saveLabel}
- </Button>
- </div>
- </form>
- </DialogPopup>
- </Dialog>
- );
-}
diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsx
index 4a0d7bc6c2..b0c01e90bc 100644
--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx
+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx
@@ -69,10 +69,12 @@ function SpacesPage() {
const firstRunTodos = useFirstRunTodosShown();
// The first Space is ready and no agent has worked in it yet: one action, "Run an agent here".
const { state: checklist } = useChecklist();
- const { data: agents } = useAgents();
+ const { data: agents, isLoading: agentsLoading } = useAgents();
const readySpace = spaces.find((s) => spaceState(s) === "running");
const agentRan = checklist.done.run_agent || (agents?.runs.length ?? 0) > 0 || (agents?.agents.length ?? 0) > 0;
- const offer = useAgentOffer(Boolean(readySpace) && !agentRan);
+ // Only once the agents are read: before that "no agent ran" isn't known, and the offer would show (and be
+ // counted as shown) for a moment on a computer whose agents already work.
+ const offer = useAgentOffer(Boolean(readySpace) && !agentsLoading && !agentRan);
const runHere = readySpace && !agentRan && offer.visible ? readySpace : undefined;
const [runOpen, setRunOpen] = useState(false);
const [connectOpen, setConnectOpen] = useState(false);
diff --git a/apps/cua-spaces/src-tauri/src/agent_setup.rs b/apps/cua-spaces/src-tauri/src/agent_setup.rs
index d04d1cd2d0..9f98a9516e 100644
--- a/apps/cua-spaces/src-tauri/src/agent_setup.rs
+++ b/apps/cua-spaces/src-tauri/src/agent_setup.rs
@@ -24,6 +24,8 @@ fn status(a: &AgentStatus) -> cua_spaces_app_core::agents::AgentSetupStatus {
skills_installed: a.skills_installed.clone(),
skills_outdated: a.skills_outdated.clone(),
error: a.error.clone(),
+ sign_in: a.sign_in.clone(),
+ signed_in: a.signed_in,
}
}
diff --git a/docs/content/docs/cua-sdk/reference/agent-setup.mdx b/docs/content/docs/cua-sdk/reference/agent-setup.mdx
new file mode 100644
index 0000000000..dfc6893b0f
--- /dev/null
+++ b/docs/content/docs/cua-sdk/reference/agent-setup.mdx
@@ -0,0 +1,639 @@
+---
+title: "Agent setup"
+description: "Detect coding agents, install cua skills and configure their MCP servers."
+---
+
+{/*
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
+ Generated by: pnpm --dir docs docs:generate:cua-sdk
+ Source: cua-bindgen docs (UniFFI metadata of libcua_sdk)
+ Version: 0.7.0
+*/}
+
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+`cua.agent_setup()` onboards coding agents on this machine: skills and MCP configuration.
+
+## `AgentSetup`
+
+Agent onboarding for this machine's user.
+
+Returned by [`Cua.agent_setup`](/cua-sdk/reference/cua#cua).
+
+| Method | Description |
+| --- | --- |
+| [`configure_mcp`](#agentsetupconfigure_mcp) | Configures the MCP server (default: `cua mcp`, `cua` resolved on PATH) for `agents`. |
+| [`install_skills`](#agentsetupinstall_skills) | Installs `skills` (empty: all bundled) for `agents`. |
+| [`remove`](#agentsetupremove) | Removes what cua added for `agents` (skills and/or MCP). |
+| [`select`](#agentsetupselect) | Resolves `all` (installed agents), `none` or `claude,codex` to ids. |
+| [`set_onboarding_declined`](#agentsetupset_onboarding_declined) | Saves or clears the "never" answer (`~/.cua/config`). |
+| [`setup_cua_driver`](#agentsetupsetup_cua_driver) | Background computer-use for `agents`: the bundled `cua-driver` skill (`skills`) and the `cua-driver mcp` server (`mcp`), launching `command` (default: the installed cua-driver). |
+| [`sign_in`](#agentsetupsign_in) | Starts `agent`'s own sign-in on this computer (`codex login`: the browser opens). |
+| [`update`](#agentsetupupdate) | Refreshes installed cua skills and re-points managed MCP entries. |
+
+| Accessor | Returns | Description |
+| --- | --- | --- |
+| `detect()` | [`Vec<AgentInfo>`](#agentinfo-record) | Every supported agent, installed or not (read-only). |
+| `onboarding_declined()` | `bool` | Whether the user said "never" to agent onboarding. |
+| `skills()` | [`Vec<BundledSkill>`](#bundledskill-record) | The skills bundled with this SDK. |
+| `status()` | [`Vec<AgentInfo>`](#agentinfo-record) | Same as `detect`, named for status displays. |
+
+### `AgentSetup.configure_mcp`
+
+Configures the MCP server (default: `cua mcp`, `cua` resolved on
+PATH) for `agents`.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def configure_mcp(self, agents: List[str], server: Optional[AgentMcpServer]) -> List[AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+configureMcp(agents: Array<string>, server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func configureMcp(agents: [String], server: AgentMcpServer?) async throws -> [AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun configureMcp(agents: List<String>, server: AgentMcpServer?): List<AgentSetupOutcome>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn configure_mcp(&self, agents: Vec<String>, server: Option<AgentMcpServer>) -> Result<Vec<AgentSetupOutcome>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `agents` | `Vec<String>` | required |
+| `server` | [`Option<AgentMcpServer>`](#agentmcpserver-record) | required |
+
+**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.install_skills`
+
+Installs `skills` (empty: all bundled) for `agents`. Folders cua did
+not write are skipped unless `force`.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def install_skills(self, agents: List[str], skills: List[str], force: bool) -> List[AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+installSkills(agents: Array<string>, skills: Array<string>, force: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func installSkills(agents: [String], skills: [String], force: Bool) async throws -> [AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun installSkills(agents: List<String>, skills: List<String>, force: Boolean): List<AgentSetupOutcome>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn install_skills(&self, agents: Vec<String>, skills: Vec<String>, force: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `agents` | `Vec<String>` | required |
+| `skills` | `Vec<String>` | required |
+| `force` | `bool` | required |
+
+**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.remove`
+
+Removes what cua added for `agents` (skills and/or MCP).
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def remove(self, agents: List[str], skills: bool, mcp: bool) -> List[AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+remove(agents: Array<string>, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func remove(agents: [String], skills: Bool, mcp: Bool) async throws -> [AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun remove(agents: List<String>, skills: Boolean, mcp: Boolean): List<AgentSetupOutcome>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn remove(&self, agents: Vec<String>, skills: bool, mcp: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `agents` | `Vec<String>` | required |
+| `skills` | `bool` | required |
+| `mcp` | `bool` | required |
+
+**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.select`
+
+Resolves `all` (installed agents), `none` or `claude,codex` to ids.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+def select(self, selection: str) -> List[str]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+select(selection: string): Array<string>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func select(selection: String) throws -> [String]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+fun select(selection: String): List<String>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn select(&self, selection: String) -> Result<Vec<String>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `selection` | `String` | required |
+
+**Returns** `Vec<String>` · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.set_onboarding_declined`
+
+Saves or clears the "never" answer (`~/.cua/config`).
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+def set_onboarding_declined(self, declined: bool) -> None
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+setOnboardingDeclined(declined: boolean): void
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func setOnboardingDeclined(declined: Bool) throws
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+fun setOnboardingDeclined(declined: Boolean)
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn set_onboarding_declined(&self, declined: bool) -> Result<(), CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `declined` | `bool` | required |
+
+**Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.setup_cua_driver`
+
+Background computer-use for `agents`: the bundled `cua-driver` skill
+(`skills`) and the `cua-driver mcp` server (`mcp`), launching
+`command` (default: the installed cua-driver). The same step as
+`cua agents setup --cua-driver` and the installers' `cua-driver` item.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def setup_cua_driver(self, agents: List[str], command: Optional[str], skills: bool, mcp: bool) -> List[AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func setupCuaDriver(agents: [String], command: String?, skills: Bool, mcp: Bool) async throws -> [AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun setupCuaDriver(agents: List<String>, command: String?, skills: Boolean, mcp: Boolean): List<AgentSetupOutcome>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn setup_cua_driver(&self, agents: Vec<String>, command: Option<String>, skills: bool, mcp: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `agents` | `Vec<String>` | required |
+| `command` | `Option<String>` | required |
+| `skills` | `bool` | required |
+| `mcp` | `bool` | required |
+
+**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.sign_in`
+
+Starts `agent`'s own sign-in on this computer (`codex login`: the
+browser opens). Returns once it is running; `detect` reports
+`signed_in` when it is done. cua never reads or copies the sign-in.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+def sign_in(self, agent: str) -> None
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+signIn(agent: string): void
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func signIn(agent: String) throws
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+fun signIn(agent: String)
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub fn sign_in(&self, agent: String) -> Result<(), CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `agent` | `String` | required |
+
+**Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `AgentSetup.update`
+
+Refreshes installed cua skills and re-points managed MCP entries.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def update(self, server: Optional[AgentMcpServer]) -> List[AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+update(server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func update(server: AgentMcpServer?) async throws -> [AgentSetupOutcome]
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun update(server: AgentMcpServer?): List<AgentSetupOutcome>
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn update(&self, server: Option<AgentMcpServer>) -> Result<Vec<AgentSetupOutcome>, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `server` | [`Option<AgentMcpServer>`](#agentmcpserver-record) | required |
+
+**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+## `AgentInfo` record
+
+One AI coding agent and what cua configured for it.
+
+Returned by [`AgentSetup.detect`](#agentsetup), [`AgentSetup.status`](#agentsetup).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `id` | `String` | | Registry id (`claude-code`, `codex`, `cursor`, ...). |
+| `name` | `String` | | Display name. |
+| `installed` | `bool` | | Whether it looks installed. |
+| `evidence` | `Vec<String>` | | What gave it away (`bin:<path>`, `path:<dir>`, `app:<bundle>`). |
+| `skills_dir` / `skillsDir` | `Option<String>` | | User skills directory, when the agent supports Agent Skills. |
+| `mcp_config` / `mcpConfig` | `Option<String>` | | User MCP config file, when the agent supports MCP. |
+| `mcp_format` / `mcpFormat` | `Option<String>` | | `json`, `toml` or `yaml`. |
+| `cua_configured` / `cuaConfigured` | `bool` | | A `cua` MCP server launching a cua binary is configured. |
+| `cua_managed` / `cuaManaged` | `bool` | | That entry is the one cua wrote. |
+| `cua_driver_configured` / `cuaDriverConfigured` | `bool` | | A `cua-driver` MCP server (background computer-use) is configured. |
+| `skills_installed` / `skillsInstalled` | `Vec<String>` | | Bundled skills present in the skills directory. |
+| `skills_outdated` / `skillsOutdated` | `Vec<String>` | | Installed bundled skills that differ from this SDK's copy. |
+| `error` | `Option<String>` | | Problem reading the MCP config (for example a malformed file). |
+| `unverified` | `Option<String>` | | What could not be verified from the agent's official docs. |
+| `sign_in` / `signIn` | `Option<String>` | `None` | The account the agent signs in with on its own (`ChatGPT` for Codex), when cua can see that sign-in. |
+| `signed_in` / `signedIn` | `bool` | `false` | That sign-in is on this computer. |
+
+## `AgentMcpServer` record
+
+The MCP server to register.
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `name` | `String` | `"cua"` | Server name (`cua`). |
+| `command` | `String` | | Launch command (an absolute `cua` path is best: GUI agents often lack the shell PATH). |
+| `args` | `Vec<String>` | | Arguments (`["mcp"]`). |
+| `env` | `HashMap<String, String>` | | Extra environment. |
+
+## `AgentSetupOutcome` record
+
+One target's outcome.
+
+Returned by [`AgentSetup.configure_mcp`](#agentsetupconfigure_mcp), [`AgentSetup.install_skills`](#agentsetupinstall_skills), [`AgentSetup.remove`](#agentsetupremove), [`AgentSetup.setup_cua_driver`](#agentsetupsetup_cua_driver), [`AgentSetup.update`](#agentsetupupdate).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `agents` | `Vec<String>` | | Agents served by this target. |
+| `target` | [`AgentSetupTarget`](#agentsetuptarget-enum) | | Kind. |
+| `item` | `String` | | Skill or server name. |
+| `path` | `String` | | Skill folder or config file. |
+| `change` | [`AgentSetupChange`](#agentsetupchange-enum) | | Result. |
+| `detail` | `String` | | Explanation. |
+| `backup` | `Option<String>` | | Backup taken before this write. |
+
+## `BundledSkill` record
+
+A skill bundled with the SDK.
+
+Returned by [`AgentSetup.skills`](#agentsetup).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `name` | `String` | | Name. |
+| `description` | `String` | | Description. |
+| `version` | `String` | | Version. |
+| `files` | `u32` | | Number of files. |
+
+## `AgentSetupChange` enum
+
+What happened to one target.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+AgentSetupChange.CREATED
+AgentSetupChange.UPDATED
+AgentSetupChange.UNCHANGED
+AgentSetupChange.REMOVED
+AgentSetupChange.SKIPPED
+AgentSetupChange.FAILED
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+AgentSetupChange.Created
+AgentSetupChange.Updated
+AgentSetupChange.Unchanged
+AgentSetupChange.Removed
+AgentSetupChange.Skipped
+AgentSetupChange.Failed
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+.created
+.updated
+.unchanged
+.removed
+.skipped
+.failed
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+AgentSetupChange.CREATED
+AgentSetupChange.UPDATED
+AgentSetupChange.UNCHANGED
+AgentSetupChange.REMOVED
+AgentSetupChange.SKIPPED
+AgentSetupChange.FAILED
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+AgentSetupChange::Created
+AgentSetupChange::Updated
+AgentSetupChange::Unchanged
+AgentSetupChange::Removed
+AgentSetupChange::Skipped
+AgentSetupChange::Failed
+```
+
+</Tab>
+</Tabs>
+
+| Variant | Description |
+| --- | --- |
+| `Created` | Written where nothing was. |
+| `Updated` | Replaced or edited. |
+| `Unchanged` | Already as wanted. |
+| `Removed` | Removed (or the previous entry restored). |
+| `Skipped` | Deliberately left alone (see detail). |
+| `Failed` | Failed (see detail); the target was left untouched. |
+
+## `AgentSetupTarget` enum
+
+What an operation touched.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+AgentSetupTarget.SKILL
+AgentSetupTarget.MCP
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+AgentSetupTarget.Skill
+AgentSetupTarget.Mcp
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+.skill
+.mcp
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+AgentSetupTarget.SKILL
+AgentSetupTarget.MCP
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+AgentSetupTarget::Skill
+AgentSetupTarget::Mcp
+```
+
+</Tab>
+</Tabs>
+
+| Variant | Description |
+| --- | --- |
+| `Skill` | A skill folder. |
+| `Mcp` | An MCP config entry. |
diff --git a/docs/content/docs/cua-sdk/reference/agents.mdx b/docs/content/docs/cua-sdk/reference/agents.mdx
index d497d958ed..412243c5e9 100644
--- a/docs/content/docs/cua-sdk/reference/agents.mdx
+++ b/docs/content/docs/cua-sdk/reference/agents.mdx
@@ -1209,577 +1209,3 @@ pub fn agent_event_category(kind: String) -> String
| `kind` | `String` | required |
**Returns** `String`
-
-## Agent setup
-
-`cua.agent_setup()` onboards coding agents on this machine: skills and MCP configuration.
-
-## `AgentSetup`
-
-Agent onboarding for this machine's user.
-
-Returned by [`Cua.agent_setup`](/cua-sdk/reference/cua#cua).
-
-| Method | Description |
-| --- | --- |
-| [`configure_mcp`](#agentsetupconfigure_mcp) | Configures the MCP server (default: `cua mcp`, `cua` resolved on PATH) for `agents`. |
-| [`install_skills`](#agentsetupinstall_skills) | Installs `skills` (empty: all bundled) for `agents`. |
-| [`remove`](#agentsetupremove) | Removes what cua added for `agents` (skills and/or MCP). |
-| [`select`](#agentsetupselect) | Resolves `all` (installed agents), `none` or `claude,codex` to ids. |
-| [`set_onboarding_declined`](#agentsetupset_onboarding_declined) | Saves or clears the "never" answer (`~/.cua/config`). |
-| [`setup_cua_driver`](#agentsetupsetup_cua_driver) | Background computer-use for `agents`: the bundled `cua-driver` skill (`skills`) and the `cua-driver mcp` server (`mcp`), launching `command` (default: the installed cua-driver). |
-| [`update`](#agentsetupupdate) | Refreshes installed cua skills and re-points managed MCP entries. |
-
-| Accessor | Returns | Description |
-| --- | --- | --- |
-| `detect()` | [`Vec<AgentInfo>`](#agentinfo-record) | Every supported agent, installed or not (read-only). |
-| `onboarding_declined()` | `bool` | Whether the user said "never" to agent onboarding. |
-| `skills()` | [`Vec<BundledSkill>`](#bundledskill-record) | The skills bundled with this SDK. |
-| `status()` | [`Vec<AgentInfo>`](#agentinfo-record) | Same as `detect`, named for status displays. |
-
-### `AgentSetup.configure_mcp`
-
-Configures the MCP server (default: `cua mcp`, `cua` resolved on
-PATH) for `agents`.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def configure_mcp(self, agents: List[str], server: Optional[AgentMcpServer]) -> List[AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-configureMcp(agents: Array<string>, server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func configureMcp(agents: [String], server: AgentMcpServer?) async throws -> [AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun configureMcp(agents: List<String>, server: AgentMcpServer?): List<AgentSetupOutcome>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn configure_mcp(&self, agents: Vec<String>, server: Option<AgentMcpServer>) -> Result<Vec<AgentSetupOutcome>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `agents` | `Vec<String>` | required |
-| `server` | [`Option<AgentMcpServer>`](#agentmcpserver-record) | required |
-
-**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.install_skills`
-
-Installs `skills` (empty: all bundled) for `agents`. Folders cua did
-not write are skipped unless `force`.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def install_skills(self, agents: List[str], skills: List[str], force: bool) -> List[AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-installSkills(agents: Array<string>, skills: Array<string>, force: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func installSkills(agents: [String], skills: [String], force: Bool) async throws -> [AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun installSkills(agents: List<String>, skills: List<String>, force: Boolean): List<AgentSetupOutcome>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn install_skills(&self, agents: Vec<String>, skills: Vec<String>, force: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `agents` | `Vec<String>` | required |
-| `skills` | `Vec<String>` | required |
-| `force` | `bool` | required |
-
-**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.remove`
-
-Removes what cua added for `agents` (skills and/or MCP).
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def remove(self, agents: List[str], skills: bool, mcp: bool) -> List[AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-remove(agents: Array<string>, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func remove(agents: [String], skills: Bool, mcp: Bool) async throws -> [AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun remove(agents: List<String>, skills: Boolean, mcp: Boolean): List<AgentSetupOutcome>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn remove(&self, agents: Vec<String>, skills: bool, mcp: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `agents` | `Vec<String>` | required |
-| `skills` | `bool` | required |
-| `mcp` | `bool` | required |
-
-**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.select`
-
-Resolves `all` (installed agents), `none` or `claude,codex` to ids.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-def select(self, selection: str) -> List[str]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-select(selection: string): Array<string>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func select(selection: String) throws -> [String]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-fun select(selection: String): List<String>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub fn select(&self, selection: String) -> Result<Vec<String>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `selection` | `String` | required |
-
-**Returns** `Vec<String>` · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.set_onboarding_declined`
-
-Saves or clears the "never" answer (`~/.cua/config`).
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-def set_onboarding_declined(self, declined: bool) -> None
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-setOnboardingDeclined(declined: boolean): void
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func setOnboardingDeclined(declined: Bool) throws
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-fun setOnboardingDeclined(declined: Boolean)
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub fn set_onboarding_declined(&self, declined: bool) -> Result<(), CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `declined` | `bool` | required |
-
-**Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.setup_cua_driver`
-
-Background computer-use for `agents`: the bundled `cua-driver` skill
-(`skills`) and the `cua-driver mcp` server (`mcp`), launching
-`command` (default: the installed cua-driver). The same step as
-`cua agents setup --cua-driver` and the installers' `cua-driver` item.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def setup_cua_driver(self, agents: List[str], command: Optional[str], skills: bool, mcp: bool) -> List[AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func setupCuaDriver(agents: [String], command: String?, skills: Bool, mcp: Bool) async throws -> [AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun setupCuaDriver(agents: List<String>, command: String?, skills: Boolean, mcp: Boolean): List<AgentSetupOutcome>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn setup_cua_driver(&self, agents: Vec<String>, command: Option<String>, skills: bool, mcp: bool) -> Result<Vec<AgentSetupOutcome>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `agents` | `Vec<String>` | required |
-| `command` | `Option<String>` | required |
-| `skills` | `bool` | required |
-| `mcp` | `bool` | required |
-
-**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `AgentSetup.update`
-
-Refreshes installed cua skills and re-points managed MCP entries.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def update(self, server: Optional[AgentMcpServer]) -> List[AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-update(server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func update(server: AgentMcpServer?) async throws -> [AgentSetupOutcome]
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun update(server: AgentMcpServer?): List<AgentSetupOutcome>
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn update(&self, server: Option<AgentMcpServer>) -> Result<Vec<AgentSetupOutcome>, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `server` | [`Option<AgentMcpServer>`](#agentmcpserver-record) | required |
-
-**Returns** [`Vec<AgentSetupOutcome>`](#agentsetupoutcome-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-## `AgentInfo` record
-
-One AI coding agent and what cua configured for it.
-
-Returned by [`AgentSetup.detect`](#agentsetup), [`AgentSetup.status`](#agentsetup).
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `id` | `String` | | Registry id (`claude-code`, `codex`, `cursor`, ...). |
-| `name` | `String` | | Display name. |
-| `installed` | `bool` | | Whether it looks installed. |
-| `evidence` | `Vec<String>` | | What gave it away (`bin:<path>`, `path:<dir>`, `app:<bundle>`). |
-| `skills_dir` / `skillsDir` | `Option<String>` | | User skills directory, when the agent supports Agent Skills. |
-| `mcp_config` / `mcpConfig` | `Option<String>` | | User MCP config file, when the agent supports MCP. |
-| `mcp_format` / `mcpFormat` | `Option<String>` | | `json`, `toml` or `yaml`. |
-| `cua_configured` / `cuaConfigured` | `bool` | | A `cua` MCP server launching a cua binary is configured. |
-| `cua_managed` / `cuaManaged` | `bool` | | That entry is the one cua wrote. |
-| `cua_driver_configured` / `cuaDriverConfigured` | `bool` | | A `cua-driver` MCP server (background computer-use) is configured. |
-| `skills_installed` / `skillsInstalled` | `Vec<String>` | | Bundled skills present in the skills directory. |
-| `skills_outdated` / `skillsOutdated` | `Vec<String>` | | Installed bundled skills that differ from this SDK's copy. |
-| `error` | `Option<String>` | | Problem reading the MCP config (for example a malformed file). |
-| `unverified` | `Option<String>` | | What could not be verified from the agent's official docs. |
-
-## `AgentMcpServer` record
-
-The MCP server to register.
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `name` | `String` | `"cua"` | Server name (`cua`). |
-| `command` | `String` | | Launch command (an absolute `cua` path is best: GUI agents often lack the shell PATH). |
-| `args` | `Vec<String>` | | Arguments (`["mcp"]`). |
-| `env` | `HashMap<String, String>` | | Extra environment. |
-
-## `AgentSetupOutcome` record
-
-One target's outcome.
-
-Returned by [`AgentSetup.configure_mcp`](#agentsetupconfigure_mcp), [`AgentSetup.install_skills`](#agentsetupinstall_skills), [`AgentSetup.remove`](#agentsetupremove), [`AgentSetup.setup_cua_driver`](#agentsetupsetup_cua_driver), [`AgentSetup.update`](#agentsetupupdate).
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `agents` | `Vec<String>` | | Agents served by this target. |
-| `target` | [`AgentSetupTarget`](#agentsetuptarget-enum) | | Kind. |
-| `item` | `String` | | Skill or server name. |
-| `path` | `String` | | Skill folder or config file. |
-| `change` | [`AgentSetupChange`](#agentsetupchange-enum) | | Result. |
-| `detail` | `String` | | Explanation. |
-| `backup` | `Option<String>` | | Backup taken before this write. |
-
-## `BundledSkill` record
-
-A skill bundled with the SDK.
-
-Returned by [`AgentSetup.skills`](#agentsetup).
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `name` | `String` | | Name. |
-| `description` | `String` | | Description. |
-| `version` | `String` | | Version. |
-| `files` | `u32` | | Number of files. |
-
-## `AgentSetupChange` enum
-
-What happened to one target.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-AgentSetupChange.CREATED
-AgentSetupChange.UPDATED
-AgentSetupChange.UNCHANGED
-AgentSetupChange.REMOVED
-AgentSetupChange.SKIPPED
-AgentSetupChange.FAILED
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-AgentSetupChange.Created
-AgentSetupChange.Updated
-AgentSetupChange.Unchanged
-AgentSetupChange.Removed
-AgentSetupChange.Skipped
-AgentSetupChange.Failed
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-.created
-.updated
-.unchanged
-.removed
-.skipped
-.failed
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-AgentSetupChange.CREATED
-AgentSetupChange.UPDATED
-AgentSetupChange.UNCHANGED
-AgentSetupChange.REMOVED
-AgentSetupChange.SKIPPED
-AgentSetupChange.FAILED
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-AgentSetupChange::Created
-AgentSetupChange::Updated
-AgentSetupChange::Unchanged
-AgentSetupChange::Removed
-AgentSetupChange::Skipped
-AgentSetupChange::Failed
-```
-
-</Tab>
-</Tabs>
-
-| Variant | Description |
-| --- | --- |
-| `Created` | Written where nothing was. |
-| `Updated` | Replaced or edited. |
-| `Unchanged` | Already as wanted. |
-| `Removed` | Removed (or the previous entry restored). |
-| `Skipped` | Deliberately left alone (see detail). |
-| `Failed` | Failed (see detail); the target was left untouched. |
-
-## `AgentSetupTarget` enum
-
-What an operation touched.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-AgentSetupTarget.SKILL
-AgentSetupTarget.MCP
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-AgentSetupTarget.Skill
-AgentSetupTarget.Mcp
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-.skill
-.mcp
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-AgentSetupTarget.SKILL
-AgentSetupTarget.MCP
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-AgentSetupTarget::Skill
-AgentSetupTarget::Mcp
-```
-
-</Tab>
-</Tabs>
-
-| Variant | Description |
-| --- | --- |
-| `Skill` | A skill folder. |
-| `Mcp` | An MCP config entry. |
diff --git a/docs/content/docs/cua-sdk/reference/cua.mdx b/docs/content/docs/cua-sdk/reference/cua.mdx
index f9e1ac75c1..2f1f4d1aad 100644
--- a/docs/content/docs/cua-sdk/reference/cua.mdx
+++ b/docs/content/docs/cua-sdk/reference/cua.mdx
@@ -38,7 +38,7 @@ accessors.
| Accessor | Returns | Description |
| --- | --- | --- |
-| `agent_setup()` | [`AgentSetup`](/cua-sdk/reference/agents#agentsetup) | Agent onboarding: detect AI coding agents, install the cua skills and configure the cua MCP server for the current user. |
+| `agent_setup()` | [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup) | Agent onboarding: detect AI coding agents, install the cua skills and configure the cua MCP server for the current user. |
| `auth()` | [`Auth`](/cua-sdk/reference/auth#auth) | Sign-in and the shared session (`CUA_OIDC_ISSUER`, `CUA_CREDENTIAL_STORE`, `CUA_HOME` apply). |
| `local()` | [`Local`](#local) | Local runtimes (doctor and setup) and local images. |
| `mode()` | [`CuaMode`](#cuamode-enum) | Topology. |
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index a9c44abb33..7d95981bd8 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -41,6 +41,7 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th
| [Files](/cua-sdk/reference/spacesd/files) | Upload, download, list and remove files in a sandbox through cua-spacesd. |
| [Computer and media](/cua-sdk/reference/spacesd/computer) | Screenshots, pointer, keyboard, clipboard and displays of a sandbox desktop, and its video and audio streams. |
| [Coding agents and setup](/cua-sdk/reference/agents) | Run coding agents (Claude Code, Codex, Gemini CLI, OpenCode, ...) inside any sandbox, and set them up on this machine. |
+| [Agent setup](/cua-sdk/reference/agent-setup) | Detect coding agents, install cua skills and configure their MCP servers. |
## Spaces
@@ -81,4 +82,4 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th
| --- | --- |
| [Protocol](/cua-sdk/reference/protocol) | The gRPC contracts of cua-spacesd (`cua.env.v1`) and the cua daemon (`cua.daemon.v1`). |
-286 items, 358 methods. The [Types](/cua-sdk/reference/types) page lists them.
+286 items, 359 methods. The [Types](/cua-sdk/reference/types) page lists them.
diff --git a/docs/content/docs/cua-sdk/reference/meta.json b/docs/content/docs/cua-sdk/reference/meta.json
index 7271f2b53f..4095e7157e 100644
--- a/docs/content/docs/cua-sdk/reference/meta.json
+++ b/docs/content/docs/cua-sdk/reference/meta.json
@@ -12,6 +12,7 @@
"---Inside a sandbox---",
"spacesd",
"agents",
+ "agent-setup",
"---Spaces---",
"spaces",
"---Account---",
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
index 03a2794133..b2d4508095 100644
--- a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
+++ b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
@@ -18,7 +18,7 @@ The cua SDK: the only `#[uniffi::export]` crate of `libs/cua`.
These are the objects, records, enums and functions the language bindings export, documented once in the [Cua SDK reference](/cua-sdk/reference), whose Rust tabs show each signature. Objects are `Arc<T>` handles whose methods are `async fn` returning `Result<_, CuaError>`, records are structs with public fields, and names are snake_case.
-[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agents#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agents#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agents#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agents#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostServiceMigration`](/cua-sdk/reference/spaces/host#hostservicemigration-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-record), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record).
+[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agent-setup#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agent-setup#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agent-setup#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agent-setup#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agent-setup#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agent-setup#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostServiceMigration`](/cua-sdk/reference/spaces/host#hostservicemigration-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-record), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record).
## Types
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index e132c48479..736a4edb7a 100644
--- a/docs/content/docs/cua-sdk/reference/types.mdx
+++ b/docs/content/docs/cua-sdk/reference/types.mdx
@@ -62,8 +62,8 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record) | record | One normalized event. |
| [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record) | record | A page of events. |
| [`AgentFile`](/cua-sdk/reference/agents#agentfile-record) | record | A file for the first prompt or a follow-up. |
-| [`AgentInfo`](/cua-sdk/reference/agents#agentinfo-record) | record | One AI coding agent and what cua configured for it. |
-| [`AgentMcpServer`](/cua-sdk/reference/agents#agentmcpserver-record) | record | The MCP server to register. |
+| [`AgentInfo`](/cua-sdk/reference/agent-setup#agentinfo-record) | record | One AI coding agent and what cua configured for it. |
+| [`AgentMcpServer`](/cua-sdk/reference/agent-setup#agentmcpserver-record) | record | The MCP server to register. |
| [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record) | record | What `Spaces.agent_pause` did. |
| [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record) | record | What `Spaces.agent_resume` did. |
| [`AgentRun`](/cua-sdk/reference/agents#agentrun) | object | One run. |
@@ -73,10 +73,10 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record) | record | What the last turn produced. |
| [`AgentRunStatus`](/cua-sdk/reference/spaces#agentrunstatus-record) | record | One agent run's status. |
| [`Agents`](/cua-sdk/reference/agents#agents) | object | Agent runs in one sandbox. |
-| [`AgentSetup`](/cua-sdk/reference/agents#agentsetup) | object | Agent onboarding for this machine's user. |
-| [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum) | enum | What happened to one target. |
-| [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record) | record | One target's outcome. |
-| [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum) | enum | What an operation touched. |
+| [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup) | object | Agent onboarding for this machine's user. |
+| [`AgentSetupChange`](/cua-sdk/reference/agent-setup#agentsetupchange-enum) | enum | What happened to one target. |
+| [`AgentSetupOutcome`](/cua-sdk/reference/agent-setup#agentsetupoutcome-record) | record | One target's outcome. |
+| [`AgentSetupTarget`](/cua-sdk/reference/agent-setup#agentsetuptarget-enum) | enum | What an operation touched. |
| [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record) | record | Result of `Space.agent_start`. |
| [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript) | object | A run's events folded into conversation items, the same rule in every language: the agent's message chunks join into `message` items, the prompt is a `user` item (never repeated as agent text), and consecutive activity of one turn folds into one `activity` group. |
| [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record) | record | One item of an `AgentTranscript`. |
@@ -87,7 +87,7 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record) | record | Who is signed in (from token claims; display only). |
| [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record) | record | The stored session, read without network access. |
| [`BuildFile`](/cua-sdk/reference/image#buildfile-record) | record | A local file copied into a built image. |
-| [`BundledSkill`](/cua-sdk/reference/agents#bundledskill-record) | record | A skill bundled with the SDK. |
+| [`BundledSkill`](/cua-sdk/reference/agent-setup#bundledskill-record) | record | A skill bundled with the SDK. |
| [`canonical_image`](/cua-sdk/reference/image#canonical_image) | function | The canonical image for `os` (`linux`, `windows`, `macos`) and `version` (`None` = default: `ghcr.io/trycua/linux:24.04`, `ghcr.io/trycua/windows:2022`, `ghcr.io/trycua/macos:26`; macOS accepts `tahoe`/`sequoia`). |
| [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier) | function | The canonical image for `os`, `version` and `tier`: `slim` (the minimum that passes `cua-spacesd doctor --strict`; CI and benchmarks use it), `full` or `None` (the default, with dev tooling) or, on macOS, `xcode` / `xcode-<X.Y>` (full plus one pinned Xcode). |
| [`check_placement`](/cua-sdk/reference/cua#check_placement) | function | Checks a location, kind and runtime against each other without creating anything: `InvalidPlacement` (listing the valid values) when the combination does not exist. |
diff --git a/docs/content/docs/redirects.json b/docs/content/docs/redirects.json
index 354c9c6468..0d6e9ffc0d 100644
--- a/docs/content/docs/redirects.json
+++ b/docs/content/docs/redirects.json
@@ -140,7 +140,7 @@
"cua-sdk/guides/share-service-with-signed-url": "cua-sdk/guides/services",
"cua-sdk/guides/tunneling": "cua-sdk/guides/services",
"cua-sdk/reference/api": "cua-sdk/reference",
- "cua-sdk/reference/api/agents": "cua-sdk/reference/agents#agent-setup",
+ "cua-sdk/reference/api/agents": "cua-sdk/reference/agent-setup",
"cua-sdk/reference/api/auth": "cua-sdk/reference/auth",
"cua-sdk/reference/api/cua": "cua-sdk/reference/cua",
"cua-sdk/reference/api/errors": "cua-sdk/reference/errors",
@@ -347,7 +347,7 @@
"reference/cua-spacesd/api/env-teleport-tunnel": "cua-sdk/reference/protocol/env-stream",
"reference/cua-sdk": "cua-sdk/reference",
"reference/cua-sdk/api": "cua-sdk/reference",
- "reference/cua-sdk/api/agents": "cua-sdk/reference/agents#agent-setup",
+ "reference/cua-sdk/api/agents": "cua-sdk/reference/agent-setup",
"reference/cua-sdk/api/auth": "cua-sdk/reference/auth",
"reference/cua-sdk/api/cua": "cua-sdk/reference/cua",
"reference/cua-sdk/api/errors": "cua-sdk/reference/errors",
@@ -554,7 +554,6 @@
"cua-bench/reference/cli/agent": "cua-bench/reference/cli#cb-agent",
"cua-bench/reference/cli/images": "cua-bench/reference/cli#images-and-platforms",
"cua-bench/reference/results": "cua-bench/reference/task-definition#result-files",
- "cua-sdk/reference/agent-setup": "cua-sdk/reference/agents#agent-setup",
"cua-sdk/reference/local": "cua-sdk/reference/cua#local-runtimes",
"cua-sdk/reference/protocol/daemon-runtimes": "cua-sdk/reference/protocol/daemon",
"cua-sdk/reference/protocol/daemon-sandboxes": "cua-sdk/reference/protocol/daemon",
diff --git a/docs/content/docs/spaces/guides/connect-your-agent.mdx b/docs/content/docs/spaces/guides/connect-your-agent.mdx
index 070fd42413..87f10e2a49 100644
--- a/docs/content/docs/spaces/guides/connect-your-agent.mdx
+++ b/docs/content/docs/spaces/guides/connect-your-agent.mdx
@@ -20,10 +20,34 @@ desktop and share a Space whenever you ask.
## Connect from the app
-On first run, the first screen offers **Connect Claude Code**, then Codex,
-Hermes, OpenClaw and **Other**. Press the one you use. The app adds Cua to that
-agent's settings and checks that the agent can use it. If the agent was already
-open, close it and open it again.
+On first run, the first screen says **Pick any, or none**. Tick the agents you
+use on this computer (the ones installed here are ticked already; the rest are
+under **More agents**) and press **Continue**. The app adds the Cua skills and
+MCP server to each ticked agent's settings and checks that it can use them. If
+an agent was already open, close it and open it again. Ticking none is fine:
+connect agents later in **Settings, AI agents**.
+
+### Per computer
+
+Everything on this screen belongs to this computer only:
+
+- The Cua skills and MCP server go into each agent's settings on this
+ computer. On another computer, install Cua Spaces there and pick its agents.
+- **Sign-ins and keys** stay on this computer too. Another computer keeps its
+ own.
+
+### Codex and ChatGPT
+
+Codex signs in with your ChatGPT account on its own, with `codex login`. When
+Codex is ticked, the first screen shows **ChatGPT sign-in**: press **Sign in**
+and finish in the browser that opens. Codex keeps the sign-in on this computer,
+and Cua never reads or copies it. On another computer, sign in to Codex there
+(press **Sign in** in its first run, or run `codex login`).
+
+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 the first screen or in **Settings, Agents**. They stay
+in this computer's Keychain (Credential Manager on Windows).
To connect an agent later, or to remove one, open **Settings, AI agents**:
diff --git a/docs/content/docs/spaces/guides/install.mdx b/docs/content/docs/spaces/guides/install.mdx
index d5a65f80c0..fcc2ed1282 100644
--- a/docs/content/docs/spaces/guides/install.mdx
+++ b/docs/content/docs/spaces/guides/install.mdx
@@ -62,7 +62,7 @@ The first time you open the app, it walks you through a short setup. The
| Step | What it does |
|---|---|
-| A shared Space for every agent | Connects your agent: Claude Code, Codex, Hermes, OpenClaw or another one. See [Connect your agent](/spaces/guides/connect-your-agent). |
+| A shared Space for every agent | Connects the agents you pick on this computer: any of Claude Code, Codex, Hermes, Cursor, OpenClaw and the others, or none. See [Connect your agent](/spaces/guides/connect-your-agent). |
| Checking your setup | Signs you in to Cua and asks for the two settings your agent needs: to control this computer and to see its screen. Then this computer is your first Space. |
| Try your first request | A request to copy into your agent. It works right away. |
| Give your agent its own Space | Optional: a fresh Linux or macOS computer inside this one, away from your files. |
diff --git a/docs/content/docs/spaces/quickstart.mdx b/docs/content/docs/spaces/quickstart.mdx
index 87f389059c..227fe91370 100644
--- a/docs/content/docs/spaces/quickstart.mdx
+++ b/docs/content/docs/spaces/quickstart.mdx
@@ -51,8 +51,11 @@ has the details for each system.
Open Cua Spaces. The first screen says "A shared Space for every agent."
-Press **Connect Claude Code**. If you use another agent, pick it instead:
-Codex, Hermes, OpenClaw or **Other**. The app adds Cua to that agent's settings.
+Under **Pick any, or none**, tick the agents you use on this computer: Claude
+Code, Codex, Hermes, Cursor, OpenClaw or any other under **More agents**. The
+ones installed here are ticked already. Press **Continue**, and the app adds
+Cua to each ticked agent's settings. You can also tick none and connect agents
+later.
If your agent was already open, close it and open it again so it loads the new
tools. To connect more agents later, see [Connect your agent](/spaces/guides/connect-your-agent).
diff --git a/libs/cua/Cargo.lock b/libs/cua/Cargo.lock
index a629399744..0cb7ea1861 100644
--- a/libs/cua/Cargo.lock
+++ b/libs/cua/Cargo.lock
@@ -2893,6 +2893,7 @@ version = "0.7.0"
dependencies = [
"async-trait",
"base64 0.22.1",
+ "cua-agent-setup",
"cua-auth",
"cua-create-failure",
"cua-home",
diff --git a/libs/cua/crates/cua-agent-setup/src/lib.rs b/libs/cua/crates/cua-agent-setup/src/lib.rs
index 0ade4cf1e5..b938b5753d 100644
--- a/libs/cua/crates/cua-agent-setup/src/lib.rs
+++ b/libs/cua/crates/cua-agent-setup/src/lib.rs
@@ -402,6 +402,11 @@ pub struct AgentStatus {
pub error: Option<String>,
/// What could not be verified from official docs.
pub unverified: Option<String>,
+ /// The account the agent signs in with on its own ("ChatGPT"), when
+ /// cua can see that sign-in ([`registry::LoginSpec`]).
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer (its file is there and not empty).
+ pub signed_in: bool,
}
/// What happened to one target.
@@ -567,6 +572,68 @@ impl AgentSetup {
.collect()
}
+ /// Starts `agent`'s own sign-in on this computer (`codex login`: the
+ /// browser opens, and the agent keeps the sign-in in its own file). It
+ /// returns once the command is running; [`AgentSetup::detect`] reports
+ /// `signed_in` when it is done. cua never reads or copies the sign-in,
+ /// so every computer signs in on its own. A sign-in already waiting for
+ /// the browser is not started twice.
+ pub fn sign_in(&self, agent: &str) -> Result<()> {
+ let a = registry::find(agent)
+ .ok_or_else(|| Error::InvalidArgument(format!("unknown agent {agent:?}")))?;
+ let login = a.login.ok_or_else(|| {
+ Error::InvalidArgument(format!("{} has no sign-in cua can start", a.name))
+ })?;
+ if !self.env.run_agent_clis {
+ return Err(Error::InvalidArgument(
+ "agent commands are off in this environment".into(),
+ ));
+ }
+ let bin = a
+ .bins
+ .iter()
+ .find_map(|b| self.env.which(b))
+ .ok_or_else(|| {
+ Error::InvalidArgument(format!("{} isn't installed on this computer", a.name))
+ })?;
+ static WAITING: std::sync::Mutex<Vec<&'static str>> = std::sync::Mutex::new(Vec::new());
+ let mut waiting = WAITING.lock().unwrap_or_else(|e| e.into_inner());
+ if waiting.contains(&a.id) {
+ return Ok(());
+ }
+ let program = cmd_shim_target(&bin).unwrap_or_else(|| bin.clone());
+ let mut cmd = std::process::Command::new(&program);
+ #[cfg(windows)]
+ {
+ use std::os::windows::process::CommandExt;
+ const CREATE_NO_WINDOW: u32 = 0x0800_0000;
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ }
+ // A GUI app has no shell PATH: an npm-installed CLI needs `node`
+ // from the same dirs the agent was found in.
+ if let Ok(path) = std::env::join_paths(&self.env.path) {
+ cmd.env("PATH", path);
+ }
+ let mut child = cmd
+ .args(login.args)
+ .stdin(std::process::Stdio::null())
+ .stdout(std::process::Stdio::null())
+ .stderr(std::process::Stdio::null())
+ .spawn()
+ .map_err(|e| Error::io(&bin, e))?;
+ waiting.push(a.id);
+ let id = a.id;
+ // Reaped in the background: the sign-in waits for the browser.
+ std::thread::spawn(move || {
+ let _ = child.wait();
+ WAITING
+ .lock()
+ .unwrap_or_else(|e| e.into_inner())
+ .retain(|w| *w != id);
+ });
+ Ok(())
+ }
+
/// Alias of [`AgentSetup::detect`].
pub fn status(&self) -> Vec<AgentStatus> {
self.detect()
@@ -626,6 +693,11 @@ impl AgentSetup {
skills_outdated,
error: None,
unverified: (!a.unverified.is_empty()).then(|| a.unverified.to_string()),
+ sign_in: a.login.map(|l| l.label.to_string()),
+ signed_in: a.login.is_some_and(|l| {
+ std::fs::metadata(l.file.resolve(&self.env))
+ .is_ok_and(|m| m.is_file() && m.len() > 0)
+ }),
};
if let Some(m) = &a.mcp {
let file = self.mcp_file(m);
diff --git a/libs/cua/crates/cua-agent-setup/src/registry.rs b/libs/cua/crates/cua-agent-setup/src/registry.rs
index 55c6df85a4..454019137f 100644
--- a/libs/cua/crates/cua-agent-setup/src/registry.rs
+++ b/libs/cua/crates/cua-agent-setup/src/registry.rs
@@ -286,6 +286,22 @@ pub struct AgentSpec {
pub mcp: Option<McpSpec>,
/// What could not be verified from official docs (empty when all was).
pub unverified: &'static str,
+ /// The agent's own sign-in, when cua can see it and start it.
+ pub login: Option<LoginSpec>,
+}
+
+/// An agent's own sign-in (its account, not cua's): the file it keeps the
+/// sign-in in on this computer, and the command that starts it. Each
+/// computer signs in on its own; cua never copies or reads the tokens.
+#[derive(Clone, Copy, Debug)]
+pub struct LoginSpec {
+ /// The account it signs in with ("ChatGPT").
+ pub label: &'static str,
+ /// Present and not empty once signed in.
+ pub file: Loc,
+ /// Arguments to the agent's first binary that start the sign-in
+ /// (`codex login` opens the browser and waits for it).
+ pub args: &'static [&'static str],
}
/// The cross-agent user skills directory (agentskills.io convention) read
@@ -319,6 +335,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: Some(OwnerCli::Claude),
}),
unverified: "the .claude.json location under CLAUDE_CONFIG_DIR",
+ login: None,
},
AgentSpec {
id: "codex",
@@ -338,6 +355,13 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Codex.app bundle name",
+ // `codex login` signs in with ChatGPT and keeps the tokens in
+ // `$CODEX_HOME/auth.json` (docs: authentication, checked 2026-10-21).
+ login: Some(LoginSpec {
+ label: "ChatGPT",
+ file: Loc::home(".codex/auth.json").env("CODEX_HOME", "auth.json"),
+ args: &["login"],
+ }),
},
AgentSpec {
id: "cursor",
@@ -357,6 +381,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Cursor.app bundle name",
+ login: None,
},
AgentSpec {
id: "gemini-cli",
@@ -379,6 +404,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "",
+ login: None,
},
AgentSpec {
id: "cline",
@@ -399,6 +425,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "Cline's docs also name ~/.cline/mcp.json for the CLI; the VS Code extension's globalStorage file is not configured",
+ login: None,
},
AgentSpec {
id: "kiro",
@@ -418,6 +445,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Kiro.app bundle name",
+ login: None,
},
AgentSpec {
id: "openclaw",
@@ -437,6 +465,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "OPENCLAW_CONFIG_PATH is not honored; a running Gateway may need `openclaw mcp reload`",
+ login: None,
},
AgentSpec {
id: "opencode",
@@ -458,6 +487,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "XDG_CONFIG_HOME handling",
+ login: None,
},
AgentSpec {
id: "pi",
@@ -471,6 +501,7 @@ pub static AGENTS: &[AgentSpec] = &[
// Pi has no MCP support by design (pi.dev: "No MCP").
mcp: None,
unverified: "",
+ login: None,
},
AgentSpec {
id: "windsurf",
@@ -490,6 +521,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "app bundle names; whether the legacy ~/.codeium/windsurf/mcp_config.json is still read",
+ login: None,
},
AgentSpec {
id: "copilot-cli",
@@ -509,6 +541,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "",
+ login: None,
},
AgentSpec {
id: "amp",
@@ -528,6 +561,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Windows settings path",
+ login: None,
},
AgentSpec {
id: "goose",
@@ -547,6 +581,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Windows path (%APPDATA%\\Block\\goose\\config) is not used; whether `description` is required",
+ login: None,
},
AgentSpec {
id: "zed",
@@ -566,6 +601,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Zed.app bundle name",
+ login: None,
},
AgentSpec {
id: "vscode",
@@ -585,6 +621,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the default-profile mcp.json path (inferred from the profile folder)",
+ login: None,
},
AgentSpec {
id: "antigravity",
@@ -608,6 +645,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "the Antigravity.app bundle name; the CLI-only skills dir ~/.gemini/antigravity-cli/skills is not written",
+ login: None,
},
// Hermes Agent (NousResearch/hermes-agent). Same id as the cua-agents
// harness. Everything lives in the Hermes home: `$HERMES_HOME`, else
@@ -641,6 +679,7 @@ pub static AGENTS: &[AgentSpec] = &[
owner_cli: None,
}),
unverified: "named profiles (`hermes profile use`) are not configured, only HERMES_HOME or the default home; HERMES_DATA_DIR_SUFFIX is ignored",
+ login: None,
},
];
diff --git a/libs/cua/crates/cua-agent-setup/tests/agents.rs b/libs/cua/crates/cua-agent-setup/tests/agents.rs
index 94cd68b887..4174b72a66 100644
--- a/libs/cua/crates/cua-agent-setup/tests/agents.rs
+++ b/libs/cua/crates/cua-agent-setup/tests/agents.rs
@@ -1127,3 +1127,76 @@ fn the_docs_and_readme_list_every_agent() {
);
}
}
+
+#[test]
+fn only_codex_has_a_sign_in_and_it_is_read_from_its_own_file() {
+ let mut t = T::new();
+ let s = t.setup();
+ let with: Vec<_> = s
+ .detect()
+ .into_iter()
+ .filter(|a| a.sign_in.is_some())
+ .map(|a| (a.id, a.sign_in.unwrap(), a.signed_in))
+ .collect();
+ assert_eq!(with, [("codex".to_string(), "ChatGPT".to_string(), false)]);
+ // An empty file is not a sign-in; a written one is.
+ let auth = t.write(".codex/auth.json", "");
+ let codex = |s: &AgentSetup| s.detect().into_iter().find(|a| a.id == "codex").unwrap();
+ assert!(!codex(&t.setup()).signed_in);
+ std::fs::write(&auth, "{\"tokens\":{}}").unwrap();
+ assert!(codex(&t.setup()).signed_in);
+ // CODEX_HOME moves it.
+ t.env
+ .vars
+ .insert("CODEX_HOME".into(), t.home.join("ch").display().to_string());
+ assert!(!codex(&t.setup()).signed_in);
+ t.write("ch/auth.json", "{}");
+ assert!(codex(&t.setup()).signed_in);
+}
+
+#[test]
+fn sign_in_is_refused_without_a_sign_in_an_install_or_agent_commands() {
+ let mut t = T::new();
+ let err = |s: &AgentSetup, id: &str| s.sign_in(id).unwrap_err().to_string();
+ assert!(err(&t.setup(), "nope").contains("unknown agent"));
+ assert!(err(&t.setup(), "claude-code").contains("no sign-in"));
+ // Isolated environments never run an agent's CLI.
+ assert!(err(&t.setup(), "codex").contains("off in this environment"));
+ t.env.run_agent_clis = true;
+ assert!(err(&t.setup(), "codex").contains("isn't installed"));
+}
+
+#[cfg(unix)]
+#[test]
+fn sign_in_runs_the_agents_own_login_and_detect_sees_it() {
+ use std::os::unix::fs::PermissionsExt;
+ let mut t = T::new();
+ let bin = t.home.join("bin");
+ std::fs::create_dir_all(&bin).unwrap();
+ let auth = t.home.join(".codex/auth.json");
+ let log = t.home.join("codex-argv.log");
+ // A fake `codex`: records its argv and signs in inside the temp home.
+ let script = format!(
+ "#!/bin/sh\nprintf '%s\\n' \"$*\" >> '{}'\nprintf '{{}}' > '{}'\n",
+ log.display(),
+ auth.display()
+ );
+ // Its PATH is only `bin` below: no mkdir there.
+ std::fs::create_dir_all(auth.parent().unwrap()).unwrap();
+ let codex = bin.join("codex");
+ std::fs::write(&codex, script).unwrap();
+ std::fs::set_permissions(&codex, std::fs::Permissions::from_mode(0o755)).unwrap();
+ t.env.path = vec![bin];
+ t.env.run_agent_clis = true;
+ let s = t.setup();
+ s.sign_in("openai-codex").unwrap();
+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs(10);
+ // Done once the file is written (the fake truncates, then writes).
+ let written = || std::fs::metadata(&auth).is_ok_and(|m| m.len() > 0);
+ while !written() && std::time::Instant::now() < deadline {
+ std::thread::sleep(std::time::Duration::from_millis(20));
+ }
+ assert_eq!(t.read(&log).trim(), "login");
+ let a = s.detect().into_iter().find(|a| a.id == "codex").unwrap();
+ assert!(a.installed && a.signed_in, "{a:?}");
+}
diff --git a/libs/cua/crates/cua-sdk/src/native/agent_setup.rs b/libs/cua/crates/cua-sdk/src/native/agent_setup.rs
index 5f7e49efc6..7df43ec572 100644
--- a/libs/cua/crates/cua-sdk/src/native/agent_setup.rs
+++ b/libs/cua/crates/cua-sdk/src/native/agent_setup.rs
@@ -49,6 +49,13 @@ pub struct AgentInfo {
pub error: Option<String>,
/// What could not be verified from the agent's official docs.
pub unverified: Option<String>,
+ /// The account the agent signs in with on its own (`ChatGPT` for
+ /// Codex), when cua can see that sign-in.
+ #[uniffi(default = None)]
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ #[uniffi(default = false)]
+ pub signed_in: bool,
}
/// A skill bundled with the SDK.
@@ -145,6 +152,8 @@ impl From<cua_agent_setup::AgentStatus> for AgentInfo {
skills_outdated: a.skills_outdated,
error: a.error,
unverified: a.unverified,
+ sign_in: a.sign_in,
+ signed_in: a.signed_in,
}
}
}
@@ -243,6 +252,13 @@ impl AgentSetup {
self.detect()
}
+ /// Starts `agent`'s own sign-in on this computer (`codex login`: the
+ /// browser opens). Returns once it is running; `detect` reports
+ /// `signed_in` when it is done. cua never reads or copies the sign-in.
+ pub fn sign_in(&self, agent: String) -> Result<()> {
+ Ok(self.inner.sign_in(&agent)?)
+ }
+
/// The skills bundled with this SDK.
pub fn skills(&self) -> Vec<BundledSkill> {
self.inner
diff --git a/libs/cua/crates/cua-spaces-app-core/Cargo.toml b/libs/cua/crates/cua-spaces-app-core/Cargo.toml
index 4858bda7e9..34c5cbf4e2 100644
--- a/libs/cua/crates/cua-spaces-app-core/Cargo.toml
+++ b/libs/cua/crates/cua-spaces-app-core/Cargo.toml
@@ -43,5 +43,7 @@ base64.workspace = true
# Wire-drift tests: the core's Keyvault mirror types decode the broker's
# real serde output.
cua-keyvault.workspace = true
+# Drift guard: the first run lists every agent the setup's registry knows.
+cua-agent-setup.workspace = true
tokio = { workspace = true, features = ["full"] }
tempfile.workspace = true
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/first-run.json b/libs/cua/crates/cua-spaces-app-core/parity/first-run.json
index b88fc51c1f..fcc30909d8 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/first-run.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/first-run.json
@@ -1,6 +1,6 @@
{
"name": "first-run",
- "about": "The 0.10.0 first run, one screen state per storyboard frame (v2-01 to v2-09, 16, 17): connect your agent, then the agent and this computer checked, a first request that works on this computer, the optional extra Space (macOS first, never blocking Done), the plan card after the first success, and Home's to-do list after Finish later. Each case patches the base input; every app draws firstRun.view's words and must say the same.",
+ "about": "The 0.10.0 first run, one screen state per storyboard frame (v2-01 to v2-09, 16, 17): step 1 picks any agents or none (every agent the setup knows; what is installed per computer, and the agents' own sign-ins and keys, which stay on this computer), then the agent and this computer checked, a first request that works on this computer, the optional extra Space (macOS first, never blocking Done), the plan card after the first success, and Home's to-do list after Finish later. Each case patches the base input; every app draws firstRun.view's words and must say the same.",
"base": {
"step": "setup",
"hostOs": "macos",
@@ -19,8 +19,11 @@
"plan": { "metered": true, "plan": "free", "sessionsLimit": 2, "hoursLimit": 20, "accountApp": "https://app.cua.ai" }
},
"cases": [
- { "name": "01 connect", "patch": { "step": "connect", "agent": null } },
- { "name": "01 connect, only Codex installed", "patch": { "step": "connect", "agent": null, "agents": [{ "agent": "codex", "name": "Codex", "installed": true, "configured": false }] } },
+ { "name": "01 agents, nothing changed: the installed ones ticked", "patch": { "step": "connect", "agent": null, "keys": { "keys": [{ "provider": "anthropic", "env": "ANTHROPIC_API_KEY", "last4": "1234", "addedMs": 1 }] } } },
+ { "name": "01 agents, only Codex installed", "patch": { "step": "connect", "agent": null, "agents": [{ "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT" }] } },
+ { "name": "01 agents, none picked", "patch": { "step": "connect", "agent": null, "picked": [] } },
+ { "name": "01 agents, Codex only, signing in", "patch": { "step": "connect", "agent": null, "picked": ["codex"], "agentSigningIn": "codex", "keys": { "keys": [] }, "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT" }, { "agent": "goose", "name": "Goose", "installed": false, "configured": false }] } },
+ { "name": "01 agents, several, Claude Code already set up", "patch": { "step": "connect", "agent": null, "picked": ["codex", "hermes"], "connecting": true, "keys": { "keys": [{ "provider": "anthropic", "env": "ANTHROPIC_API_KEY", "last4": "1234", "addedMs": 1 }] }, "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": true }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT", "signedIn": true }, { "agent": "hermes", "name": "Hermes", "installed": true, "configured": false }] } },
{ "name": "02 checking", "patch": { "agents": null, "host": null } },
{ "name": "03 ready, choose", "patch": {} },
{ "name": "04 ready, creating macOS", "patch": { "extra": { "phase": "creating", "name": "macOS 1", "os": "macos", "detail": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min", "fraction": 0.19 } } },
@@ -32,6 +35,8 @@
{ "name": "17 first success, Teams card", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "not-now" }, "plan": { "metered": true, "plan": "free", "teammates": true, "accountApp": "https://app.cua.ai" } } },
{ "name": "macOS made, ready", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "ready", "name": "macOS 1", "os": "macos" }, "plan": { "metered": true, "plan": "pro" } }, "todos": true },
{ "name": "an Intel Mac: Linux only", "patch": { "offers": [{ "os": "linux", "time": "about 2 min" }, { "os": "macos", "time": "10 to 30 min the first time", "blocked": "This Mac can't run macOS Spaces: they need Apple silicon." }] } },
- { "name": "a Windows PC", "patch": { "hostOs": "windows", "host": { "configured": true, "running": true, "online": true, "permissions": [] }, "offers": [{ "os": "linux", "time": "about 2 min" }] } }
+ { "name": "a Windows PC", "patch": { "hostOs": "windows", "host": { "configured": true, "running": true, "online": true, "permissions": [] }, "offers": [{ "os": "linux", "time": "about 2 min" }] } },
+ { "name": "no agent picked, ready", "patch": { "picked": [] }, "todos": true },
+ { "name": "two agents picked, one not set up", "patch": { "picked": ["claude-code", "codex"] }, "todos": true }
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json
index 445d02e342..99692c0a45 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json
@@ -3,24 +3,85 @@
"frames": [
{
"art": "claude-code on none",
- "case": "01 connect",
+ "case": "01 agents, nothing changed: the installed ones ticked",
"connect": {
+ "agents": "On this Mac: [=] Claude Code (Already uses Cua), [x] Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",
+ "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",
+ "busy": null,
+ "connects": "codex",
+ "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): Anthropic key — For Claude Code in your Spaces [Saved] / OpenAI key — For Codex in your Spaces (add-key:Add key)",
+ "intro": "Pick any, or none.",
"lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",
- "note": "Your agent will use this Mac. You can add a separate Space later.",
- "others": "Codex, Hermes, OpenClaw",
- "primary": "connect:Connect Claude Code",
+ "more": "More agents: ",
+ "primary": "continue:Continue",
"title": "A shared Space for every agent."
},
"step": "connect"
},
{
"art": "codex on none",
- "case": "01 connect, only Codex installed",
+ "case": "01 agents, only Codex installed",
"connect": {
+ "agents": "On this Mac: [ ] Claude Code, [x] OpenAI Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",
+ "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",
+ "busy": null,
+ "connects": "codex",
+ "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac (agent-sign-in:Sign in)",
+ "intro": "Pick any, or none.",
"lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",
- "note": "Your agent will use this Mac. You can add a separate Space later.",
- "others": "Claude Code, Hermes, OpenClaw",
- "primary": "connect:Connect Codex",
+ "more": "More agents: ",
+ "primary": "continue:Continue",
+ "title": "A shared Space for every agent."
+ },
+ "step": "connect"
+ },
+ {
+ "art": "claude-code on none",
+ "case": "01 agents, none picked",
+ "connect": {
+ "agents": "On this Mac: [=] Claude Code (Already uses Cua), [ ] Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",
+ "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",
+ "busy": null,
+ "connects": "",
+ "credentials": null,
+ "intro": "Pick any, or none.",
+ "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",
+ "more": "More agents: ",
+ "primary": "continue:Continue",
+ "title": "A shared Space for every agent."
+ },
+ "step": "connect"
+ },
+ {
+ "art": "codex on none",
+ "case": "01 agents, Codex only, signing in",
+ "connect": {
+ "agents": "On this Mac: [ ] Claude Code, [x] OpenAI Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",
+ "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",
+ "busy": null,
+ "connects": "codex",
+ "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac [Finish in your browser…] / OpenAI key — For OpenAI Codex in your Spaces (add-key:Add key)",
+ "intro": "Pick any, or none.",
+ "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",
+ "more": "More agents: [ ] Goose (Not found on this Mac)",
+ "primary": "continue:Continue",
+ "title": "A shared Space for every agent."
+ },
+ "step": "connect"
+ },
+ {
+ "art": "codex on none",
+ "case": "01 agents, several, Claude Code already set up",
+ "connect": {
+ "agents": "On this Mac: [=] Claude Code (Already uses Cua), [x] OpenAI Codex, [x] Hermes, [ ] Cursor, [ ] OpenClaw",
+ "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",
+ "busy": "Adding Cua to OpenAI Codex and Hermes…",
+ "connects": "codex, hermes",
+ "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac [Signed in] / Anthropic key — For Claude Code in your Spaces [Saved] / OpenAI key — For OpenAI Codex in your Spaces (add-key:Add key)",
+ "intro": "Pick any, or none.",
+ "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",
+ "more": "More agents: ",
+ "primary": "continue:Continue",
"title": "A shared Space for every agent."
},
"step": "connect"
@@ -364,6 +425,79 @@
"upsell": null
},
"step": "setup"
+ },
+ {
+ "art": "other on outline",
+ "case": "no agent picked, ready",
+ "setup": {
+ "extra": {
+ "action": "not-now:Not now",
+ "choices": [
+ "macOS: 22 GB download · 10 to 30 min the first time",
+ "Linux: Ready in about 2 min"
+ ],
+ "footnote": null,
+ "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",
+ "phase": "choose",
+ "title": "Give your agent its own Space"
+ },
+ "primary": "done:Done",
+ "prompt": null,
+ "rows": [
+ "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."
+ ],
+ "title": "This Mac is ready.",
+ "upsell": null
+ },
+ "step": "setup",
+ "todos": {
+ "complete": true,
+ "items": [
+ "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",
+ "[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",
+ "[x] Sign in — Signed in to Cua."
+ ],
+ "lede": "You're all set.",
+ "progress": "2 of 3 done"
+ }
+ },
+ {
+ "art": "claude-code on outline",
+ "case": "two agents picked, one not set up",
+ "setup": {
+ "extra": {
+ "action": "not-now:Not now",
+ "choices": [
+ "macOS: 22 GB download · 10 to 30 min the first time",
+ "Linux: Ready in about 2 min"
+ ],
+ "footnote": null,
+ "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",
+ "phase": "choose",
+ "title": "Give your agent its own Space"
+ },
+ "primary": "finish-later:Finish later",
+ "prompt": "Try this in Claude Code or Codex: List my computers and tell me what's on this Mac / This works now, on this Mac.",
+ "rows": [
+ "[fix] Connect Codex — Cua isn't in Codex's settings yet. (connect:Connect)",
+ "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."
+ ],
+ "title": "One step left.",
+ "upsell": null
+ },
+ "step": "setup",
+ "todos": {
+ "complete": false,
+ "items": [
+ "[ ] Connect Codex — Cua isn't in Codex's settings yet. (connect:Connect)",
+ "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",
+ "[ ] Try your first request — Ask Claude Code or Codex: “List my computers and tell me what's on this Mac” (copy:Copy)",
+ "[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",
+ "[x] Sign in — Signed in to Cua."
+ ],
+ "lede": "A couple of things are left.",
+ "progress": "2 of 5 done"
+ }
}
]
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/agents.rs b/libs/cua/crates/cua-spaces-app-core/src/agents.rs
index 60db38830f..8c7100ef3e 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/agents.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/agents.rs
@@ -234,6 +234,11 @@ pub struct AgentSetupStatus {
pub skills_outdated: Vec<String>,
/// Problem reading its config.
pub error: Option<String>,
+ /// The account it signs in with on its own (`ChatGPT` for Codex), when
+ /// the setup can see that sign-in.
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ pub signed_in: bool,
}
/// One Settings row for a coding agent.
@@ -258,6 +263,12 @@ pub struct AgentSettingsRow {
pub mcp_config: Option<String>,
/// Skills directory.
pub skills_dir: Option<String>,
+ /// The account it signs in with on its own (`ChatGPT`), when known.
+ #[serde(default)]
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ #[serde(default)]
+ pub signed_in: bool,
}
/// One agent's row (`total`: skills bundled with this SDK).
@@ -296,6 +307,8 @@ pub fn agent_settings_row(a: &AgentSetupStatus, total: u32) -> AgentSettingsRow
skills_total: total,
mcp_config: a.mcp_config.clone(),
skills_dir: a.skills_dir.clone(),
+ sign_in: a.sign_in.clone(),
+ signed_in: a.signed_in,
}
}
@@ -447,6 +460,16 @@ mod tests {
assert_eq!(labelled.summary, "Nightly");
}
+ #[test]
+ fn a_settings_row_without_the_sign_in_fields_still_reads() {
+ let row: AgentSettingsRow = serde_json::from_value(json!({
+ "agent": "codex", "name": "Codex", "installed": true, "configured": false,
+ "detail": "", "skillsInstalled": 0, "skillsTotal": 2, "mcpConfig": null, "skillsDir": null
+ }))
+ .unwrap();
+ assert_eq!((row.sign_in, row.signed_in), (None, false));
+ }
+
#[test]
fn rows_put_attention_first() {
let rows = agent_rows_from_json(&[
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 5e4ae50107..dd4a509b84 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
@@ -3,8 +3,15 @@
//! The first run every app shows (0.10.0): two screens.
//!
-//! 1. **Connect your agent.** One button for the agent this computer has
-//! (Claude Code first), the others under it.
+//! 1. **Agents.** Pick any, or none: a checkbox for every agent the setup
+//! knows (the common ones and the ones on this computer first, the rest
+//! under "More agents"), ticked for the ones installed here. Under it,
+//! the agents' own sign-ins and keys. Both are per computer, and the page
+//! says so: Cua's skills and MCP server go into each picked agent's
+//! settings on this computer only, the ChatGPT sign-in Codex uses is
+//! Codex's own file on this computer (`codex login`), and provider keys
+//! stay in this computer's credential vault (`agent_keys`). Nothing here
+//! follows the Cua account to another computer.
//! 2. **Your agent can use this Mac.** Two checked rows, the agent and this
//! computer, then a first request that works on this computer now. This
//! computer is the user's first Space and is ready at once; an extra
@@ -37,10 +44,18 @@ use serde::{Deserialize, Serialize};
use crate::relay_usage::{BUY_PRO_PATH, BUY_TEAMS_PATH, PRO_HOURS, PRO_SESSIONS, buy, plan_kind};
-/// The agents step 1 offers by name, in order (setup ids). Any other agent
-/// is under "Other".
+/// The agents the access log tells apart by name (setup ids).
pub const OFFERED: [&str; 4] = ["claude-code", "codex", "hermes", "openclaw"];
+/// The agents step 1 always lists first, in order (setup ids). Any other
+/// agent the setup knows is listed too: beside these when it is installed
+/// or ticked, else under "More agents".
+pub const FEATURED: [&str; 5] = ["claude-code", "codex", "hermes", "cursor", "openclaw"];
+
+/// The provider key each agent's runs in a Space read (`agent_keys`'
+/// providers), for the keys step 1 lists under the picked agents.
+const AGENT_KEYS: [(&str, &str); 2] = [("claude-code", "anthropic"), ("codex", "openai")];
+
/// The first request: it works on this computer with nothing else set up.
pub const FIRST_PROMPT: &str = "List my computers and tell me what's on this Mac";
const FIRST_PROMPT_OTHER: &str = "List my computers and tell me what's on this computer";
@@ -65,6 +80,10 @@ pub struct FirstRunAgent {
pub name: String,
pub installed: bool,
pub configured: bool,
+ /// The account it signs in with on its own (`ChatGPT` for Codex).
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ pub signed_in: bool,
}
/// A permission this computer still needs (`host.status`'s hint).
@@ -154,8 +173,19 @@ pub struct FirstRunInput {
pub host_os: String,
/// What the agent setup found (none yet: still looking).
pub agents: Option<Vec<FirstRunAgent>>,
- /// The agent the user connected (setup id).
+ /// The agent the first request names (setup id): the first one
+ /// connected. Older saved runs connected only this one.
pub agent: Option<String>,
+ /// Step 1: the ticked agents (none: not changed yet, so the ones
+ /// installed here). Step 2: the agents connected (empty: none).
+ pub picked: Option<Vec<String>>,
+ /// The provider keys saved on this computer (none: not read, or this
+ /// app can't read them).
+ pub keys: Option<crate::agent_keys::AgentKeysInput>,
+ /// The agent whose own sign-in is waiting for the browser.
+ pub agent_signing_in: Option<String>,
+ /// Starting an agent's own sign-in failed with this.
+ pub agent_sign_in_error: Option<String>,
/// Adding Cua to the agent's settings is running.
pub connecting: bool,
/// Adding Cua to the agent's settings failed with this.
@@ -193,13 +223,40 @@ fn button(id: &str, label: &str) -> FirstRunButton {
}
}
-/// An agent step 1 offers.
+/// An agent on step 1.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
-pub struct FirstRunAgentChoice {
+pub struct AgentPick {
pub agent: String,
pub name: String,
+ pub checked: bool,
pub installed: bool,
+ /// Cua is in its settings already: it stays ticked.
+ pub locked: bool,
+ /// "Already uses Cua", "Not found on this Mac".
+ pub note: Option<String>,
+}
+
+/// A sign-in or key on step 1.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CredentialRow {
+ /// `sign-in:codex`, `key:anthropic`, `key:openai`.
+ pub id: String,
+ /// "ChatGPT sign-in", "Anthropic key".
+ pub title: String,
+ /// Who uses it: "Codex uses it on this Mac".
+ pub note: String,
+ /// "Signed in", "Saved", "Finish in your browser…".
+ pub status: Option<String>,
+ /// The status is a done one ("Signed in", "Saved"), not a wait.
+ pub ok: bool,
+ /// `agent-sign-in` (with `agent`), or `add-key` (with `provider`).
+ pub action: Option<FirstRunButton>,
+ pub agent: Option<String>,
+ pub provider: Option<String>,
+ /// Starting it failed.
+ pub error: Option<String>,
}
/// Step 1.
@@ -211,21 +268,30 @@ pub struct ConnectView {
pub title: String,
pub accent: String,
pub lede: String,
- /// "Connect Claude Code".
+ /// "Pick any, or none."
+ pub intro: String,
+ /// "On this Mac".
+ pub agents_label: String,
+ /// The common agents, and any installed or ticked here.
+ pub agents: Vec<AgentPick>,
+ /// "More agents".
+ pub more_label: String,
+ /// Every other agent the setup knows.
+ pub more: Vec<AgentPick>,
+ /// What picking does, and that it is this computer only.
+ pub agents_note: String,
+ /// "Sign-ins and keys".
+ pub credentials_label: String,
+ /// "They stay on this Mac. Other computers keep their own."
+ pub credentials_note: String,
+ /// The picked agents' own sign-ins and provider keys (empty: the
+ /// section is not drawn).
+ pub credentials: Vec<CredentialRow>,
+ /// "Continue".
pub primary: FirstRunButton,
- /// The agent the primary connects.
- pub agent: FirstRunAgentChoice,
- /// "Your agent will use this Mac."
- pub note: String,
- /// "You can add a separate Space later."
- pub note_more: String,
- /// "Or".
- pub or_label: String,
- /// The other offered agents.
- pub others: Vec<FirstRunAgentChoice>,
- /// "Other": every agent the setup knows.
- pub other_label: String,
- /// "Adding Cua to Claude Code…" while it runs.
+ /// The agents Continue connects (setup ids, ticked and not set up yet).
+ pub connects: Vec<String>,
+ /// "Adding Cua to Claude Code and Codex…" while it runs.
pub busy: Option<String>,
pub error: Option<String>,
}
@@ -346,7 +412,8 @@ pub struct SetupView {
/// "Checking your setup.", "Your agent can use this Mac.", "One step left."
pub title: String,
pub rows: Vec<CheckRow>,
- pub prompt: PromptView,
+ /// None when no agent was picked.
+ pub prompt: Option<PromptView>,
pub extra: ExtraView,
pub upsell: Option<UpsellCard>,
pub primary: PrimaryView,
@@ -433,24 +500,22 @@ fn default_name(agent: &str) -> &'static str {
"codex" => "Codex",
"hermes" => "Hermes",
"openclaw" => "OpenClaw",
+ "cursor" => "Cursor",
_ => "your agent",
}
}
-fn choice(agents: &[FirstRunAgent], id: &str) -> FirstRunAgentChoice {
- let row = agents.iter().find(|a| a.agent == id);
- FirstRunAgentChoice {
- agent: id.into(),
- name: row
- .map(|a| a.name.clone())
- .filter(|n| !n.is_empty())
- .unwrap_or_else(|| default_name(id).into()),
- installed: row.is_some_and(|a| a.installed),
- }
+fn name_of(agents: &[FirstRunAgent], id: &str) -> String {
+ agents
+ .iter()
+ .find(|a| a.agent == id)
+ .map(|a| a.name.clone())
+ .filter(|n| !n.is_empty())
+ .unwrap_or_else(|| default_name(id).into())
}
-/// The agent step 1 leads with: the first offered one installed here,
-/// else Claude Code.
+/// The agent a single-agent screen leads with: the first offered one
+/// installed here, else Claude Code.
pub fn lead_agent(agents: &[FirstRunAgent]) -> String {
OFFERED
.iter()
@@ -459,21 +524,186 @@ pub fn lead_agent(agents: &[FirstRunAgent]) -> String {
.to_string()
}
+/// "Claude Code", "Claude Code and Codex", "Claude Code, Codex and Hermes"
+/// (`or` for the first request: "Claude Code or Codex").
+fn names(agents: &[FirstRunAgent], ids: &[String], and: &str) -> String {
+ let n: Vec<String> = ids.iter().map(|id| name_of(agents, id)).collect();
+ match n.as_slice() {
+ [] => String::new(),
+ [one] => one.clone(),
+ [rest @ .., last] => format!("{} {and} {last}", rest.join(", ")),
+ }
+}
+
+/// Step 1's ticks: the user's, else every agent installed here (one Cua
+/// is in already counts as installed).
+pub fn picked(input: &FirstRunInput) -> Vec<String> {
+ let agents = input.agents.as_deref().unwrap_or(&[]);
+ let mut out: Vec<String> = match &input.picked {
+ Some(p) => p.clone(),
+ None => agents
+ .iter()
+ .filter(|a| a.installed || a.configured)
+ .map(|a| a.agent.clone())
+ .collect(),
+ };
+ // One Cua is already in can't be unticked here (Settings removes it).
+ for a in agents.iter().filter(|a| a.configured) {
+ if !out.contains(&a.agent) {
+ out.push(a.agent.clone());
+ }
+ }
+ out
+}
+
+/// The agents connected on step 2: what step 1 connected, or the one an
+/// older run connected.
+fn connected(input: &FirstRunInput) -> Vec<String> {
+ match &input.picked {
+ Some(p) => p.clone(),
+ None => input.agent.clone().into_iter().collect(),
+ }
+}
+
+/// The agent the first request names: the first connected.
+fn lead_of(input: &FirstRunInput) -> Option<String> {
+ connected(input).into_iter().next()
+}
+
fn agent_name(input: &FirstRunInput) -> String {
let agents = input.agents.as_deref().unwrap_or(&[]);
- let id = input.agent.clone().unwrap_or_else(|| lead_agent(agents));
- choice(agents, &id).name
+ lead_of(input)
+ .map(|id| name_of(agents, &id))
+ .unwrap_or_else(|| "your agent".into())
+}
+
+/// Every agent step 1 lists, in order: [`FEATURED`], then each other one
+/// the setup knows (`more` when it isn't installed or ticked here).
+fn agent_picks(input: &FirstRunInput) -> (Vec<AgentPick>, Vec<AgentPick>) {
+ let agents = input.agents.as_deref().unwrap_or(&[]);
+ let ticked = picked(input);
+ let place = this_computer(&input.host_os);
+ let pick = |id: &str| {
+ let row = agents.iter().find(|a| a.agent == id);
+ let installed = row.is_some_and(|a| a.installed);
+ let locked = row.is_some_and(|a| a.configured);
+ AgentPick {
+ agent: id.into(),
+ name: name_of(agents, id),
+ checked: ticked.iter().any(|t| t == id),
+ installed,
+ locked,
+ note: if locked {
+ Some("Already uses Cua".into())
+ } else if row.is_some() && !installed {
+ Some(format!("Not found on {place}"))
+ } else {
+ None
+ },
+ }
+ };
+ let mut main: Vec<AgentPick> = FEATURED.iter().map(|id| pick(id)).collect();
+ let mut more = Vec::new();
+ for a in agents
+ .iter()
+ .filter(|a| !FEATURED.contains(&a.agent.as_str()))
+ {
+ let p = pick(&a.agent);
+ if p.installed || p.checked {
+ main.push(p);
+ } else {
+ more.push(p);
+ }
+ }
+ (main, more)
+}
+
+/// The picked agents' own sign-ins (Codex's ChatGPT sign-in), then the
+/// provider keys their runs in a Space read, when this app can read keys.
+fn credentials(input: &FirstRunInput, ticked: &[String]) -> Vec<CredentialRow> {
+ let agents = input.agents.as_deref().unwrap_or(&[]);
+ let place = this_computer(&input.host_os);
+ let mut out = Vec::new();
+ for id in ticked {
+ let Some(a) = agents.iter().find(|a| &a.agent == id) else {
+ continue;
+ };
+ let Some(label) = a.sign_in.as_ref().filter(|l| !l.is_empty()) else {
+ continue;
+ };
+ let waiting = input.agent_signing_in.as_deref() == Some(id.as_str()) && !a.signed_in;
+ out.push(CredentialRow {
+ id: format!("sign-in:{id}"),
+ title: format!("{label} sign-in"),
+ note: format!("{} uses it on {place}", default_or(&a.name, id)),
+ ok: a.signed_in,
+ status: if a.signed_in {
+ Some("Signed in".into())
+ } else if waiting {
+ Some("Finish in your browser…".into())
+ } else {
+ None
+ },
+ action: (!a.signed_in && !waiting && a.installed)
+ .then(|| button("agent-sign-in", "Sign in")),
+ agent: Some(id.clone()),
+ provider: None,
+ error: (!a.signed_in)
+ .then(|| input.agent_sign_in_error.clone())
+ .flatten()
+ .map(|e| format!("Couldn't start the sign-in: {e}")),
+ });
+ }
+ let Some(keys) = input
+ .keys
+ .as_ref()
+ .filter(|k| k.unavailable.is_none() && k.error.is_none())
+ else {
+ return out;
+ };
+ for (agent, provider) in AGENT_KEYS {
+ if !ticked.iter().any(|t| t == agent) {
+ continue;
+ }
+ let Some(row) = crate::agent_keys::view(keys)
+ .rows
+ .into_iter()
+ .find(|r| r.provider == provider)
+ else {
+ continue;
+ };
+ out.push(CredentialRow {
+ id: format!("key:{provider}"),
+ title: format!("{} key", row.title),
+ note: format!("For {} in your Spaces", name_of(agents, agent)),
+ status: row.set.then(|| "Saved".into()),
+ ok: row.set,
+ action: (!row.set).then(|| button("add-key", "Add key")),
+ agent: None,
+ provider: Some(provider.into()),
+ error: None,
+ });
+ }
+ out
+}
+
+fn default_or(name: &str, id: &str) -> String {
+ if name.is_empty() {
+ default_name(id).into()
+ } else {
+ name.into()
+ }
}
fn connect_view(input: &FirstRunInput) -> ConnectView {
let agents = input.agents.as_deref().unwrap_or(&[]);
- let lead = input.agent.clone().unwrap_or_else(|| lead_agent(agents));
- let agent = choice(agents, &lead);
let place = this_computer(&input.host_os);
- let others = OFFERED
+ let (list, more) = agent_picks(input);
+ let ticked = picked(input);
+ let connects: Vec<String> = ticked
.iter()
- .filter(|id| **id != lead)
- .map(|id| choice(agents, id))
+ .filter(|id| !agents.iter().any(|a| &a.agent == *id && a.configured))
+ .cloned()
.collect();
ConnectView {
title: "A shared Space for every agent.".into(),
@@ -481,16 +711,21 @@ fn connect_view(input: &FirstRunInput) -> ConnectView {
lede: format!(
"Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on {place}."
),
- primary: button("connect", &format!("Connect {}", agent.name)),
- busy: input
- .connecting
- .then(|| format!("Adding Cua to {}…", agent.name)),
- agent,
- note: format!("Your agent will use {place}."),
- note_more: "You can add a separate Space later.".into(),
- or_label: "Or".into(),
- others,
- other_label: "Other".into(),
+ intro: "Pick any, or none.".into(),
+ agents_label: format!("On {place}"),
+ agents: list,
+ more_label: "More agents".into(),
+ more,
+ agents_note: format!(
+ "Cua adds its skills and MCP server to each one you pick, on {place} only. Your other computers set up their own."
+ ),
+ credentials_label: "Sign-ins and keys".into(),
+ credentials_note: format!("They stay on {place}. Other computers keep their own."),
+ credentials: credentials(input, &ticked),
+ primary: button("continue", "Continue"),
+ busy: (input.connecting && !connects.is_empty())
+ .then(|| format!("Adding Cua to {}…", names(agents, &connects, "and"))),
+ connects,
error: input
.connect_error
.as_ref()
@@ -498,13 +733,15 @@ fn connect_view(input: &FirstRunInput) -> ConnectView {
}
}
-fn agent_row(input: &FirstRunInput) -> CheckRow {
- let name = agent_name(input);
- let id = input.agent.clone().unwrap_or_default();
- let found = input
- .agents
- .as_ref()
- .map(|a| a.iter().find(|r| r.agent == id).cloned());
+/// Step 2's agent row (none when no agent was picked).
+fn agent_row(input: &FirstRunInput) -> Option<CheckRow> {
+ let ids = connected(input);
+ if ids.is_empty() {
+ return None;
+ }
+ let all = input.agents.as_deref().unwrap_or(&[]);
+ let name = names(all, &ids, "and");
+ let many = ids.len() > 1;
let row = |state, title: String, note: String, action: Option<FirstRunButton>| CheckRow {
id: "agent".into(),
state,
@@ -513,62 +750,83 @@ fn agent_row(input: &FirstRunInput) -> CheckRow {
action,
settings_url: None,
};
- match found {
- None => row(
+ let Some(agents) = &input.agents else {
+ return Some(row(
RowState::Checking,
- name.clone(),
- "Checking that it can use Cua…".into(),
+ name,
+ format!(
+ "Checking that {} can use Cua…",
+ if many { "they" } else { "it" }
+ ),
None,
- ),
- Some(None)
- | Some(Some(FirstRunAgent {
- configured: false, ..
- })) => {
- if input.connecting {
- return row(
- RowState::Checking,
- name.clone(),
- format!("Adding Cua to {name}'s settings…"),
- None,
- );
- }
- row(
- RowState::Fix,
- format!("Connect {name}"),
- input.connect_error.clone().map_or_else(
- || format!("Cua isn't in {name}'s settings yet."),
- |e| format!("Couldn't add Cua: {e}"),
- ),
- Some(button("connect", "Connect")),
- )
- }
- Some(Some(_)) => {
- if let Some(at) = &input.agent_used_at {
- return row(
- RowState::Ok,
- format!("{name} can use Cua"),
- format!("It used Cua at {at}."),
- None,
- );
- }
- if input.agent_open_before_setup == Some(true) {
- return row(
- RowState::Fix,
- format!("Restart {name}"),
- "It was open when we added Cua. Close it, then open it again.".into(),
- Some(button("restart-check", "Check again")),
- );
- }
- row(
- RowState::Ok,
- format!("{name} can use Cua"),
- format!(
- "We added Cua to {name}'s settings. If {name} was already open, restart it."
- ),
+ ));
+ };
+ let missing: Vec<String> = ids
+ .iter()
+ .filter(|id| !agents.iter().any(|a| &a.agent == *id && a.configured))
+ .cloned()
+ .collect();
+ if !missing.is_empty() {
+ let them = names(all, &missing, "and");
+ if input.connecting {
+ return Some(row(
+ RowState::Checking,
+ name,
+ format!("Adding Cua to {them}…"),
None,
- )
+ ));
}
+ return Some(row(
+ RowState::Fix,
+ format!("Connect {them}"),
+ input.connect_error.clone().map_or_else(
+ || {
+ if missing.len() > 1 {
+ "Cua isn't in their settings yet.".into()
+ } else {
+ format!("Cua isn't in {them}'s settings yet.")
+ }
+ },
+ |e| format!("Couldn't add Cua: {e}"),
+ ),
+ Some(button("connect", "Connect")),
+ ));
}
+ let can = format!("{name} can use Cua");
+ if let Some(at) = &input.agent_used_at {
+ return Some(row(
+ RowState::Ok,
+ can,
+ format!(
+ "{} used Cua at {at}.",
+ if many { "Your agent" } else { "It" }
+ ),
+ None,
+ ));
+ }
+ if input.agent_open_before_setup == Some(true) {
+ return Some(row(
+ RowState::Fix,
+ format!("Restart {name}"),
+ format!(
+ "{} open when we added Cua. Close {}, then open {} again.",
+ if many { "They were" } else { "It was" },
+ if many { "them" } else { "it" },
+ if many { "them" } else { "it" }
+ ),
+ Some(button("restart-check", "Check again")),
+ ));
+ }
+ Some(row(
+ RowState::Ok,
+ can,
+ if many {
+ "We added Cua to their settings. If any was already open, restart it.".into()
+ } else {
+ format!("We added Cua to {name}'s settings. If {name} was already open, restart it.")
+ },
+ None,
+ ))
}
fn missing_permission(host: &FirstRunHost, id: &str) -> Option<FirstRunPermission> {
@@ -849,8 +1107,18 @@ pub fn upsell(plan: &FirstRunPlan, agent_used: bool) -> Option<UpsellCard> {
/// it is made.
fn art(input: &FirstRunInput, computer: &CheckRow) -> ArtView {
let agents = input.agents.as_deref().unwrap_or(&[]);
+ let agent = match input.step {
+ FirstRunStep::Connect => picked(input).into_iter().next(),
+ FirstRunStep::Setup => lead_of(input),
+ };
ArtView {
- agent: input.agent.clone().unwrap_or_else(|| lead_agent(agents)),
+ agent: agent.unwrap_or_else(|| {
+ if input.step == FirstRunStep::Connect && input.agents.is_none() {
+ lead_agent(agents)
+ } else {
+ "other".into()
+ }
+ }),
computer: if input.step == FirstRunStep::Setup && computer.state != RowState::Ok {
"faded"
} else {
@@ -886,13 +1154,18 @@ pub fn view(input: &FirstRunInput) -> FirstRunView {
};
}
let place = this_computer(&input.host_os);
- let name = agent_name(input);
- let rows = vec![agent, computer];
+ let ids = connected(input);
+ let all = input.agents.as_deref().unwrap_or(&[]);
+ let rows: Vec<CheckRow> = agent.into_iter().chain([computer]).collect();
let checking = rows.iter().any(|r| r.state == RowState::Checking);
let fixes = rows.iter().filter(|r| r.state == RowState::Fix).count();
let ready = rows.iter().all(|r| r.state == RowState::Ok);
let title = if ready {
- format!("Your agent can use {place}.")
+ match ids.len() {
+ 0 => format!("{} is ready.", cap(place)),
+ 1 => format!("Your agent can use {place}."),
+ _ => format!("Your agents can use {place}."),
+ }
} else if fixes == 1 && !checking {
"One step left.".into()
} else if fixes > 1 && !checking {
@@ -901,21 +1174,24 @@ pub fn view(input: &FirstRunInput) -> FirstRunView {
"Checking your setup.".into()
};
let used = input.agent_used_at.is_some();
- let prompt = if used {
- PromptView {
- heading: format!("You asked {name}"),
- text: first_prompt(&input.host_os).into(),
- note: format!("It answered in {name}. Ask it anything else."),
- copy: None,
- }
- } else {
- PromptView {
- heading: format!("Try this in {name}"),
- text: first_prompt(&input.host_os).into(),
- note: format!("This works now, on {place}."),
- copy: Some("Copy".into()),
+ let prompt = (!ids.is_empty()).then(|| {
+ if used {
+ let name = agent_name(input);
+ PromptView {
+ heading: format!("You asked {name}"),
+ text: first_prompt(&input.host_os).into(),
+ note: format!("It answered in {name}. Ask it anything else."),
+ copy: None,
+ }
+ } else {
+ PromptView {
+ heading: format!("Try this in {}", names(all, &ids, "or")),
+ text: first_prompt(&input.host_os).into(),
+ note: format!("This works now, on {place}."),
+ copy: Some("Copy".into()),
+ }
}
- };
+ });
let finish_later = fixes > 0 && !checking;
FirstRunView {
step: FirstRunStep::Setup,
@@ -953,27 +1229,33 @@ pub fn view(input: &FirstRunInput) -> FirstRunView {
/// kept (frame 9). Nothing left that is required: `complete`.
pub fn todos(input: &FirstRunInput) -> FirstRunTodos {
let place = this_computer(&input.host_os);
- let name = agent_name(input);
+ let ids = connected(input);
+ let all = input.agents.as_deref().unwrap_or(&[]);
+ let name = names(all, &ids, "and");
let agent = agent_row(input);
let computer = computer_row(input);
let used = input.agent_used_at.is_some();
- let mut items = vec![FirstRunTodo {
- id: "agent".into(),
- done: agent.state == RowState::Ok,
- title: if agent.state == RowState::Fix {
- agent.title.clone()
- } else {
- format!("Connect {name}")
- },
- note: if agent.state == RowState::Ok {
- format!("{name} can use Cua.")
- } else {
- agent.note.clone()
- },
- optional: false,
- action: agent.action.clone(),
- settings_url: None,
- }];
+ // No agent picked: no agent line and no first request.
+ let mut items: Vec<FirstRunTodo> = agent
+ .iter()
+ .map(|agent| FirstRunTodo {
+ id: "agent".into(),
+ done: agent.state == RowState::Ok,
+ title: if agent.state == RowState::Fix {
+ agent.title.clone()
+ } else {
+ format!("Connect {name}")
+ },
+ note: if agent.state == RowState::Ok {
+ format!("{name} can use Cua.")
+ } else {
+ agent.note.clone()
+ },
+ optional: false,
+ action: agent.action.clone(),
+ settings_url: None,
+ })
+ .collect();
// Sign-in is its own line; the computer line is what is left after it.
items.push(FirstRunTodo {
id: "computer".into(),
@@ -998,18 +1280,21 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {
},
settings_url: computer.settings_url.clone(),
});
- items.push(FirstRunTodo {
- id: "prompt".into(),
- title: "Try your first request".into(),
- note: format!(
- "Ask {name}: \u{201c}{}\u{201d}",
- first_prompt(&input.host_os)
- ),
- done: used,
- optional: false,
- action: (!used).then(|| button("copy", "Copy")),
- settings_url: None,
- });
+ if !ids.is_empty() {
+ items.push(FirstRunTodo {
+ id: "prompt".into(),
+ title: "Try your first request".into(),
+ note: format!(
+ "Ask {}: \u{201c}{}\u{201d}",
+ names(all, &ids, "or"),
+ first_prompt(&input.host_os)
+ ),
+ done: used,
+ optional: false,
+ action: (!used).then(|| button("copy", "Copy")),
+ settings_url: None,
+ });
+ }
let extra_done = matches!(input.extra.phase.as_str(), "creating" | "ready");
items.push(FirstRunTodo {
id: "extra".into(),
@@ -1035,15 +1320,16 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {
});
let done = items.iter().filter(|i| i.done).count();
let complete = items.iter().all(|i| i.done || i.optional);
- let lede = if agent.state == RowState::Ok {
- let left = items.iter().filter(|i| !i.done && !i.optional).count();
- match left {
- 0 => format!("{name} is connected. You're all set."),
- 1 => format!("{name} is connected. One thing is left."),
- _ => format!("{name} is connected. A couple of things are left."),
- }
- } else {
- "A couple of things are left.".into()
+ let left = items.iter().filter(|i| !i.done && !i.optional).count();
+ let rest = match left {
+ 0 => "You're all set.",
+ 1 => "One thing is left.",
+ _ => "A couple of things are left.",
+ };
+ let lede = match &agent {
+ Some(a) if a.state == RowState::Ok => format!("{name} is connected. {rest}"),
+ Some(_) => "A couple of things are left.".into(),
+ None => rest.into(),
};
FirstRunTodos {
title: "Finish setting up".into(),
@@ -1109,9 +1395,58 @@ mod tests {
name: "Claude Code".into(),
installed: true,
configured,
+ ..Default::default()
}
}
+ fn agent(id: &str, name: &str, installed: bool) -> FirstRunAgent {
+ FirstRunAgent {
+ agent: id.into(),
+ name: name.into(),
+ installed,
+ ..Default::default()
+ }
+ }
+
+ fn codex(installed: bool, signed_in: bool) -> FirstRunAgent {
+ FirstRunAgent {
+ sign_in: Some("ChatGPT".into()),
+ signed_in,
+ ..agent("codex", "OpenAI Codex", installed)
+ }
+ }
+
+ fn keys(saved: &[&str]) -> crate::agent_keys::AgentKeysInput {
+ crate::agent_keys::AgentKeysInput {
+ keys: saved
+ .iter()
+ .map(|env| crate::agent_keys::AgentKeyInput {
+ provider: crate::agent_keys::provider_of(env).into(),
+ env: (*env).into(),
+ last4: "1234".into(),
+ added_ms: 1,
+ })
+ .collect(),
+ ..Default::default()
+ }
+ }
+
+ fn connect(agents: Vec<FirstRunAgent>, picked: Option<&[&str]>) -> ConnectView {
+ view(&FirstRunInput {
+ host_os: "macos".into(),
+ agents: Some(agents),
+ picked: picked.map(|p| p.iter().map(|x| x.to_string()).collect()),
+ keys: Some(keys(&["ANTHROPIC_API_KEY"])),
+ ..Default::default()
+ })
+ .connect
+ .unwrap()
+ }
+
+ fn ids(p: &[AgentPick], f: impl Fn(&AgentPick) -> bool) -> Vec<String> {
+ p.iter().filter(|x| f(x)).map(|x| x.agent.clone()).collect()
+ }
+
fn ready_host() -> FirstRunHost {
FirstRunHost {
configured: true,
@@ -1156,23 +1491,290 @@ mod tests {
}
#[test]
- fn connect_leads_with_an_installed_agent() {
+ fn every_agent_is_listed_once_and_installed_ones_are_ticked() {
+ let all = vec![
+ claude(false),
+ codex(true, false),
+ agent("cursor", "Cursor", false),
+ agent("goose", "Goose", true),
+ agent("zed", "Zed", false),
+ ];
+ let c = connect(all.clone(), None);
+ assert_eq!(c.intro, "Pick any, or none.");
+ assert_eq!(c.agents_label, "On this Mac");
+ // The common ones first, then an installed other one; the rest under More.
+ assert_eq!(
+ ids(&c.agents, |_| true),
+ [
+ "claude-code",
+ "codex",
+ "hermes",
+ "cursor",
+ "openclaw",
+ "goose"
+ ]
+ );
+ assert_eq!(ids(&c.more, |_| true), ["zed"]);
+ assert_eq!(c.more_label, "More agents");
+ // Ticked by default: what is installed here.
+ assert_eq!(
+ ids(&c.agents, |p| p.checked),
+ ["claude-code", "codex", "goose"]
+ );
+ assert_eq!(c.connects, ["claude-code", "codex", "goose"]);
+ assert_eq!(c.primary.id, "continue");
+ let cursor = c.agents.iter().find(|p| p.agent == "cursor").unwrap();
+ assert_eq!(cursor.note.as_deref(), Some("Not found on this Mac"));
+ // Nothing read yet: the common ones, none ticked.
+ let none_yet = view(&FirstRunInput::default()).connect.unwrap();
+ assert_eq!(ids(&none_yet.agents, |_| true), FEATURED);
+ assert!(none_yet.agents.iter().all(|p| !p.checked) && none_yet.more.is_empty());
+ }
+
+ /// Drift guard: every agent the setup's registry knows is on step 1
+ /// exactly once, so a newly supported agent shows up without an edit
+ /// here; and every agent this file names is one the registry knows.
+ #[test]
+ fn every_registry_agent_is_on_step_one() {
+ let registry: Vec<FirstRunAgent> = cua_agent_setup::AGENTS
+ .iter()
+ .map(|a| agent(a.id, a.name, false))
+ .collect();
+ let c = connect(registry.clone(), None);
+ let mut listed = ids(&c.agents, |_| true);
+ listed.extend(ids(&c.more, |_| true));
+ let mut want: Vec<String> = registry.iter().map(|a| a.agent.clone()).collect();
+ listed.sort();
+ want.sort();
+ assert_eq!(listed, want);
+ let known = |id: &str| cua_agent_setup::registry::find(id).is_some_and(|a| a.id == id);
+ for id in FEATURED
+ .iter()
+ .chain(OFFERED.iter())
+ .chain(AGENT_KEYS.iter().map(|(a, _)| a))
+ {
+ assert!(known(id), "{id} is not a registry id");
+ }
+ // The agents with a sign-in the setup can start get a row for it.
+ for a in cua_agent_setup::AGENTS.iter().filter(|a| a.login.is_some()) {
+ let mut row = agent(a.id, a.name, true);
+ row.sign_in = a.login.map(|l| l.label.to_string());
+ let c = connect(vec![row], Some(&[a.id]));
+ assert!(
+ c.credentials
+ .iter()
+ .any(|r| r.id == format!("sign-in:{}", a.id)),
+ "{}",
+ a.id
+ );
+ }
+ }
+
+ #[test]
+ fn none_is_a_choice() {
+ let c = connect(vec![claude(false), codex(true, false)], Some(&[]));
+ assert!(c.agents.iter().all(|p| !p.checked));
+ assert!(c.connects.is_empty() && c.credentials.is_empty());
+ assert_eq!(c.primary.label, "Continue");
+ // Step 2 with none: no agent row and no first request; done once this Mac is.
+ let mut i = setup();
+ i.picked = Some(vec![]);
+ let v = view(&i);
+ let st = s(&v);
+ assert_eq!(st.rows.len(), 1);
+ assert_eq!(st.rows[0].id, "computer");
+ assert!(st.prompt.is_none());
+ assert_eq!(st.title, "This Mac is ready.");
+ assert!(st.primary.enabled);
+ assert_eq!(v.art.agent, "other");
+ let t = todos(&i);
+ assert!(t.items.iter().all(|x| x.id != "agent" && x.id != "prompt"));
+ assert!(t.complete);
+ assert_eq!(t.lede, "You're all set.");
+ }
+
+ #[test]
+ fn one_or_several_and_set_up_ones_stay_ticked() {
+ // Codex only.
+ let c = connect(vec![claude(false), codex(true, false)], Some(&["codex"]));
+ assert_eq!(ids(&c.agents, |p| p.checked), ["codex"]);
+ assert_eq!(c.connects, ["codex"]);
+ // Several, with one that already uses Cua: it can't be unticked here.
+ let c = connect(
+ vec![
+ claude(true),
+ codex(true, false),
+ agent("hermes", "Hermes", true),
+ ],
+ Some(&["codex", "hermes"]),
+ );
+ assert_eq!(
+ ids(&c.agents, |p| p.checked),
+ ["claude-code", "codex", "hermes"]
+ );
+ assert_eq!(ids(&c.agents, |p| p.locked), ["claude-code"]);
+ assert_eq!(c.connects, ["codex", "hermes"]);
let mut i = FirstRunInput {
- host_os: "macos".into(),
+ agents: Some(vec![
+ claude(true),
+ codex(true, false),
+ agent("hermes", "Hermes", true),
+ ]),
+ picked: Some(vec!["codex".into(), "hermes".into()]),
+ connecting: true,
..Default::default()
};
+ assert_eq!(
+ view(&i).connect.unwrap().busy.as_deref(),
+ Some("Adding Cua to OpenAI Codex and Hermes…")
+ );
+ // Step 2 names them all.
+ i.step = FirstRunStep::Setup;
+ i.connecting = false;
+ i.picked = Some(vec!["claude-code".into(), "codex".into()]);
+ i.agents = Some(vec![
+ claude(true),
+ FirstRunAgent {
+ configured: true,
+ ..codex(true, false)
+ },
+ ]);
+ i.signed_in = true;
+ i.host = Some(ready_host());
+ i.host_os = "macos".into();
let v = view(&i);
- let c = v.connect.unwrap();
- assert_eq!(c.primary.label, "Connect Claude Code");
- assert_eq!(c.note, "Your agent will use this Mac.");
- assert_eq!(c.others.len(), 3);
- i.agents = Some(vec![FirstRunAgent {
- agent: "codex".into(),
- name: "Codex".into(),
- installed: true,
- configured: false,
- }]);
- assert_eq!(view(&i).connect.unwrap().primary.label, "Connect Codex");
+ let st = s(&v);
+ assert_eq!(st.title, "Your agents can use this Mac.");
+ assert_eq!(st.rows[0].title, "Claude Code and OpenAI Codex can use Cua");
+ assert_eq!(
+ st.prompt.as_ref().unwrap().heading,
+ "Try this in Claude Code or OpenAI Codex"
+ );
+ // One not set up yet: the fix names only it.
+ i.agents = Some(vec![claude(true), codex(true, false)]);
+ let v = view(&i);
+ assert_eq!(s(&v).rows[0].title, "Connect OpenAI Codex");
+ assert_eq!(
+ s(&v).rows[0].note,
+ "Cua isn't in OpenAI Codex's settings yet."
+ );
+ }
+
+ #[test]
+ fn codex_signs_in_on_this_computer_and_keys_stay_here() {
+ // Codex only: its ChatGPT sign-in and the OpenAI key, never the Anthropic one.
+ let c = connect(vec![claude(false), codex(true, false)], Some(&["codex"]));
+ let rows: Vec<_> = c.credentials.iter().map(|r| r.id.as_str()).collect();
+ assert_eq!(rows, ["sign-in:codex", "key:openai"]);
+ let chatgpt = &c.credentials[0];
+ assert_eq!(chatgpt.title, "ChatGPT sign-in");
+ assert_eq!(chatgpt.note, "OpenAI Codex uses it on this Mac");
+ assert_eq!(chatgpt.action.as_ref().unwrap().id, "agent-sign-in");
+ assert_eq!(chatgpt.agent.as_deref(), Some("codex"));
+ let openai = &c.credentials[1];
+ assert_eq!(
+ (openai.title.as_str(), openai.status.as_deref()),
+ ("OpenAI key", None)
+ );
+ assert_eq!(openai.action.as_ref().unwrap().id, "add-key");
+ // Both: the Anthropic key is saved, so it says so and asks nothing.
+ let c = connect(
+ vec![claude(false), codex(true, true)],
+ Some(&["claude-code", "codex"]),
+ );
+ let rows: Vec<_> = c
+ .credentials
+ .iter()
+ .map(|r| (r.id.as_str(), r.status.as_deref(), r.action.is_some()))
+ .collect();
+ assert_eq!(
+ rows,
+ [
+ ("sign-in:codex", Some("Signed in"), false),
+ ("key:anthropic", Some("Saved"), false),
+ ("key:openai", None, true),
+ ]
+ );
+ assert!(c.credentials.iter().all(|r| r.ok == r.status.is_some()));
+ // Waiting for the browser, then a failure to start.
+ let mut i = FirstRunInput {
+ agents: Some(vec![codex(true, false)]),
+ picked: Some(vec!["codex".into()]),
+ agent_signing_in: Some("codex".into()),
+ ..Default::default()
+ };
+ let row = view(&i).connect.unwrap().credentials[0].clone();
+ assert_eq!(row.status.as_deref(), Some("Finish in your browser…"));
+ assert!(!row.ok, "a wait is not a done status");
+ assert!(row.action.is_none());
+ i.agent_signing_in = None;
+ i.agent_sign_in_error = Some("codex: not found".into());
+ let row = view(&i).connect.unwrap().credentials[0].clone();
+ assert_eq!(
+ row.error.as_deref(),
+ Some("Couldn't start the sign-in: codex: not found")
+ );
+ // Codex not installed here: nothing to start yet.
+ i.agents = Some(vec![codex(false, false)]);
+ assert!(view(&i).connect.unwrap().credentials[0].action.is_none());
+ // Keys this app can't read: only the sign-in.
+ i.keys = Some(crate::agent_keys::AgentKeysInput {
+ unavailable: Some("no vault".into()),
+ ..Default::default()
+ });
+ assert_eq!(view(&i).connect.unwrap().credentials.len(), 1);
+ }
+
+ #[test]
+ fn step_one_says_what_stays_on_this_computer() {
+ let c = connect(
+ vec![claude(false), codex(true, false)],
+ Some(&["claude-code", "codex"]),
+ );
+ assert_eq!(
+ c.agents_note,
+ "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own."
+ );
+ assert_eq!(c.credentials_label, "Sign-ins and keys");
+ assert_eq!(
+ c.credentials_note,
+ "They stay on this Mac. Other computers keep their own."
+ );
+ // Nothing follows the Cua account: the page never says it does.
+ let all = serde_json::to_string(&c).unwrap().to_lowercase();
+ for claim in ["account", "everywhere", "any computer", "sync"] {
+ assert!(!all.contains(claim), "{claim}");
+ }
+ let pc = view(&FirstRunInput {
+ host_os: "windows".into(),
+ ..Default::default()
+ })
+ .connect
+ .unwrap();
+ assert_eq!(pc.agents_label, "On this PC");
+ assert!(pc.agents_note.contains("on this PC only"));
+ // Linux (and anything else): "this computer"; never "Mac" off a Mac.
+ let mut linux_in = FirstRunInput {
+ host_os: "linux".into(),
+ agents: Some(vec![codex(true, false)]),
+ picked: Some(vec!["codex".into()]),
+ ..Default::default()
+ };
+ let linux = view(&linux_in).connect.unwrap();
+ assert_eq!(linux.agents_label, "On this computer");
+ assert_eq!(
+ linux.credentials_note,
+ "They stay on this computer. Other computers keep their own."
+ );
+ assert_eq!(
+ linux.credentials[0].note,
+ "OpenAI Codex uses it on this computer"
+ );
+ for os in ["linux", "windows"] {
+ linux_in.host_os = os.into();
+ let all = serde_json::to_string(&view(&linux_in)).unwrap();
+ assert!(!all.contains("Mac"), "{os}: {all}");
+ }
}
#[test]
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 617d37c9ef..9478de7d2d 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -3329,18 +3329,75 @@ fn run_first_run(f: &Value, h: &dyn Host) -> Result<Value, String> {
});
if v["connect"].is_object() {
let k = &v["connect"];
- let others: Vec<String> = k["others"]
+ // "[x] Claude Code", "[ ] Cursor (Not found on this Mac)", "[=] ..." locked.
+ let picks = |key: &str| -> Vec<String> {
+ k[key]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|p| {
+ let mark = if p["locked"].as_bool() == Some(true) {
+ "="
+ } else if p["checked"].as_bool() == Some(true) {
+ "x"
+ } else {
+ " "
+ };
+ let note = if p["note"].is_string() {
+ format!(" ({})", s(&p["note"]))
+ } else {
+ String::new()
+ };
+ format!("[{mark}] {}{note}", s(&p["name"]))
+ })
+ .collect()
+ };
+ let creds: Vec<String> = k["credentials"]
.as_array()
.into_iter()
.flatten()
- .map(|o| s(&o["name"]))
+ .map(|r| {
+ format!(
+ "{} — {}{}{}{}",
+ s(&r["title"]),
+ s(&r["note"]),
+ if r["status"].is_string() {
+ format!(" [{}]", s(&r["status"]))
+ } else {
+ String::new()
+ },
+ if r["action"].is_object() {
+ format!(" ({})", btn(&r["action"]))
+ } else {
+ String::new()
+ },
+ if r["error"].is_string() {
+ format!(" !{}", s(&r["error"]))
+ } else {
+ String::new()
+ },
+ )
+ })
+ .collect();
+ let connects: Vec<String> = k["connects"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(&s)
.collect();
frame["connect"] = json!({
"title": k["title"],
"lede": k["lede"],
+ "intro": k["intro"],
+ "agents": format!("{}: {}", s(&k["agentsLabel"]), picks("agents").join(", ")),
+ "more": format!("{}: {}", s(&k["moreLabel"]), picks("more").join(", ")),
+ "agentsNote": k["agentsNote"],
+ "credentials": if creds.is_empty() { Value::Null } else {
+ json!(format!("{} ({}): {}", s(&k["credentialsLabel"]), s(&k["credentialsNote"]), creds.join(" / ")))
+ },
"primary": btn(&k["primary"]),
- "note": format!("{} {}", s(&k["note"]), s(&k["noteMore"])),
- "others": others.join(", "),
+ "connects": connects.join(", "),
+ "busy": k["busy"],
});
}
if v["setup"].is_object() {
@@ -3384,7 +3441,9 @@ fn run_first_run(f: &Value, h: &dyn Host) -> Result<Value, String> {
frame["setup"] = json!({
"title": k["title"],
"rows": rows,
- "prompt": format!("{}: {} / {}", s(&k["prompt"]["heading"]), s(&k["prompt"]["text"]), s(&k["prompt"]["note"])),
+ "prompt": if k["prompt"].is_object() {
+ json!(format!("{}: {} / {}", s(&k["prompt"]["heading"]), s(&k["prompt"]["text"]), s(&k["prompt"]["note"])))
+ } else { Value::Null },
"extra": {
"phase": x["phase"],
"title": x["title"],
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
index 17109b4f86..68f0ce44ed 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2375,6 +2375,8 @@ pub fn app_agent_setup_status(info: cua_sdk::AgentInfo) -> AppAgentSetupStatus {
skills_installed: info.skills_installed,
skills_outdated: info.skills_outdated,
error: info.error,
+ sign_in: info.sign_in,
+ signed_in: info.signed_in,
}
}
@@ -3095,6 +3097,8 @@ mod agent_detection_tests {
skills_outdated: vec![],
error: None,
unverified: None,
+ sign_in: None,
+ signed_in: false,
}
}
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 92aa1efd3c..66426ebbb2 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
@@ -7743,6 +7743,11 @@ pub struct AppAgentSetupStatus {
pub skills_outdated: Vec<String>,
/// Problem reading its config.
pub error: Option<String>,
+ /// The account it signs in with on its own (`ChatGPT` for Codex), when
+ /// the setup can see that sign-in.
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ pub signed_in: bool,
}
/// One Settings row for a coding agent.
@@ -7767,6 +7772,10 @@ pub struct AppAgentSettingsRow {
pub mcp_config: Option<String>,
/// Skills directory.
pub skills_dir: Option<String>,
+ /// The account it signs in with on its own (`ChatGPT`), when known.
+ pub sign_in: Option<String>,
+ /// That sign-in is on this computer.
+ pub signed_in: bool,
}
/// One target's outcome of an agent setup step (the SDK's
diff --git a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
index 65275e0599..6fe251c415 100644
--- a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
+++ b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
@@ -881,6 +881,8 @@ external fun uniffi_cua_sdk_checksum_method_agentsetup_set_onboarding_declined(
): Short
external fun uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver(
): Short
+external fun uniffi_cua_sdk_checksum_method_agentsetup_sign_in(
+): Short
external fun uniffi_cua_sdk_checksum_method_agentsetup_skills(
): Short
external fun uniffi_cua_sdk_checksum_method_agentsetup_status(
@@ -1638,6 +1640,8 @@ external fun uniffi_cua_sdk_fn_method_agentsetup_set_onboarding_declined(`ptr`:
): Unit
external fun uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver(`ptr`: Long,`agents`: RustBuffer.ByValue,`command`: RustBuffer.ByValue,`skills`: Byte,`mcp`: Byte,
): Long
+external fun uniffi_cua_sdk_fn_method_agentsetup_sign_in(`ptr`: Long,`agent`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+): Unit
external fun uniffi_cua_sdk_fn_method_agentsetup_skills(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
external fun uniffi_cua_sdk_fn_method_agentsetup_status(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -2890,6 +2894,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver() != 33764.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cua_sdk_checksum_method_agentsetup_sign_in() != 10179.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cua_sdk_checksum_method_agentsetup_skills() != 53692.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -5124,6 +5131,13 @@ public interface AgentSetupInterface {
*/
suspend fun `setupCuaDriver`(`agents`: List<kotlin.String>, `command`: kotlin.String?, `skills`: kotlin.Boolean, `mcp`: kotlin.Boolean): List<AgentSetupOutcome>
+ /**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ fun `signIn`(`agent`: kotlin.String)
+
/**
* The skills bundled with this SDK.
*/
@@ -5408,6 +5422,24 @@ open class AgentSetup: Disposable, AutoCloseable, AgentSetupInterface
}
+ /**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ @Throws(CuaException::class)override fun `signIn`(`agent`: kotlin.String)
+ =
+ callWithHandle {
+ uniffiRustCallWithError(CuaException) { _status ->
+ UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_sign_in(
+ it,
+ FfiConverterString.lower(`agent`),_status)
+}
+ }
+
+
+
+
/**
* The skills bundled with this SDK.
*/override fun `skills`(): List<BundledSkill> {
@@ -23106,6 +23138,17 @@ data class AgentInfo (
* What could not be verified from the agent's official docs.
*/
var `unverified`: kotlin.String?
+ ,
+ /**
+ * The account the agent signs in with on its own (`ChatGPT` for
+ * Codex), when cua can see that sign-in.
+ */
+ var `signIn`: kotlin.String? = null
+ ,
+ /**
+ * That sign-in is on this computer.
+ */
+ var `signedIn`: kotlin.Boolean = false
){
@@ -23136,6 +23179,8 @@ public object FfiConverterTypeAgentInfo: FfiConverterRustBuffer<AgentInfo> {
FfiConverterSequenceString.read(buf),
FfiConverterOptionalString.read(buf),
FfiConverterOptionalString.read(buf),
+ FfiConverterOptionalString.read(buf),
+ FfiConverterBoolean.read(buf),
)
}
@@ -23153,7 +23198,9 @@ public object FfiConverterTypeAgentInfo: FfiConverterRustBuffer<AgentInfo> {
FfiConverterSequenceString.allocationSize(value.`skillsInstalled`) +
FfiConverterSequenceString.allocationSize(value.`skillsOutdated`) +
FfiConverterOptionalString.allocationSize(value.`error`) +
- FfiConverterOptionalString.allocationSize(value.`unverified`)
+ FfiConverterOptionalString.allocationSize(value.`unverified`) +
+ FfiConverterOptionalString.allocationSize(value.`signIn`) +
+ FfiConverterBoolean.allocationSize(value.`signedIn`)
)
override fun write(value: AgentInfo, buf: ByteBuffer) {
@@ -23171,6 +23218,8 @@ public object FfiConverterTypeAgentInfo: FfiConverterRustBuffer<AgentInfo> {
FfiConverterSequenceString.write(value.`skillsOutdated`, buf)
FfiConverterOptionalString.write(value.`error`, buf)
FfiConverterOptionalString.write(value.`unverified`, buf)
+ FfiConverterOptionalString.write(value.`signIn`, buf)
+ FfiConverterBoolean.write(value.`signedIn`, buf)
}
}
diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.py
index 69a43c82e0..29b2059f98 100644
--- a/libs/cua/python/src/cua/_native.py
+++ b/libs/cua/python/src/cua/_native.py
@@ -623,6 +623,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver() != 33764:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cua_sdk_checksum_method_agentsetup_sign_in() != 10179:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_agentsetup_skills() != 53692:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cua_sdk_checksum_method_agentsetup_status() != 46185:
@@ -2337,6 +2339,12 @@ _UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver.argtypes = (
ctypes.c_int8,
)
_UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_sign_in.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_sign_in.restype = None
_UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_skills.argtypes = (
ctypes.c_uint64,
ctypes.POINTER(_UniffiRustCallStatus),
@@ -4384,6 +4392,9 @@ _UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_set_onboarding_declined.res
_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_sign_in.argtypes = (
+)
+_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_sign_in.restype = ctypes.c_uint16
_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_skills.argtypes = (
)
_UniffiLib.uniffi_cua_sdk_checksum_method_agentsetup_skills.restype = ctypes.c_uint16
@@ -6092,7 +6103,7 @@ class AgentInfo:
"""
One AI coding agent and what cua configured for it.
"""
- def __init__(self, *, id:str, name:str, installed:bool, evidence:typing.List[str], skills_dir:typing.Optional[str], mcp_config:typing.Optional[str], mcp_format:typing.Optional[str], cua_configured:bool, cua_managed:bool, cua_driver_configured:bool, skills_installed:typing.List[str], skills_outdated:typing.List[str], error:typing.Optional[str], unverified:typing.Optional[str]):
+ def __init__(self, *, id:str, name:str, installed:bool, evidence:typing.List[str], skills_dir:typing.Optional[str], mcp_config:typing.Optional[str], mcp_format:typing.Optional[str], cua_configured:bool, cua_managed:bool, cua_driver_configured:bool, skills_installed:typing.List[str], skills_outdated:typing.List[str], error:typing.Optional[str], unverified:typing.Optional[str], sign_in:typing.Optional[str] = _DEFAULT, signed_in:bool = False):
self.id = id
self.name = name
self.installed = installed
@@ -6107,12 +6118,17 @@ class AgentInfo:
self.skills_outdated = skills_outdated
self.error = error
self.unverified = unverified
+ if sign_in is _DEFAULT:
+ self.sign_in = None
+ else:
+ self.sign_in = sign_in
+ self.signed_in = signed_in
def __str__(self):
- return "AgentInfo(id={}, name={}, installed={}, evidence={}, skills_dir={}, mcp_config={}, mcp_format={}, cua_configured={}, cua_managed={}, cua_driver_configured={}, skills_installed={}, skills_outdated={}, error={}, unverified={})".format(self.id, self.name, self.installed, self.evidence, self.skills_dir, self.mcp_config, self.mcp_format, self.cua_configured, self.cua_managed, self.cua_driver_configured, self.skills_installed, self.skills_outdated, self.error, self.unverified)
+ return "AgentInfo(id={}, name={}, installed={}, evidence={}, skills_dir={}, mcp_config={}, mcp_format={}, cua_configured={}, cua_managed={}, cua_driver_configured={}, skills_installed={}, skills_outdated={}, error={}, unverified={}, sign_in={}, signed_in={})".format(self.id, self.name, self.installed, self.evidence, self.skills_dir, self.mcp_config, self.mcp_format, self.cua_configured, self.cua_managed, self.cua_driver_configured, self.skills_installed, self.skills_outdated, self.error, self.unverified, self.sign_in, self.signed_in)
def __eq__(self, other):
if self.id != other.id:
return False
@@ -6142,6 +6158,10 @@ class AgentInfo:
return False
if self.unverified != other.unverified:
return False
+ if self.sign_in != other.sign_in:
+ return False
+ if self.signed_in != other.signed_in:
+ return False
return True
class _UniffiFfiConverterTypeAgentInfo(_UniffiConverterRustBuffer):
@@ -6162,6 +6182,8 @@ class _UniffiFfiConverterTypeAgentInfo(_UniffiConverterRustBuffer):
skills_outdated=_UniffiFfiConverterSequenceString.read(buf),
error=_UniffiFfiConverterOptionalString.read(buf),
unverified=_UniffiFfiConverterOptionalString.read(buf),
+ sign_in=_UniffiFfiConverterOptionalString.read(buf),
+ signed_in=_UniffiFfiConverterBoolean.read(buf),
)
@staticmethod
@@ -6180,6 +6202,8 @@ class _UniffiFfiConverterTypeAgentInfo(_UniffiConverterRustBuffer):
_UniffiFfiConverterSequenceString.check_lower(value.skills_outdated)
_UniffiFfiConverterOptionalString.check_lower(value.error)
_UniffiFfiConverterOptionalString.check_lower(value.unverified)
+ _UniffiFfiConverterOptionalString.check_lower(value.sign_in)
+ _UniffiFfiConverterBoolean.check_lower(value.signed_in)
@staticmethod
def write(value, buf):
@@ -6197,6 +6221,8 @@ class _UniffiFfiConverterTypeAgentInfo(_UniffiConverterRustBuffer):
_UniffiFfiConverterSequenceString.write(value.skills_outdated, buf)
_UniffiFfiConverterOptionalString.write(value.error, buf)
_UniffiFfiConverterOptionalString.write(value.unverified, buf)
+ _UniffiFfiConverterOptionalString.write(value.sign_in, buf)
+ _UniffiFfiConverterBoolean.write(value.signed_in, buf)
class _UniffiFfiConverterMapStringString(_UniffiConverterRustBuffer):
@classmethod
@@ -22534,6 +22560,13 @@ class AgentSetupProtocol(typing.Protocol):
(`skills`) and the `cua-driver mcp` server (`mcp`), launching
`command` (default: the installed cua-driver). The same step as
`cua agents setup --cua-driver` and the installers' `cua-driver` item.
+"""
+ raise NotImplementedError
+ def sign_in(self, agent: str) -> None:
+ """
+ Starts `agent`'s own sign-in on this computer (`codex login`: the
+ browser opens). Returns once it is running; `detect` reports
+ `signed_in` when it is done. cua never reads or copies the sign-in.
"""
raise NotImplementedError
def skills(self, ) -> typing.List[BundledSkill]:
@@ -22761,6 +22794,26 @@ class AgentSetup(AgentSetupProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ def sign_in(self, agent: str) -> None:
+ """
+ Starts `agent`'s own sign-in on this computer (`codex login`: the
+ browser opens). Returns once it is running; `detect` reports
+ `signed_in` when it is done. cua never reads or copies the sign-in.
+"""
+
+ _UniffiFfiConverterString.check_lower(agent)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(agent),
+ )
+ _uniffi_lift_return = lambda val: None
+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cua_sdk_fn_method_agentsetup_sign_in,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def skills(self, ) -> typing.List[BundledSkill]:
"""
The skills bundled with this SDK.
diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
index 2526b494f3..58c866b755 100644
--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
@@ -1023,6 +1023,13 @@ public protocol AgentSetupProtocol: AnyObject, Sendable {
*/
func setupCuaDriver(agents: [String], command: String?, skills: Bool, mcp: Bool) async throws -> [AgentSetupOutcome]
+ /**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ func signIn(agent: String) throws
+
/**
* The skills bundled with this SDK.
*/
@@ -1225,6 +1232,19 @@ open func setupCuaDriver(agents: [String], command: String?, skills: Bool, mcp:
)
}
+ /**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+open func signIn(agent: String)throws {try rustCallWithError(FfiConverterTypeCuaError_lift) {
+ uniffi_cua_sdk_fn_method_agentsetup_sign_in(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(agent),$0
+ )
+}
+}
+
/**
* The skills bundled with this SDK.
*/
@@ -13911,6 +13931,15 @@ public struct AgentInfo: Equatable, Hashable {
* What could not be verified from the agent's official docs.
*/
public var unverified: String?
+ /**
+ * The account the agent signs in with on its own (`ChatGPT` for
+ * Codex), when cua can see that sign-in.
+ */
+ public var signIn: String?
+ /**
+ * That sign-in is on this computer.
+ */
+ public var signedIn: Bool
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -13956,7 +13985,14 @@ public struct AgentInfo: Equatable, Hashable {
*/error: String?,
/**
* What could not be verified from the agent's official docs.
- */unverified: String?) {
+ */unverified: String?,
+ /**
+ * The account the agent signs in with on its own (`ChatGPT` for
+ * Codex), when cua can see that sign-in.
+ */signIn: String? = nil,
+ /**
+ * That sign-in is on this computer.
+ */signedIn: Bool = false) {
self.id = id
self.name = name
self.installed = installed
@@ -13971,6 +14007,8 @@ public struct AgentInfo: Equatable, Hashable {
self.skillsOutdated = skillsOutdated
self.error = error
self.unverified = unverified
+ self.signIn = signIn
+ self.signedIn = signedIn
}
@@ -14002,7 +14040,9 @@ public struct FfiConverterTypeAgentInfo: FfiConverterRustBuffer {
skillsInstalled: FfiConverterSequenceString.read(from: &buf),
skillsOutdated: FfiConverterSequenceString.read(from: &buf),
error: FfiConverterOptionString.read(from: &buf),
- unverified: FfiConverterOptionString.read(from: &buf)
+ unverified: FfiConverterOptionString.read(from: &buf),
+ signIn: FfiConverterOptionString.read(from: &buf),
+ signedIn: FfiConverterBool.read(from: &buf)
)
}
@@ -14021,6 +14061,8 @@ public struct FfiConverterTypeAgentInfo: FfiConverterRustBuffer {
FfiConverterSequenceString.write(value.skillsOutdated, into: &buf)
FfiConverterOptionString.write(value.error, into: &buf)
FfiConverterOptionString.write(value.unverified, into: &buf)
+ FfiConverterOptionString.write(value.signIn, into: &buf)
+ FfiConverterBool.write(value.signedIn, into: &buf)
}
}
@@ -39042,6 +39084,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver() != 33764) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_sdk_checksum_method_agentsetup_sign_in() != 10179) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_sdk_checksum_method_agentsetup_skills() != 53692) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
index e24a7140dd..1f31fc2553 100644
--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h
@@ -381,6 +381,11 @@ void uniffi_cua_sdk_fn_method_agentsetup_set_onboarding_declined(uint64_t ptr, i
uint64_t uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver(uint64_t ptr, RustBuffer agents, RustBuffer command, int8_t skills, int8_t mcp
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_AGENTSETUP_SIGN_IN
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_AGENTSETUP_SIGN_IN
+void uniffi_cua_sdk_fn_method_agentsetup_sign_in(uint64_t ptr, RustBuffer agent, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_AGENTSETUP_SKILLS
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_AGENTSETUP_SKILLS
RustBuffer uniffi_cua_sdk_fn_method_agentsetup_skills(uint64_t ptr, RustCallStatus *_Nonnull out_status
@@ -3404,6 +3409,12 @@ uint16_t uniffi_cua_sdk_checksum_method_agentsetup_set_onboarding_declined(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_AGENTSETUP_SETUP_CUA_DRIVER
uint16_t uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_AGENTSETUP_SIGN_IN
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_AGENTSETUP_SIGN_IN
+uint16_t uniffi_cua_sdk_checksum_method_agentsetup_sign_in(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_AGENTSETUP_SKILLS
diff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.ts
index f1db822d00..c8fa5c1b58 100644
--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts
+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts
@@ -958,6 +958,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_fn_method_agentsetup_sign_in": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Void,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_sdk_fn_method_agentsetup_skills": {
args: [FfiType.Handle],
ret: FfiType.RustBuffer,
@@ -3053,6 +3058,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_sdk_checksum_method_agentsetup_sign_in": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_sdk_checksum_method_agentsetup_skills": {
args: [],
ret: FfiType.UInt16,
@@ -5104,6 +5114,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_fn_method_agentsetup_select(uniffiSelf: bigint, selection: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_set_onboarding_declined(uniffiSelf: bigint, declined: number, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver(uniffiSelf: bigint, agents: Uint8Array, command: Uint8Array, skills: number, mcp: number): bigint;
+ uniffi_cua_sdk_fn_method_agentsetup_sign_in(uniffiSelf: bigint, agent: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cua_sdk_fn_method_agentsetup_skills(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_status(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_sdk_fn_method_agentsetup_update(uniffiSelf: bigint, server: Uint8Array): bigint;
@@ -5523,6 +5534,7 @@ interface NativeModuleInterface {
uniffi_cua_sdk_checksum_method_agentsetup_select(): number;
uniffi_cua_sdk_checksum_method_agentsetup_set_onboarding_declined(): number;
uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver(): number;
+ uniffi_cua_sdk_checksum_method_agentsetup_sign_in(): number;
uniffi_cua_sdk_checksum_method_agentsetup_skills(): number;
uniffi_cua_sdk_checksum_method_agentsetup_status(): number;
uniffi_cua_sdk_checksum_method_agentsetup_update(): number;
diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.ts
index 33b064dc77..c89f471c3c 100644
--- a/libs/cua/typescript/src/native/cua_sdk.ts
+++ b/libs/cua/typescript/src/native/cua_sdk.ts
@@ -1647,7 +1647,16 @@ export type AgentInfo = {
/**
* What could not be verified from the agent's official docs.
*/
- unverified?: string
+ unverified?: string,
+ /**
+ * The account the agent signs in with on its own (`ChatGPT` for
+ * Codex), when cua can see that sign-in.
+ */
+ signIn?: string,
+ /**
+ * That sign-in is on this computer.
+ */
+ signedIn: boolean
}
/**
@@ -1655,6 +1664,8 @@ export type AgentInfo = {
*/
export const AgentInfo = (() => {
const defaults = () => ({
+ signIn: undefined,
+ signedIn: false
});
const create = (() => {
return uniffiCreateRecord<AgentInfo, ReturnType<typeof defaults>>(defaults);
@@ -1684,7 +1695,9 @@ const FfiConverterTypeAgentInfo = (() => {
skillsInstalled: FfiConverterSequenceString.read(from),
skillsOutdated: FfiConverterSequenceString.read(from),
error: FfiConverterOptionalString.read(from),
- unverified: FfiConverterOptionalString.read(from)
+ unverified: FfiConverterOptionalString.read(from),
+ signIn: FfiConverterOptionalString.read(from),
+ signedIn: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -1702,6 +1715,8 @@ const FfiConverterTypeAgentInfo = (() => {
FfiConverterSequenceString.write(value.skillsOutdated, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterOptionalString.write(value.unverified, into);
+ FfiConverterOptionalString.write(value.signIn, into);
+ FfiConverterBool.write(value.signedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
@@ -1717,7 +1732,9 @@ const FfiConverterTypeAgentInfo = (() => {
FfiConverterSequenceString.allocationSize(value.skillsInstalled) +
FfiConverterSequenceString.allocationSize(value.skillsOutdated) +
FfiConverterOptionalString.allocationSize(value.error) +
- FfiConverterOptionalString.allocationSize(value.unverified);
+ FfiConverterOptionalString.allocationSize(value.unverified) +
+ FfiConverterOptionalString.allocationSize(value.signIn) +
+ FfiConverterBool.allocationSize(value.signedIn);
}
};
@@ -19058,6 +19075,12 @@ export interface AgentSetupLike {
* `cua agents setup --cua-driver` and the installers' `cua-driver` item.
*/
setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
+/**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ signIn(agent: string) /*throws*/: void;
/**
* The skills bundled with this SDK.
*/
@@ -19310,6 +19333,22 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * Starts `agent`'s own sign-in on this computer (`codex login`: the
+ * browser opens). Returns once it is running; `detect` reports
+ * `signed_in` when it is done. cua never reads or copies the sign-in.
+ */
+ signIn(agent: string): void /*throws*/ {uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agentsetup_sign_in(
+ uniffiTypeAgentSetupObjectFactory.clonePointer(this),
+ FfiConverterString.lower(agent, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ );
+ }
+
/**
* The skills bundled with this SDK.
*/
@@ -35699,6 +35738,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver() !== 33764) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_setup_cua_driver");
}
+ if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_sign_in() !== 10179) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_sign_in");
+ }
if (nativeModule().uniffi_cua_sdk_checksum_method_agentsetup_skills() !== 53692) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_agentsetup_skills");
}
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 11479cde76..17d83adada 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -4781,6 +4781,14 @@ public struct AppAgentSettingsRow: Equatable, Hashable {
* Skills directory.
*/
public var skillsDir: String?
+ /**
+ * The account it signs in with on its own (`ChatGPT`), when known.
+ */
+ public var signIn: String?
+ /**
+ * That sign-in is on this computer.
+ */
+ public var signedIn: Bool
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -4811,7 +4819,13 @@ public struct AppAgentSettingsRow: Equatable, Hashable {
*/mcpConfig: String?,
/**
* Skills directory.
- */skillsDir: String?) {
+ */skillsDir: String?,
+ /**
+ * The account it signs in with on its own (`ChatGPT`), when known.
+ */signIn: String?,
+ /**
+ * That sign-in is on this computer.
+ */signedIn: Bool) {
self.agent = agent
self.name = name
self.installed = installed
@@ -4821,6 +4835,8 @@ public struct AppAgentSettingsRow: Equatable, Hashable {
self.skillsTotal = skillsTotal
self.mcpConfig = mcpConfig
self.skillsDir = skillsDir
+ self.signIn = signIn
+ self.signedIn = signedIn
}
@@ -4847,7 +4863,9 @@ public struct FfiConverterTypeAppAgentSettingsRow: FfiConverterRustBuffer {
skillsInstalled: FfiConverterUInt32.read(from: &buf),
skillsTotal: FfiConverterUInt32.read(from: &buf),
mcpConfig: FfiConverterOptionString.read(from: &buf),
- skillsDir: FfiConverterOptionString.read(from: &buf)
+ skillsDir: FfiConverterOptionString.read(from: &buf),
+ signIn: FfiConverterOptionString.read(from: &buf),
+ signedIn: FfiConverterBool.read(from: &buf)
)
}
@@ -4861,6 +4879,8 @@ public struct FfiConverterTypeAppAgentSettingsRow: FfiConverterRustBuffer {
FfiConverterUInt32.write(value.skillsTotal, into: &buf)
FfiConverterOptionString.write(value.mcpConfig, into: &buf)
FfiConverterOptionString.write(value.skillsDir, into: &buf)
+ FfiConverterOptionString.write(value.signIn, into: &buf)
+ FfiConverterBool.write(value.signedIn, into: &buf)
}
}
@@ -5013,6 +5033,15 @@ public struct AppAgentSetupStatus: Equatable, Hashable {
* Problem reading its config.
*/
public var error: String?
+ /**
+ * The account it signs in with on its own (`ChatGPT` for Codex), when
+ * the setup can see that sign-in.
+ */
+ public var signIn: String?
+ /**
+ * That sign-in is on this computer.
+ */
+ public var signedIn: Bool
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -5043,7 +5072,14 @@ public struct AppAgentSetupStatus: Equatable, Hashable {
*/skillsOutdated: [String],
/**
* Problem reading its config.
- */error: String?) {
+ */error: String?,
+ /**
+ * The account it signs in with on its own (`ChatGPT` for Codex), when
+ * the setup can see that sign-in.
+ */signIn: String?,
+ /**
+ * That sign-in is on this computer.
+ */signedIn: Bool) {
self.id = id
self.name = name
self.installed = installed
@@ -5053,6 +5089,8 @@ public struct AppAgentSetupStatus: Equatable, Hashable {
self.skillsInstalled = skillsInstalled
self.skillsOutdated = skillsOutdated
self.error = error
+ self.signIn = signIn
+ self.signedIn = signedIn
}
@@ -5079,7 +5117,9 @@ public struct FfiConverterTypeAppAgentSetupStatus: FfiConverterRustBuffer {
cuaConfigured: FfiConverterBool.read(from: &buf),
skillsInstalled: FfiConverterSequenceString.read(from: &buf),
skillsOutdated: FfiConverterSequenceString.read(from: &buf),
- error: FfiConverterOptionString.read(from: &buf)
+ error: FfiConverterOptionString.read(from: &buf),
+ signIn: FfiConverterOptionString.read(from: &buf),
+ signedIn: FfiConverterBool.read(from: &buf)
)
}
@@ -5093,6 +5133,8 @@ public struct FfiConverterTypeAppAgentSetupStatus: FfiConverterRustBuffer {
FfiConverterSequenceString.write(value.skillsInstalled, into: &buf)
FfiConverterSequenceString.write(value.skillsOutdated, into: &buf)
FfiConverterOptionString.write(value.error, into: &buf)
+ FfiConverterOptionString.write(value.signIn, into: &buf)
+ FfiConverterBool.write(value.signedIn, into: &buf)
}
}
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 935fd6fa4e..4c8a44478a 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -765,7 +765,6 @@ export const MERGED: Record<string, string> = {
'spaces/volume-sync': 'spaces/volume',
'spaces/devices': 'spaces/host',
'spaces/machine-health': 'spaces/host',
- 'agent-setup': 'agents',
telemetry: 'auth',
};
@@ -807,7 +806,7 @@ export const MAX_TABS = 30;
/** Groups of the reference sidebar; folders other generators own are listed by name. */
const NAV: Array<[label: string, pages: string[]]> = [
['Sandboxes', ['cua', 'sandbox', 'image', 'os-image-catalog', 'image-software', 'services', 'runtime-support']],
- ['Inside a sandbox', ['spacesd', 'agents']],
+ ['Inside a sandbox', ['spacesd', 'agents', 'agent-setup']],
['Spaces', ['spaces']],
['Account', ['auth']],
['Errors and types', [ERRORS_SLUG, TYPES_SLUG]],