diff --git a/Cargo.lock b/Cargo.lock index 4d3ae0f14..99cd7cf2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13347,7 +13347,7 @@ dependencies = [ [[package]] name = "zatex" -version = "0.3.7" +version = "0.3.5" dependencies = [ "tiny-skia", "ttf-parser", @@ -13598,7 +13598,7 @@ dependencies = [ [[package]] name = "zeron" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "clap", @@ -13623,7 +13623,7 @@ dependencies = [ [[package]] name = "zeron-audio" -version = "0.3.7" +version = "0.3.5" dependencies = [ "base64 0.22.1", "cpal 0.18.2", @@ -13635,7 +13635,7 @@ dependencies = [ [[package]] name = "zeron-cli" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "clap", @@ -13651,7 +13651,7 @@ dependencies = [ [[package]] name = "zeron-client" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -13682,7 +13682,7 @@ dependencies = [ [[package]] name = "zeron-doc" -version = "0.3.7" +version = "0.3.5" dependencies = [ "chrono", "loro", @@ -13697,7 +13697,7 @@ dependencies = [ [[package]] name = "zeron-engine" -version = "0.3.7" +version = "0.3.5" dependencies = [ "alacritty_terminal", "anyhow", @@ -13757,7 +13757,7 @@ dependencies = [ [[package]] name = "zeron-harness" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -13791,7 +13791,7 @@ dependencies = [ [[package]] name = "zeron-launch" -version = "0.3.7" +version = "0.3.5" dependencies = [ "libc", "tempfile", @@ -13800,14 +13800,14 @@ dependencies = [ [[package]] name = "zeron-markdown" -version = "0.3.7" +version = "0.3.5" dependencies = [ "pulldown-cmark", ] [[package]] name = "zeron-mcp" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -13829,7 +13829,7 @@ dependencies = [ [[package]] name = "zeron-mobile" -version = "0.3.7" +version = "0.3.5" dependencies = [ "async-trait", "serde", @@ -13856,14 +13856,14 @@ dependencies = [ [[package]] name = "zeron-mobile-bindgen" -version = "0.3.7" +version = "0.3.5" dependencies = [ "uniffi", ] [[package]] name = "zeron-notify" -version = "0.3.7" +version = "0.3.5" dependencies = [ "objc", "sha2", @@ -13872,11 +13872,11 @@ dependencies = [ [[package]] name = "zeron-orb" -version = "0.3.7" +version = "0.3.5" [[package]] name = "zeron-plugin-guard" -version = "0.3.7" +version = "0.3.5" dependencies = [ "serde_json", "tempfile", @@ -13884,7 +13884,7 @@ dependencies = [ [[package]] name = "zeron-preview" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -13914,11 +13914,11 @@ dependencies = [ [[package]] name = "zeron-preview-label" -version = "0.3.7" +version = "0.3.5" [[package]] name = "zeron-proto" -version = "0.3.7" +version = "0.3.5" dependencies = [ "chrono", "pulldown-cmark", @@ -13929,7 +13929,7 @@ dependencies = [ [[package]] name = "zeron-rpc" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -13950,7 +13950,7 @@ dependencies = [ [[package]] name = "zeron-sync" -version = "0.3.7" +version = "0.3.5" dependencies = [ "base64 0.22.1", "block2 0.6.2", @@ -13976,7 +13976,7 @@ dependencies = [ [[package]] name = "zeron-syntax" -version = "0.3.7" +version = "0.3.5" dependencies = [ "thiserror 2.0.20", "tree-sitter", @@ -14011,14 +14011,14 @@ dependencies = [ [[package]] name = "zeron-term" -version = "0.3.7" +version = "0.3.5" dependencies = [ "alacritty_terminal", ] [[package]] name = "zeron-term-link" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "async-trait", @@ -14035,7 +14035,7 @@ dependencies = [ [[package]] name = "zeron-text" -version = "0.3.7" +version = "0.3.5" dependencies = [ "core-foundation 0.10.1", "core-graphics 0.24.0", @@ -14052,7 +14052,7 @@ dependencies = [ [[package]] name = "zeron-theme" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "clap", @@ -14067,7 +14067,7 @@ dependencies = [ [[package]] name = "zeron-ui" -version = "0.3.7" +version = "0.3.5" dependencies = [ "alacritty_terminal", "anyhow", @@ -14150,7 +14150,7 @@ dependencies = [ [[package]] name = "zeron-update" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "futures", @@ -14167,11 +14167,11 @@ dependencies = [ [[package]] name = "zeron-veil" -version = "0.3.7" +version = "0.3.5" [[package]] name = "zeron-visual" -version = "0.3.7" +version = "0.3.5" dependencies = [ "base64 0.22.1", "gltf", @@ -14183,7 +14183,7 @@ dependencies = [ [[package]] name = "zeron-visual-gpu" -version = "0.3.7" +version = "0.3.5" dependencies = [ "image", "pollster 0.4.0", @@ -14194,7 +14194,7 @@ dependencies = [ [[package]] name = "zeron-voice" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "cpal 0.17.3", @@ -14213,7 +14213,7 @@ dependencies = [ [[package]] name = "zeron-voice-media" -version = "0.3.7" +version = "0.3.5" dependencies = [ "async-trait", "semver", @@ -14228,7 +14228,7 @@ dependencies = [ [[package]] name = "zeron-voice-session" -version = "0.3.7" +version = "0.3.5" dependencies = [ "async-trait", "futures", diff --git a/Cargo.toml b/Cargo.toml index 7865ac29a..2b3cdd9bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ members = [ ] [workspace.package] -version = "0.3.7" +version = "0.3.5" edition = "2024" license = "MIT" publish = false diff --git a/apps/zgx/Cargo.lock b/apps/zgx/Cargo.lock index d096e16e9..437ed1ee8 100644 --- a/apps/zgx/Cargo.lock +++ b/apps/zgx/Cargo.lock @@ -7067,7 +7067,7 @@ dependencies = [ [[package]] name = "zatex" -version = "0.3.7" +version = "0.3.5" dependencies = [ "ttf-parser", ] @@ -7233,7 +7233,7 @@ checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" [[package]] name = "zeron-cli" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "clap", @@ -7248,7 +7248,7 @@ dependencies = [ [[package]] name = "zeron-launch" -version = "0.3.7" +version = "0.3.5" dependencies = [ "libc", "windows-sys 0.61.2", @@ -7256,7 +7256,7 @@ dependencies = [ [[package]] name = "zeron-notify" -version = "0.3.7" +version = "0.3.5" dependencies = [ "objc", "sha2", @@ -7265,18 +7265,18 @@ dependencies = [ [[package]] name = "zeron-plugin-guard" -version = "0.3.7" +version = "0.3.5" dependencies = [ "serde_json", ] [[package]] name = "zeron-preview-label" -version = "0.3.7" +version = "0.3.5" [[package]] name = "zeron-proto" -version = "0.3.7" +version = "0.3.5" dependencies = [ "chrono", "pulldown-cmark 0.12.2", @@ -7287,7 +7287,7 @@ dependencies = [ [[package]] name = "zeron-theme" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "clap", @@ -7301,7 +7301,7 @@ dependencies = [ [[package]] name = "zeron-update" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "futures", @@ -7318,7 +7318,7 @@ dependencies = [ [[package]] name = "zeron-visual" -version = "0.3.7" +version = "0.3.5" dependencies = [ "base64 0.22.1", "gltf", @@ -7330,7 +7330,7 @@ dependencies = [ [[package]] name = "zeron-visual-gpu" -version = "0.3.7" +version = "0.3.5" dependencies = [ "pollster", "tracing", @@ -7340,7 +7340,7 @@ dependencies = [ [[package]] name = "zeron-voice" -version = "0.3.7" +version = "0.3.5" dependencies = [ "anyhow", "cpal", diff --git a/apps/zgx/src/agents.rs b/apps/zgx/src/agents.rs index 00506865c..af62053ae 100644 --- a/apps/zgx/src/agents.rs +++ b/apps/zgx/src/agents.rs @@ -411,24 +411,6 @@ pub fn install(host: &ScriptHost) { a.add_key(id, provider, key, name).await } }); - // An API key for Cloud's agents (Settings → Providers with Cloud - // shown): kept by the vault, authorized for the account's Cloud device - // (`device`), the key every Cloud machine uses from its next turn. - // Rejects with the engine's words, which never hold the key. - let a = agents.clone(); - host.async_action("agents.cloud_key", move |args| { - let a = a.clone(); - let provider = args.field("provider").map(text).unwrap_or_default(); - let key = args.field("key").map(text).unwrap_or_default().trim().to_string(); - let device = args.field("device").map(text).unwrap_or_default(); - async move { - crate::plugins::preview::refuse("agents.cloud_key")?; - let params = cloud_key_params(&provider, &key, &device)?; - engine::get().call("VaultPutApiKey", params).await.map_err(|error| engine::outcome(&error).to_string())?; - a.load_accounts(true).await; - Ok(Value::Nil) - } - }); // An API key's name (no secret: on whichever device shows it), rejecting // with the engine's words. let a = agents.clone(); @@ -1966,20 +1948,6 @@ fn epoch_secs(s: &str) -> Option { mod tests { use super::*; - /// A Cloud API key goes to the vault for the account's Cloud device: - /// Anthropic's or OpenAI's only, a real key, Cloud on. - #[test] - fn a_cloud_key_is_one_cloud_runs_for_its_device() { - let ok = cloud_key_params("anthropic-key", "sk-ant-123", "cloud-acct").unwrap(); - assert_eq!(ok, json!({ "provider": "anthropic-key", "key": "sk-ant-123", "authorizedDevices": ["cloud-acct"] })); - assert!(cloud_key_params("openai-key", "sk-1", "d").is_ok()); - assert!(cloud_key_params("claude", "sk", "d").is_err(), "a login isn't a key"); - assert!(cloud_key_params("anthropic-key", "", "d").is_err()); - assert!(cloud_key_params("anthropic-key", "a\nb", "d").is_err()); - assert!(cloud_key_params("anthropic-key", &"k".repeat(5000), "d").is_err()); - assert!(cloud_key_params("anthropic-key", "sk", "").is_err(), "Cloud off"); - } - /// Pi signed in to Claude, or another login put in use: Pi's models are /// looked up again. Usage moving, or another agent's, isn't Pi's change. #[test] @@ -2260,22 +2228,6 @@ pub(crate) fn shown_target() -> Option { } /// `params` addressed to the device Providers shows. -/// `VaultPutApiKey`'s params for a Cloud API key: Anthropic's or OpenAI's -/// alone, a key that's there and no longer than any key is, for the -/// account's Cloud device. Else why not. -pub(crate) fn cloud_key_params(provider: &str, key: &str, device: &str) -> Result { - if !matches!(provider, "anthropic-key" | "openai-key") { - return Err("Cloud takes Anthropic and OpenAI keys".into()); - } - if key.is_empty() || key.len() > 4096 || key.chars().any(char::is_control) { - return Err("That isn't an API key".into()); - } - if device.is_empty() { - return Err("Turn Cloud on in Settings → Cloud first".into()); - } - Ok(json!({ "provider": provider, "key": key, "authorizedDevices": [device] })) -} - pub(crate) fn addressed_to_shown(params: Json) -> Json { addressed_to(shown_target().as_deref(), params) } diff --git a/apps/zgx/ui/ds/provider_card.luau b/apps/zgx/ui/ds/provider_card.luau index 959c15355..6e3cb0f3c 100644 --- a/apps/zgx/ui/ds/provider_card.luau +++ b/apps/zgx/ui/ds/provider_card.luau @@ -221,9 +221,6 @@ export type CardProps = { -- back, Claude's when it can't finish in the browser) or "failed". foot: (string | () -> string)?, enabled: State, - -- An agent nothing here switches or updates (Cloud's: on every Cloud - -- machine, its accounts alone managed here): no switch, no Update. - fixed: boolean?, -- The account in use, by its email. active: () -> string?, settings: boolean?, @@ -1471,7 +1468,7 @@ function M.Card(c: CardProps): Node gap = "$space.3", items = "center", ui.show(function() - return not c.fixed and (latest() ~= nil or (c.updating ~= nil and c.updating())) + return latest() ~= nil or (c.updating ~= nil and c.updating()) end, Button { locale.t("ds.provider_card.update"), tone = "secondary", @@ -1491,7 +1488,7 @@ function M.Card(c: CardProps): Node on_click = c.on_settings, } else nil, - if c.fixed then nil else Switch { value = c.enabled, label = locale.t("ds.provider_card.enabled", { name = provider.name }) :: any }, + Switch { value = c.enabled, label = locale.t("ds.provider_card.enabled", { name = provider.name }) :: any }, }, } -- Its accounts, a row each, keyed: one arriving or going is that row diff --git a/apps/zgx/ui/ds/transcript.luau b/apps/zgx/ui/ds/transcript.luau index 8606ca686..50071c13c 100644 --- a/apps/zgx/ui/ds/transcript.luau +++ b/apps/zgx/ui/ds/transcript.luau @@ -1146,10 +1146,6 @@ local function Transcript(props: Props): Node -- taken meanwhile stays where it went. local function rise(prompt: Message?) ui.after(16, function() - -- (Scrolled meanwhile: the view is the reader's, see `wheeled`.) - if glides ~= turn then - return - end local row_el = prompt and tops[prompt.id] and tops[prompt.id]:peek() local list_el = list:peek() if not row_el or not list_el or row_el.y == nil or list_el.y == nil then @@ -1162,9 +1158,6 @@ local function Transcript(props: Props): Node duration = motion.ms(GLIDE_MS), ease = "outQuad", onComplete = function() - if glides ~= turn then - return - end -- Landed: the old reply lets go of the room it held -- (above the view, so nothing seen moves), and the -- offset says where the list now rests, a real place @@ -1451,18 +1444,6 @@ local function Transcript(props: Props): Node -- (Taken somewhere of their own: a place still to come back to is -- let go.) waiting = nil - -- A send's glide under way (or its prompt still to land, a steer's): - -- the scroll is theirs, so the glide stops where it is rather than - -- pulling the view back to the end. The old reply keeps the room it - -- held until it's out of view (`rested`), so nothing shown moves. - if gliding:peek() then - glides += 1 - if glide then - glide:pause() - glide = nil - end - gliding:set(false) - end return nil end -- When focus last came to something in the list (Tab, ⇧Tab to a row's @@ -1471,8 +1452,6 @@ local function Transcript(props: Props): Node -- While the width is changing (and a moment after): the reading row -- puts the place back as its lines rewrap, the frame they do. local resizing_until = 0 - -- When the view's size last changed. - local resized_at = -math.huge local function find_reading() reading = nil local el = list:peek() @@ -1554,32 +1533,9 @@ local function Transcript(props: Props): Node local function rested() remember() find_reading() - -- Resting away from the end: let go of it once no change of size is - -- under way, or at once if a person scrolled since the last one (a - -- scroll begun just after a resize is theirs; held, the next resize, - -- however much later, would pull the view back to the end). - if not at_end:peek() and (ui.now() >= resizing_until or wheeled_at >= resized_at) then + if not at_end:peek() and ui.now() >= resizing_until then end_held = false end - -- A send's glide a scroll stopped (`wheeled`): the old reply's held - -- room goes once that reply is out of view, where it moves nothing. - local h = held:peek() - if h.id ~= "" and not gliding:peek() then - local r = rows[h.id] - local row_el = r and r.outer:peek() - local el = list:peek() - local away_from_view = not row_el - or not el - or row_el.y == nil - or row_el.height == nil - or el.y == nil - or el.height == nil - or (row_el.y :: number) + (row_el.height :: number) <= (el.y :: number) - or (row_el.y :: number) >= (el.y :: number) + (el.height :: number) - if away_from_view then - held:set { id = "", h = 0 } - end - end end local rest = ui.debounced(offset, 150, { every = true }) -- (A view just made: its place told once it has stood 150 ms.) @@ -2038,8 +1994,7 @@ local function Transcript(props: Props): Node ui.after(48, settle) end if changed then - resized_at = ui.now() - resizing_until = resized_at + 300 + resizing_until = ui.now() + 300 -- At the end: on it still, every frame of the change. if end_held and not gliding:peek() then -- (Asked of the list itself, which lands it as it lays diff --git a/apps/zgx/ui/locales/en.json b/apps/zgx/ui/locales/en.json index bd46a6a85..960b2be33 100644 --- a/apps/zgx/ui/locales/en.json +++ b/apps/zgx/ui/locales/en.json @@ -1631,18 +1631,7 @@ }, "remove_row_description": "Chats that used it stay." }, - "couldnt_switch": "Couldn't switch accounts", - "cloud": "Cloud", - "cloud_keys": { - "title": "API keys", - "section_description": "Instead of signing in, Cloud can use an API key. A key saved here becomes the account its agent uses on every Cloud machine, from its next turn.", - "anthropic": "Anthropic API key", - "openai": "OpenAI API key", - "description": "For {agent} on Cloud. Kept in Zeron's vault, never on this computer.", - "placeholder": "Paste a key", - "save": "Save", - "saved": "{agent} on Cloud now uses this key" - } + "couldnt_switch": "Couldn't switch accounts" }, "devices": { "title": "Devices", diff --git a/apps/zgx/ui/locales/zh-Hans.json b/apps/zgx/ui/locales/zh-Hans.json index 27d1fe97e..1a6a00cc0 100644 --- a/apps/zgx/ui/locales/zh-Hans.json +++ b/apps/zgx/ui/locales/zh-Hans.json @@ -1631,18 +1631,7 @@ }, "remove_row_description": "使用过它的对话会保留。" }, - "couldnt_switch": "无法切换账户", - "cloud": "云端", - "cloud_keys": { - "title": "API 密钥", - "section_description": "云端也可以使用 API 密钥,而不必登录。在此保存的密钥会成为该代理在每台云端机器上使用的账户,从下一轮开始生效。", - "anthropic": "Anthropic API 密钥", - "openai": "OpenAI API 密钥", - "description": "用于云端的 {agent}。保存在 Zeron 的密钥库中,不会存放在这台电脑上。", - "placeholder": "粘贴密钥", - "save": "保存", - "saved": "云端的 {agent} 现在使用此密钥" - } + "couldnt_switch": "无法切换账户" }, "devices": { "title": "设备", diff --git a/apps/zgx/ui/screens/chat/shared.luau b/apps/zgx/ui/screens/chat/shared.luau index 53a6dba09..f16052d41 100644 --- a/apps/zgx/ui/screens/chat/shared.luau +++ b/apps/zgx/ui/screens/chat/shared.luau @@ -13,7 +13,6 @@ local Quote = require("@ds/quote") local Annotation = require("@ds/annotation") local sessions = require("@account/sessions") local agents = require("@account/agents") -local cloud = require("@account/cloud") local locale = require("@ds/locale") local toast = require("@ds/toast") local ChatLinks = require("@app/screens/chat/chat_links") @@ -1032,19 +1031,9 @@ local here_device = ui.computed(function(): string? end) -- The accounts' key for a device: "" for this one, whose engine answers --- for itself; "cloud" for any of Cloud's (a chat's machine, or the --- account's Cloud device), whose accounts are the vault's, every Cloud --- machine's alike, as Settings → Providers shows them (this engine answers --- for "cloud": crates/engine cloud_accounts). A machine can't be asked: --- its accounts aren't its own, and asking would wake it. +-- for itself. local function account_key(device: string?): string - if device == nil or device == here_device:get() then - return "" - end - if cloud.on_device(device) or device == cloud.device() then - return "cloud" - end - return device + return if device == nil or device == here_device:get() then "" else device end -- Models of Cursor's own pool (Composer, Grok), not the third-party one. diff --git a/apps/zgx/ui/screens/settings/devices.luau b/apps/zgx/ui/screens/settings/devices.luau index 06637b28c..9a88ef06c 100644 --- a/apps/zgx/ui/screens/settings/devices.luau +++ b/apps/zgx/ui/screens/settings/devices.luau @@ -169,9 +169,7 @@ local icon_of = M.icon -- choosing one calls `choose` with its id. Built once: its options follow -- the devices as they come, go and are renamed, and the choice follows -- `shown`. --- (`extra`: more choices after the computers, each `{ value, label, icon }`: --- Providers' Cloud, whose accounts every Cloud machine uses.) -function M.picker(shown: () -> string?, choose: (id: string) -> (), extra: (() -> { any })?): Node +function M.picker(shown: () -> string?, choose: (id: string) -> ()): Node local function computers(): { sessions.Device } return sessions.computers(sessions.devices:get(), true) end @@ -183,12 +181,9 @@ function M.picker(shown: () -> string?, choose: (id: string) -> (), extra: (() - end return "" end - local function extras(): { any } - return if extra then extra() else {} - end return ui.show( function(): boolean - return #computers() > 1 or #extras() > 0 + return #computers() > 1 end, ui.component(function(): Node local chosen = ui.use_state(shown() or here()) @@ -213,9 +208,6 @@ function M.picker(shown: () -> string?, choose: (id: string) -> (), extra: (() - description = if not d.here and d.online == false then ui.t("settings.devices.offline") else nil, }) end - for _, e in extras() do - table.insert(options, e) - end return options end, on_change = choose, diff --git a/apps/zgx/ui/screens/settings/providers.luau b/apps/zgx/ui/screens/settings/providers.luau index d1e13d9a3..2876379aa 100644 --- a/apps/zgx/ui/screens/settings/providers.luau +++ b/apps/zgx/ui/screens/settings/providers.luau @@ -23,7 +23,6 @@ local prefs = require("@app/screens/settings/prefs") local registry = require("@account/registry") local add_agent = require("@app/screens/settings/add_agent") local sign_in_terminal = require("@app/screens/settings/sign_in_terminal") -local cloud = require("@account/cloud") local M = {} @@ -109,20 +108,6 @@ local function here(): string? end return nil end --- Cloud, as one choice after the computers (never its machines): the --- accounts every Cloud machine uses, kept by the vault, which the engine --- answers for (crates/engine cloud_accounts: Claude Code and Codex, their --- logins and API keys). Offered while Cloud is on. -local CLOUD = "cloud" -local function on_cloud(): boolean - return now().target == CLOUD -end -local function cloud_choice(): { any } - if cloud.on() or on_cloud() then - return { { value = CLOUD, label = ui.t("settings.providers.cloud"):get(), icon = "cloud" } } - end - return {} -end -- The device shown: the engine's target, else this one. local function shown_device(): string? return now().target or here() @@ -130,9 +115,6 @@ end -- (In the locale shown: read where it's drawn.) local function device_name(): string local id = shown_device() - if id == CLOUD then - return ui.t("settings.providers.cloud"):get() - end for _, d in computers() do if d.id == id then return if d.here then ui.t("settings.providers.this_mac"):get() else d.name @@ -142,11 +124,8 @@ local function device_name(): string end local function choose_device(id: string) agents.target(if id == here() then nil else id) - -- (The registry as that device sees it: what it has added, its builds. - -- Cloud runs only Zeron's own.) - if id ~= CLOUD then - registry.load() - end + -- (The registry as that device sees it: what it has added, its builds.) + registry.load() end -- Which of the page's views shows: the agents, the registry ("add"), or @@ -173,8 +152,7 @@ local function kind(): string if s == "looking" or s == "unavailable" then return s end - -- (Cloud's page is another: its accounts, its keys, nothing to add.) - return if now().target == "cloud" then "cloud" else "found" + return "found" end -- Which agent's settings are open (none: ""). @@ -245,9 +223,6 @@ local function card(row: State): Node -- no accounts, and signs in its own way. (Its updates come as any -- agent's: the engine's update coordinator, the registry its feed.) local from_registry = (first :: any).registry == true - -- Cloud's (made for it: the cards are keyed by the device shown): on - -- every Cloud machine, its accounts alone managed here. - local cloud_card = on_cloud() -- The switch follows the engine; a flip goes to it, and its answer -- comes back in the row. local on = ui.use_state(first.enabled) @@ -259,7 +234,7 @@ local function card(row: State): Node if flipped ~= said then on:set(said) end - elseif flipped ~= said and not cloud_card then + elseif flipped ~= said then agents.set_enabled(id, flipped) end end) @@ -275,7 +250,6 @@ local function card(row: State): Node return (row:get() :: any).updating == true end, sign_in_only = from_registry, - fixed = cloud_card, login_note = function(): string? return (row:get() :: any).login_note end, @@ -355,7 +329,7 @@ local function card(row: State): Node end return nil end, - settings = not cloud_card, + settings = true, on_settings = function() load_subagents() open_settings:set(id) @@ -447,13 +421,7 @@ local function cards(): Node gap = "$space.4", ui.each(ui.computed(installed), function(_a: agents.Agent, _i: number, row: State): Node return card(row) - end, { - -- (By the device shown too: a card is made for its device, - -- Cloud's unlike a computer's.) - key = function(a: agents.Agent): string - return `{now().target or ""}|{a.id}` - end, - }), + end, { key = by_id }), } ) end @@ -522,85 +490,6 @@ local function more(): Node ) end --- Cloud's API keys: Anthropic's for Claude Code, OpenAI's for Codex, kept --- by the vault. A key saved becomes its agent's account in use, every Cloud --- machine's from its next turn (as signing in does). -local CLOUD_KEYS = { - { provider = "anthropic-key", agent = "Claude Code", label = "settings.providers.cloud_keys.anthropic" }, - { provider = "openai-key", agent = "Codex", label = "settings.providers.cloud_keys.openai" }, -} -local function cloud_key_row(k: { provider: string, agent: string, label: string }): Node - return ui.component(function(): Node - local value = ui.use_state("") - local busy = ui.use_state(false) - local problem = ui.use_state("") - local function save() - local key = value:peek() - if busy:peek() or key == "" then - return - end - busy:set(true) - problem:set("") - host.call("agents.cloud_key", { provider = k.provider, key = key, device = cloud.device() or "" }):after(function() - busy:set(false) - value:set("") - toast.show { title = ui.t("settings.providers.cloud_keys.saved", { agent = k.agent }):get(), tone = "success" } - end, function(err: any) - busy:set(false) - problem:set(if type(err) == "table" and err.message then tostring(err.message) else tostring(err)) - end) - end - return ds.Settings.Row { - label = ui.t(k.label), - description = function(): string - local p = problem:get() - return if p ~= "" then p else ui.t("settings.providers.cloud_keys.description", { agent = k.agent }):get() - end, - control = ui.row { - gap = "$space.2", - items = "center", - ds.TextField { - value = value, - password = true, - w = 220, - size = "sm", - name = ui.t(k.label), - placeholder = ui.t("settings.providers.cloud_keys.placeholder"), - on_commit = function() - save() - end, - }, - ds.Button { - ui.t("settings.providers.cloud_keys.save"), - tone = "secondary", - size = "sm", - busy = function(): boolean - return busy:get() - end, - disabled = function(): boolean - return value:get() == "" - end, - on_click = save, - }, - }, - } - end)({}) -end -local function cloud_keys(): Node - return ds.Settings.Section { - title = ui.t("settings.providers.cloud_keys.title"), - description = ui.t("settings.providers.cloud_keys.section_description"), - ds.Settings.Group { - ui.column { - w_full = true, - cloud_key_row(CLOUD_KEYS[1]), - ds.Settings.Rule(), - cloud_key_row(CLOUD_KEYS[2]), - }, - }, - } -end - local function body(k: string): Node if k == "looking" then return ds.ProviderCard.Loading() @@ -609,9 +498,6 @@ local function body(k: string): Node return device_name() end, agents.load) end - if k == "cloud" then - return ui.column { w_full = true, gap = "$space.6", cards(), cloud_keys() } - end return ui.column { w_full = true, gap = "$space.6", cards(), more() } end @@ -881,7 +767,7 @@ local function agents_page(): Node -- Agents are per device: which one's (a choice once there's more -- than this one). -- (The same choice as Plugins': screens/settings/devices.) - trail = devices_page.picker(shown_device, choose_device, cloud_choice), + trail = devices_page.picker(shown_device, choose_device), -- (At the top right, on the title's line, as Plugins' is.) trail_top = true, ui.presence(kind, body, { w_full = true, enter = { opacity = { 0, 1 }, duration = 120 }, exit = { opacity = 0, duration = 60 }, mode = "wait" }), @@ -906,10 +792,6 @@ function M.view(): Node -- (Once a visit: a hot reload doesn't ask again.) The page opens on the -- agents; the registry is looked at too, for what it has to add. visits.once("providers", function() - -- (Whether Cloud is on, for its choice.) - if cloud.now:peek().phase == "unknown" then - cloud.load() - end agents.load() registry.load() if view:peek() ~= "agents" then diff --git a/apps/zgx/ui/settings_stub.luau b/apps/zgx/ui/settings_stub.luau index 3d0e4b6e7..e68bd3ff8 100644 --- a/apps/zgx/ui/settings_stub.luau +++ b/apps/zgx/ui/settings_stub.luau @@ -432,21 +432,6 @@ end -- a switch of device shows whose. local agents = require("@account/agents") local function agents_of(target: string?): any - -- Cloud (the engine answers for it from the vault): Claude Code and - -- Codex, always installed; Codex with an account, so on. - if target == "cloud" then - local function one(id: string, name: string, mark: string, accounts: { any }): any - return { id = id, name = name, mark = mark, installed = true, can_install = false, enabled = #accounts > 0, version = nil, installing = false, login = "idle", accounts = accounts } - end - return { - state = "ready", - target = target, - list = { - one("claude-code", "Claude Code", "claude", {}), - one("codex", "Codex", "openai", { { id = "c1", email = "ada@example.com", plan = "Pro", session = 0.1, week = 0.2, active = true } }), - }, - } - end local name = if target then "Codex" else "Claude Code" local id = if target then "codex" else "claude-code" return { diff --git a/apps/zgx/ui/tests/model_accounts.test.luau b/apps/zgx/ui/tests/model_accounts.test.luau index a79be2447..3ea1abea1 100644 --- a/apps/zgx/ui/tests/model_accounts.test.luau +++ b/apps/zgx/ui/tests/model_accounts.test.luau @@ -91,33 +91,6 @@ test("a chat on another computer reads that computer's accounts", function() expect(app:state("calls")).to_contain("switch_on:box:claude-code:b2") end) --- A chat on a Cloud machine: its accounts are Cloud's, the vault's (as --- Settings → Providers shows them under Cloud), never the machine's own, --- which isn't asked (it would be woken). -test("a chat on a Cloud machine reads and switches Cloud's accounts", function() - local app = with_accounts({ - [""] = { ["claude-code"] = accounts() }, - cloud = { - ["claude-code"] = { - { id = "v1", email = "team@example.test", plan = "Max", active = true, can_switch = true, windows = { window("Week", 0.4) } }, - { id = "v2", email = "spare@example.test", plan = "Pro", active = false, can_switch = true, windows = {} }, - }, - }, - }) - app:set_state("chat_device", "cloud-f60cde46") - app:frames(10) - expect(app:state("calls")).to_contain("watch_device:cloud") - expect(string.find(app:state("calls"), "watch_device:cloud-f60cde46", 1, true)).to_be(nil) - app:click('role:button "Model"') - app:frames(30) - expect(app:tree("#model-picker-account")).to_contain("team@example.test") - app:click("#model-picker-account") - app:frames(30) - app:click('~"spare@example.test"') - app:frames(30) - expect(app:state("calls")).to_contain("switch_on:cloud:claude-code:v2") -end) - test("a computer whose accounts haven't come has neither, and is asked", function() local app = with_accounts(here(accounts())) app:set_state("chat_device", "somewhere-else") diff --git a/apps/zgx/ui/tests/providers_cloud.test.luau b/apps/zgx/ui/tests/providers_cloud.test.luau deleted file mode 100644 index b6b696335..000000000 --- a/apps/zgx/ui/tests/providers_cloud.test.luau +++ /dev/null @@ -1,77 +0,0 @@ --- Settings → Providers offers Cloud as one more choice after the computers, --- while Cloud is on: its agents' accounts (the vault's, every Cloud machine --- uses them), with no switch, no settings and nothing to install, and API --- keys to save for it. Without Cloud, no such choice. On the shell in --- ui/shell_fixture.luau, Cloud from ui/cloud_stub.luau. - -local PAGE = "#settings-page" -local NAV = "#settings-nav" - -local function shows(app: any, scope: string, text: string): boolean - return app:tree(scope):find(text, 1, true) ~= nil -end - -local function asked(app: any, entry: string): boolean - for _, c in (app:state("settings_stub_calls") :: any) or {} do - if c == entry then - return true - end - end - return false -end - -local function open(with_cloud: boolean): any - local app = mount("shell_fixture.luau") - app:resize(1200, 900) - app:frames(30) - app:command("settings_stub.sign_in") - if with_cloud then - app:command("cloud_stub.offer") - end - app:command("shell.settings") - app:frames(20) - app:click(`{NAV} >> role:tab "Providers"`) - app:frames(30) - return app -end - -test("with Cloud on, Providers offers Cloud: its agents' accounts, no switch or settings, and its API keys", function() - local app = open(true) - app:click(`{PAGE} >> role:button "Device"`) - app:frames(10) - expect(app:has('role:menuitem "Cloud"')).to_be(true) - app:click('role:menuitem "Cloud"') - app:frames(30) - expect(asked(app, "agents.target:cloud")).to_be(true) - expect(shows(app, PAGE, "Claude Code")).to_be(true) - expect(shows(app, PAGE, "Codex")).to_be(true) - expect(shows(app, PAGE, "ada@example.com")).to_be(true) - -- Nothing to switch, set or install: its accounts alone. - expect(app:has(`{PAGE} >> role:switch "Codex on"`)).to_be(false) - expect(app:has(`{PAGE} >> role:button "Codex settings"`)).to_be(false) - expect(shows(app, PAGE, "Add another agent")).to_be(false) - -- Its API keys, saved for Cloud. - expect(shows(app, PAGE, "Anthropic API key")).to_be(true) - expect(shows(app, PAGE, "OpenAI API key")).to_be(true) - app:type(`{PAGE} >> role:textbox "OpenAI API key"`, "sk-test-123") - app:frames(5) - app:click(`{PAGE} >> role:button "Save" [2]`) - app:frames(10) - expect(asked(app, "agents.cloud_key")).to_be(true) - expect(app:error()).to_be_nil() - -- Back to this computer: its agents as they were, with their switches. - app:click(`{PAGE} >> role:button "Device"`) - app:frames(10) - app:click('role:menuitem "MacBook Pro"') - app:frames(30) - expect(asked(app, "agents.target:")).to_be(true) - expect(app:has(`{PAGE} >> role:switch "Claude Code on"`)).to_be(true) - expect(shows(app, PAGE, "Anthropic API key")).to_be(false) -end) - -test("without Cloud, Providers offers no Cloud", function() - local app = open(false) - app:click(`{PAGE} >> role:button "Device"`) - app:frames(10) - expect(app:has('role:menuitem "Cloud"')).to_be(false) -end) diff --git a/apps/zgx/ui/tests/transcript_scroll_away.test.luau b/apps/zgx/ui/tests/transcript_scroll_away.test.luau deleted file mode 100644 index a4dddd99a..000000000 --- a/apps/zgx/ui/tests/transcript_scroll_away.test.luau +++ /dev/null @@ -1,84 +0,0 @@ --- Scrolled away from the end, the view stays where the person took it: it --- isn't pulled back to the end. (Nov 14: "scrolling gets stuck to the --- bottom; scroll away and it scrolls you back down".) Two ways it was: --- - a scroll during a send's glide (the prompt rising to the view's top, or --- a steer's waiting to land): the glide went on to the end over it; --- - a scroll begun within moments of the view's size changing: the end --- stayed held, and the next resize, however much later (the sidebar, a --- panel, the window), went back to it. --- On chat_fixture's `long_chat` (ui/long_chat_fixture.luau). - -local function settle(app: any) - app:wait("#never-shown", { timeout_ms = 250 }) - app:frames(10) -end - -local function offset(app: any): number - return app:state("chat.transcript.offset") -end - --- How far the view is from its end, measured by going there (which holds --- the end again: only at the close of a test). -local function from_end(app: any): number - local at = offset(app) - app:scroll("#transcript", 1e6) - app:frames(4) - return offset(app) - at -end - -local function open(): any - local app = mount("chat_fixture.luau") - app:resize(960, 700) - app:frames(20) - app:command("long_chat_sent") - app:command("go_s7") - app:frames(30) - settle(app) - return app -end - -local function send(app: any) - app:type("role:textbox", "three and one sounds like the most optional option") - app:key("Enter") -end - -local function scroll_up(app: any) - for _ = 1, 10 do - app:wheel("#transcript", { dy = -40 }) - app:frames(1) - end -end - -test("scrolled up while a send glides, the view stays where it was taken", function() - local app = open() - send(app) - app:frames(3) - scroll_up(app) - settle(app) - settle(app) - expect(from_end(app) > 100).to_be(true) -end) - -test("scrolled up just after a resize, a later resize leaves the view where it was", function() - local app = open() - send(app) - app:frames(40) - settle(app) - for _ = 1, 60 do - app:command("long_chat_streams") - app:frames(2) - end - app:frames(10) - app:resize(940, 700) - app:frames(2) - scroll_up(app) - -- (It rests inside the resize's moment, then a while.) - settle(app) - app:wait("#never-shown", { timeout_ms = 800 }) - local at = offset(app) - app:resize(900, 700) - app:frames(10) - settle(app) - expect(math.abs(offset(app) - at) < 1).to_be(true) - expect(from_end(app) > 100).to_be(true) -end) diff --git a/crates/update/src/lib.rs b/crates/update/src/lib.rs index 067653bbd..d698dbe58 100644 --- a/crates/update/src/lib.rs +++ b/crates/update/src/lib.rs @@ -1248,11 +1248,10 @@ fn on_cloud() -> bool { on_cloud_platform(std::env::var("ZERON_DEVICE_PLATFORM").ok().as_deref()) } -/// Release files a Cloud machine never runs: none. (`zeron-engine` was here -/// until 2026-11-15, when `zeron headless` linked the engine. Since 0.3.0 the -/// release's `zeron` is the zgx app, whose `zeron headless` runs the -/// `zeron-engine` beside it: a machine without it never came online.) -pub const CLOUD_UNUSED_FILES: &[&str] = &[]; +/// Release files a Cloud machine never runs: the desktop app's background +/// engine (78 MB). A Cloud machine runs `zeron headless`, which links the +/// engine, and its disk is copied back in on every wake. +pub const CLOUD_UNUSED_FILES: &[&str] = &["zeron-engine"]; /// Remove [`CLOUD_UNUSED_FILES`] from the version folder `dir`. pub fn strip_cloud_unused(dir: &Path) { @@ -3693,11 +3692,9 @@ mod tests { assert_eq!(folders(&app_root), ["0.2.10", "0.2.11", "0.2.12", "current"]); } - /// `zeron headless` runs the `zeron-engine` beside it: a Cloud machine - /// keeps it in every version (it once left it out, and never came online). #[cfg(unix)] #[test] - fn a_cloud_machine_keeps_the_engine_its_headless_runs() { + fn a_cloud_machine_keeps_no_desktop_engine() { let tmp = tempfile::tempdir().unwrap(); let app_root = tmp.path().join("app"); versions_installed(&app_root, &["0.2.10", "0.2.11"]); @@ -3711,7 +3708,7 @@ mod tests { strip_unused_from_versions(&app_root); for ver in ["0.2.10", "0.2.11"] { - assert!(app_root.join(ver).join("zeron-engine").exists(), "{ver}"); + assert!(!app_root.join(ver).join("zeron-engine").exists(), "{ver}"); assert!(app_root.join(ver).join("zeron").exists(), "{ver}"); } assert!(app_root.join("notes").join("zeron-engine").exists()); @@ -4172,11 +4169,11 @@ mod tests { assert!(staged.join("zeron").is_file()); } - /// The release carries `zeron-engine`, which `zeron headless` runs: a - /// Cloud machine stages it as anywhere else does. + /// The release carries the desktop's background engine; a Cloud machine + /// stages the release without it, anywhere else keeps it. #[cfg(unix)] #[tokio::test] - async fn a_cloud_machine_stages_a_release_with_its_engine() { + async fn a_cloud_machine_stages_a_release_without_the_desktop_engine() { let tmp = tempfile::tempdir().unwrap(); let pkg = tmp.path().join("pkg"); std::fs::create_dir_all(pkg.join("zeron-pkg")).unwrap(); @@ -4193,7 +4190,7 @@ mod tests { .into(), ..Manifest::default() }; - for (cloud, kept) in [(true, true), (false, true)] { + for (cloud, kept) in [(true, false), (false, true)] { let app_root = tmp.path().join(format!("app-{cloud}")); std::fs::create_dir_all(&app_root).unwrap(); let (base, server) = serve_forever(bytes.clone()).await; diff --git a/crates/update/tests/update_transaction.rs b/crates/update/tests/update_transaction.rs index 882ab5210..3a50d6bb3 100644 --- a/crates/update/tests/update_transaction.rs +++ b/crates/update/tests/update_transaction.rs @@ -489,7 +489,7 @@ mod versioned { let mut rig = Rig::new("ok"); rig.platform = platform; rig.install_old(&["0.8.0", "0.9.0"]); - // The engine `zeron headless` runs, as the release ships it. + // The desktop's background engine, as the release ships it. for version in ["1.0.0", "2.0.0"] { std::fs::write(rig.app.join(version).join("zeron-engine"), "desktop").unwrap(); } @@ -497,9 +497,12 @@ mod versioned { rig.run_until_settled(); rig.assert_updated(&id); rig.app_settles_to(expected); - // Kept everywhere, Cloud too: `zeron headless` runs it (a Cloud - // machine once left it out, and never came online). - assert!(rig.app.join("2.0.0/zeron-engine").exists(), "platform {platform:?}"); + // A Cloud machine never runs it, and copies it back in on every wake. + assert_eq!( + rig.app.join("2.0.0/zeron-engine").exists(), + platform.is_none(), + "platform {platform:?}" + ); } } diff --git a/docs/design/cloud-device.md b/docs/design/cloud-device.md index 994867f73..df22d29af 100644 --- a/docs/design/cloud-device.md +++ b/docs/design/cloud-device.md @@ -431,12 +431,12 @@ machine (`ZERON_DEVICE_PLATFORM=cloud`) keeps none of them: going back there is downloads anyway. Other Linux installs keep the newest older one, to go back to by hand. Never `current`, the running executable's folder, or a newer version (an update being staged). -A Cloud machine keeps the release's `zeron-engine` (78 MB). From 2026-11-07 to 2026-11-15 the -installer, the updater and the tidy left it out, when the unit's `zeron headless` linked the engine; -since 0.3.0 the release's `zeron` is the zgx app, whose `zeron headless` runs that `zeron-engine`, so -a machine without it exited at once and never enrolled. The installer keeps it now, and a repair -(`~/.zeron/repair-engine`, the unit's `ExecStartPre=-`, set up by the installer and every wake) puts -it back before each start if an older updater left it out (edge/src/cloud/install-script.ts). +A Cloud machine doesn't keep the release's `zeron-engine` either: it's the desktop app's background +engine (78 MB), and the unit runs `zeron headless`, which links the engine. The installer and the +updater leave it out, and the tidy and the pre-sleep cleanup remove it from versions installed before. +Measured on staging (send to first output, n=8 each), a machine on one version went from a median of +17.5 s to 14.2 s once neither it nor Codex's downloads came back with each wake; its wake downloaded +225 MB, 205 of them the engine it runs. A longer wake reads as updating: the engine says so (`POST /runner/wake-stage`), `CloudSession.stage` is `updating` while it lasts (a stage nobody clears stops showing after 10 minutes), the desktop's