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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog

Newest first. Each release also has fuller notes in `docs/vX.Y.Z.md`.

## 0.13.0

Agents can use a person's Copper for iOS through the cloud ([notes](docs/v0.13.0.md)). One new
migration (`0016_device_agent`); upgrading from 0.12.x is a binary swap.

- **Device agent relay** (`/v1/info` feature `device_agent`, [api.md](docs/api.md#device-agent-relay)):
- device side (gate + session): `POST`/`GET /v1/me/links`, `GET`/`DELETE /v1/me/links/{id}`,
the SSE mailbox `GET /v1/me/links/{id}/frames` and its upload
`POST /v1/me/links/{id}/frames` (body up to 32 MiB), agent tokens
`POST`/`GET /v1/me/agent-tokens` and `DELETE /v1/me/agent-tokens/{id}`;
- agent side (no gate header, `Authorization: Bearer cat_…`): `GET /v1/agent/status` and
`POST /v1/agent/mcp` — MCP Streamable HTTP (stateless) with JSON or SSE answers, 10 s
keepalive comments, progress notifications, `cancel` to the device on a 200 s deadline or
when the agent goes away, and an immediate answer when Copper is not open; 600
requests/minute per token.
- Deleting a device (`DELETE /v1/devices/{id}`, admin API too) turns off its link and agent
tokens.
- New metrics: `device_agent_streams`, `device_agent_calls_total{status}`,
`agent_rate_limited_total`; one `agent call` log line per call, never arguments or results.

## 0.12.0 and earlier

See [v0.12.0](docs/v0.12.0.md) · [v0.11.1](docs/v0.11.1.md) · [v0.11.0](docs/v0.11.0.md) ·
[v0.10.0](docs/v0.10.0.md) · [v0.9.0](docs/v0.9.0.md) · [v0.8.1](docs/v0.8.1.md) ·
[v0.8.0](docs/v0.8.0.md) · [v0.7.0](docs/v0.7.0.md) · [v0.6.0](docs/v0.6.0.md) ·
[v0.5.0](docs/v0.5.0.md) · [v0.4.0](docs/v0.4.0.md) · [v0.3.0](docs/v0.3.0.md).
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
]

[workspace.package]
version = "0.12.0"
version = "0.13.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/copper-browser/copper-cloud"
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ People can join with **company single sign-on** (Google Workspace or any OpenID
provider): share one `https://HOST/start` page, they install Copper and click *Continue with
Google* — no account to create, no password ([docs/sso.md](docs/sso.md)). **Agent
integrations** let a trusted service pair headless Coppers (e.g. one per bot) to its owners'
accounts ([docs/sso.md](docs/sso.md#agent-integrations)).
accounts ([docs/sso.md](docs/sso.md#agent-integrations)). The **device agent relay** lets an
agent (any MCP client) use a person's Copper for iOS while it is open on their screen, through
`/v1/agent/mcp` with a token the phone mints ([docs/api.md](docs/api.md#device-agent-relay)).

## Install on a VM (Ubuntu 22.04/24.04, Debian 12, Amazon Linux 2023, Fedora)

Expand All @@ -33,7 +35,7 @@ curl -fsSL https://raw.githubusercontent.com/copper-browser/copper-cloud/main/in
or from a release tarball:

```sh
tar xzf copper-cloud-0.12.0-linux-x86_64.tar.gz && sudo ./install.sh
tar xzf copper-cloud-0.13.0-linux-x86_64.tar.gz && sudo ./install.sh
```

The installer sets up Postgres (unless you pass `DATABASE_URL`), a `copper-cloud` system user,
Expand Down Expand Up @@ -133,6 +135,7 @@ All commands take `--config PATH` (default `/etc/copper-cloud/copper-cloud.toml`

- [Architecture](docs/architecture.md) — components, data model, request path
- [HTTP API](docs/api.md) — every endpoint with requests and responses
- [Changelog](CHANGELOG.md) — what changed in each release
- [Admin API](docs/admin-api.md) — the admin portal's `/admin/api/*` contract
- [Addons](docs/addons.md) — slot addons: manifest, bundles, who gets what, API, CLI, security
- [Canvas link](docs/canvas-link.md) — how canvases are served by a linked Canvas Cloud:
Expand All @@ -147,7 +150,7 @@ All commands take `--config PATH` (default `/etc/copper-cloud/copper-cloud.toml`
- [Operations](docs/operations.md) — doctor, logs, metrics, backups, upgrades
- [Onboarding a team](docs/onboarding.md) — single sign-on first, link codes, people, keeping links valid
- [Single sign-on + agent integrations](docs/sso.md) — Google / OIDC setup, `/start`, agent pairing
- [v0.12.0 release notes](docs/v0.12.0.md) · [v0.11.1](docs/v0.11.1.md) · [v0.11.0](docs/v0.11.0.md) · [v0.10.0](docs/v0.10.0.md) · [v0.9.0](docs/v0.9.0.md) · [v0.8.1](docs/v0.8.1.md) · [v0.8.0](docs/v0.8.0.md) · [v0.7.0](docs/v0.7.0.md) · [v0.6.0](docs/v0.6.0.md) · [v0.5.0](docs/v0.5.0.md) · [v0.4.0](docs/v0.4.0.md) · [v0.3.0](docs/v0.3.0.md)
- [v0.13.0 release notes](docs/v0.13.0.md) · [v0.12.0](docs/v0.12.0.md) · [v0.11.1](docs/v0.11.1.md) · [v0.11.0](docs/v0.11.0.md) · [v0.10.0](docs/v0.10.0.md) · [v0.9.0](docs/v0.9.0.md) · [v0.8.1](docs/v0.8.1.md) · [v0.8.0](docs/v0.8.0.md) · [v0.7.0](docs/v0.7.0.md) · [v0.6.0](docs/v0.6.0.md) · [v0.5.0](docs/v0.5.0.md) · [v0.4.0](docs/v0.4.0.md) · [v0.3.0](docs/v0.3.0.md)

## Development

Expand Down
1 change: 1 addition & 0 deletions crates/copper-cloud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ reqwest.workspace = true
tokio-tungstenite.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing-subscriber.workspace = true
uuid.workspace = true
zip.workspace = true
40 changes: 40 additions & 0 deletions crates/copper-cloud/migrations/0016_device_agent.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Device agent relay (copper-cloud 0.13.0; see docs/api.md "Device agent relay").
--
-- An agent (any MCP client) calls the tools of a person's Copper for iOS through the cloud: the
-- phone registers a link with its tool manifest and holds an SSE mailbox open while Copper is
-- on screen; the agent presents a `cat_…` token the phone minted. Which link is online and the
-- calls in flight live in memory (one daemon per instance), never here.

-- One link per (user, device). `tools` is the manifest the device last registered (a JSON
-- array, ≤ 100 entries, ≤ 256 KiB), served to agents by `tools/list` even while the phone is
-- closed. Revoking (or deleting the device) sets `revoked_at`; registering again clears it and
-- keeps the id. No foreign key to `devices`, so a revoked link outlives its device row.
CREATE TABLE device_links (
id uuid PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
device_id uuid NOT NULL,
label text NOT NULL CHECK (length(label) BETWEEN 1 AND 200),
client_version text CHECK (client_version IS NULL OR length(client_version) <= 64),
tools jsonb NOT NULL DEFAULT '[]'::jsonb CHECK (jsonb_typeof(tools) = 'array'),
created_at timestamptz NOT NULL DEFAULT now(),
last_seen_at timestamptz,
revoked_at timestamptz,
UNIQUE (user_id, device_id)
);

-- Agent tokens: `cat_` + 32 random bytes base64url, minted by a device for one agent and bound
-- to that user and device. Only SHA-256(token) is stored; the token is shown once. Deleting the
-- device revokes them.
CREATE TABLE agent_tokens (
id uuid PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
device_id uuid NOT NULL,
label text NOT NULL CHECK (length(label) BETWEEN 1 AND 100),
token_sha256 bytea NOT NULL UNIQUE CHECK (length(token_sha256) = 32),
created_at timestamptz NOT NULL DEFAULT now(),
last_used_at timestamptz,
revoked_at timestamptz
);

CREATE INDEX agent_tokens_user_idx ON agent_tokens (user_id, created_at DESC);
CREATE INDEX agent_tokens_device_idx ON agent_tokens (user_id, device_id) WHERE revoked_at IS NULL;
9 changes: 8 additions & 1 deletion crates/copper-cloud/src/admin_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,11 +1174,17 @@ async fn delete_device(
.execute(&mut *tx)
.await?;
}
let detail = if let [user] = users.as_slice() {
// Its device-agent link and agent tokens are turned off with it.
let agent = copper_cloud_core::device_agent::revoke_device(&mut tx, &users, id).await?;
let mut detail = if let [user] = users.as_slice() {
json!({ "user_id": user })
} else {
json!({ "user_ids": users })
};
if !agent.is_empty() {
detail["revoked_agent_links"] = json!(agent.links.len());
detail["revoked_agent_tokens"] = json!(agent.tokens.len());
}
audit(
&mut *tx,
s.admin_id,
Expand All @@ -1188,6 +1194,7 @@ async fn delete_device(
)
.await?;
tx.commit().await?;
agent.apply(&state.device_agent);
Ok(Json(json!({ "ok": true, "deleted": users.len() })))
}

Expand Down
Loading
Loading