HanzoHIPs
Back to HIPs
HIP-1350DraftStandards TrackInfrastructure

Linked Sources — Desktops and Browsers, Provider Accounts, Usage and Routing for Hanzo Dev

Hanzo AI
Created: 2026-11-20
Requires: HIP-0026, HIP-0106, HIP-0114, HIP-1330

HIP-1350: Linked Sources — Desktops and Browsers, Provider Accounts, Usage and Routing for Hanzo Dev

Abstract

The Hanzo browser extension is a second kind of source. If the user is signed in to an AI web product in that browser, the extension registers as a linked browser in the same registry, with the same heartbeat, the same usage model and the same routing. There is one registry, not two; kind is desktop or browser. Wherever this document says desktop, the rule holds for a browser unless Browser sources says otherwise.

A developer installs the Hanzo Dev desktop app, links their other AI accounts there, and links the desktop to their Hanzo account through Hanzo IAM. Hanzo cloud then knows each linked desktop, what providers it can reach, and what it used. When the developer codes at hanzo.app/dev they pick where a session runs: a linked desktop, a cloud cell with an API key held in Hanzo KMS, or a cell on Hanzo's own models.

Four nouns, one owner each, all under /v1/sources on api.hanzo.ai, served over ZAP (HIP-0114); the HTTP and OpenAPI forms are projections of the same typed ops.

NounMeaningWhere it lives
SourceOne linked place the user's AI accounts live: a desktop (installed Dev app) or a browser (the Hanzo extension), linked to one IAM usercloud registry row
Provider accountA login or key the user holds with a provider, by referencecloud row (reference), desktop (login), KMS (key)
UsageWhat a desktop reports about runs on its providerscloud, per user and org
RouteWhich desktop or key a web session executes through/v1/dev session field

Specification

The sections below define the normative credential boundary, provider routing policy, source registry, usage reporting, and session routing across linked desktops and browsers.

The one rule: credentials do not move

A subscription login (an OAuth token or CLI session for a consumer plan) stays on the desktop that created it. It is never sent to cloud, never stored in KMS, never copied to another device. The cloud holds a reference (desktop id + provider instance id) and a state (ready, needs_login, limited).

A key (an API key from a model provider) is written once, from the desktop or the web, to Hanzo KMS at kms://orgs/<org>/users/<sub>/providers/<provider>/<id>. The registry row stores that path and nothing else. The value is read by the /v1 gateway at call time and is not returned by any op, including to its owner.

A web session could in principle "run on my desktop's login" by sending the turn to the desktop, where the provider's official client, logged in as the user, executes it; the credential still never moves. That is the only relay this HIP defines, and it is enabled per provider only where the provider's terms allow it. Today none do (see Provider policy), so every subscription login is local.

Provider policy

Each provider has one route class, set by Hanzo from the provider's terms (below) and enforced by cloud, not chosen by the client.

ClassMeaning
desktopMay run a web session on the linked desktop, executed by the provider's official client on that machine. Token never leaves.
localRuns only in the desktop app itself. Not offered to web sessions.
keyRuns from the user's API key in KMS, in a cell or via the gateway, from any session.

A provider can carry several: a user's Anthropic API key is key; the same user's Claude subscription is local. The table is data in apps/source/policy.go and in the Dev desktop's provider catalog, and a change is a HIP amendment.

Terms were read from each provider's own pages (November 2026), for two different patterns. Relaying a subscription (token or session leaves the device, or a service calls the provider with it) is permitted by no provider and forbidden by Anthropic and Google; it is not built. Remote control is the user's own machine running the provider's unmodified official client under the user's own login, started from another of the same user's surfaces; the credential never leaves the machine. That is what class desktop means.

ProviderSubscription loginAPI key in KMSBasis
Anthropic Claude Codelocal, desktopkeyAnthropic ships Remote Control (the session runs locally, the web is "a window into" it) and says its rules do not prevent a user signing in to the unmodified binary with their own plan (code.claude.com/docs/en/remote-control, /legal-and-compliance). Its pages also bar third parties routing plan credentials or intermediating tokens, and its consumer terms bar bots and scripts; the texts conflict on headless use, so Hanzo drives only the unmodified claude binary, never the token. Written confirmation is sought before this leaves Draft.
OpenAI Codex / ChatGPTlocal, desktopkeyOpenAI ships Codex remote from the ChatGPT phone app; credentials and files "stay on the machine where Codex is operating" (openai.com/index/work-with-codex-from-anywhere). auth.json is never moved.
GitHub Copilot CLIlocal, desktopnoneGitHub ships copilot --remote steering from mobile and web for the same account (docs.github.com copilot-cli steer-remotely).
Google Gemini CLI / AntigravitylocalkeyThird-party tools on subscription access are a stated violation; whether a controller of the official binary counts is unanswered (unclear, off).
Cursorlocalnot foundagent -p exists; no remote feature or wrapper rule found (unclear, off).
AWS KirolocalkeyHeadless needs an API key, not the login (unclear, off).
xAI Groklocalkey (verify)No primary text found (off).
OpenCode, Pilocalinherits upstreamThird-party harnesses; they inherit the provider's rule (off).
Anthropic, OpenAI, Gemini, xAI API; OpenRoutern/akeyPer-user custody, billed to the key owner; never pooled across users, never resold.

A provider's classes are fail-closed: one not in this table is local. Browser logins are local only (view-only, below). Hanzo's own models (Zen) are cell and need no account.

Conditions on every desktop route, enforced in cloud and on the desktop: the caller is the source's owner (never another user, never an org admin); the source is the caller's own and online; the provider instance is ready and Share with my other surfaces is on for it on that device (a local setting reported in the heartbeat as shared; default on for the owner's own surfaces, meaning the same IAM principal, for the providers that allow remote control, default off for every other provider, and the user can turn it off; a run from any other principal is refused); one routed run per login instance at a time; no pooling across users or accounts; every dispatch audited. The desktop starts only the unmodified official client and never hands out its token, auth.json or session.

A route is chosen by the user's own action: a turn starts when the user presses send.

Registry

Sign-in and token verification

Sign-in and billing live at https://hanzo.ai. A client sends the person to https://hanzo.ai/login and nothing else names an identity host. Neither the login host nor the issuer is hard-coded: a client reads https://hanzo.ai/.well-known/openid-configuration and takes the issuer, authorization_endpoint, token_endpoint and jwks_uri from it (the issuer is https://hanzo.id today and may change). Cloud verifies a bearer against the issuer and JWKS from that same discovery document (cached with a TTL, last good copy kept), through the identity boundary every /v1 app already uses; source.v1 adds no verifier of its own. The Hanzo IAM remains the only identity.

Link

The desktop signs the user in (device code or loopback PKCE, already in Dev's CliTokenManager, against the discovered endpoints), then:

POST /v1/sources
{ "kind": "desktop", "name": "Zach's MacBook", "os": "darwin", "arch": "arm64", "version": "1.8.4",
  "key": "<ed25519 public key, base64url>", "zap": "https://…" }
→ 201 { "id": "src_…", "interval": 30, "level": "metadata" }
  • Identity is the validated IAM token. owner (org) and subject (user) come from it, never from the body. A machine token is refused.
  • key is the desktop's own device key. Later relay and usage calls are signed with it, so a stolen IAM token alone does not impersonate a linked desktop.
  • zap is the desktop's reachable ZAP endpoint (its Connect tunnel), used exactly as given by the machine DevRuntime. Optional: a desktop with no tunnel is registered and not routable.
  • Idempotent on (subject, key): relinking the same install returns the same id.
  • Cap: 25 active sources per user.

List, read, revoke

GET    /v1/sources          the caller's sources, newest heartbeat first
GET    /v1/sources/{id}
DELETE /v1/sources/{id}     revoke

Only the owner reads or revokes. An org admin sees counts in the org view (Usage), not another person's desktop rows, and a SuperAdmin (owner == "admin") has no extra read. Revoke sets revoked_at, drops routes through it, and is audited. The next heartbeat from a revoked desktop answers 410, on which the desktop forgets the link. Revoke is also offered from the desktop and from hanzo.app.

Heartbeat

POST /v1/sources/{id}/heartbeat
{ "at": "2026-11-20T10:00:00Z", "version": "1.8.4", "zap": "https://…",
  "providers": [ { "provider": "claude", "instance": "claude-1", "kind": "login",
                   "state": "ready", "plan": "max", "shared": false } ],
  "busy": 0 }
→ 200 { "interval": 30, "level": "metadata", "revoked": false }
  • Interval 30 s. Online means a heartbeat in the last 90 s; otherwise offline. Neither is an error, and a laptop that sleeps is simply offline.
  • providers is state only: provider, instance id, kind, state, plan label. No token, no email, no key material.
  • The reply carries the usage level the user chose (below) so cloud and desktop cannot disagree about what is sent.
  • Heartbeats are signed by the device key; unsigned or mis-signed answers 401.

ZAP service

One service, source.v1, on cloud's ZAP port; HTTP is its projection.

Link(LinkRequest) → Source
List() → [Source]
Get(id) → Source
Revoke(id) → Ok
Heartbeat(id, Beat) → BeatReply
Report(id, UsageBatch) → Ok            (slice 3)
Dispatch(id, Route) → stream Frame     (slice 4; see Routing)

Desktop wire type:

Source { id, kind: desktop|browser, name, os, arch, version, state: online|offline|revoked,
          last_seen, linked_at, zap?, providers: [ProviderState] }

Storage is the per-tenant SQLite store every cloud app uses: table sources (owner, subject, id, name, os, arch, version, key, zap, last_seen, linked_at, revoked_at) and source_providers (id, instance, kind, state, plan). No secret column exists.

Browser sources

The extension (~/work/hanzo/extension, packages/browser) already reaches the user's computer over native ZAP (hanzo-zap-host). As a source it does three things and no more:

  1. Register. The user signs in from the extension (PKCE in a browser tab opened at https://hanzo.ai/login, endpoints from discovery); the extension keeps a device key in chrome.storage.local/browser.storage.local and calls POST /v1/sources with kind: "browser", os set to the browser name and version, and zap omitted unless a Connect tunnel exists. Idempotent on (subject, key).
  2. Heartbeat. Same call and cadence as a desktop. providers lists which AI web products the browser is signed in to: { provider: "chatgpt", instance: "<profile>", kind: "login", state: "ready" | "needs_login", plan?: "plus" }, derived from page state the user already has open (a signed-in marker the extension checks), never from cookies, tokens or page content. Nothing is sent when no AI product is signed in.
  3. Report usage. Metadata records for each run the user starts through the browser: provider, window run, duration, outcome, and token counts only where the product's page shows them. No prompt, no reply, no URL beyond the provider name.

A browser source is never a key source and never holds one. It is not routable: Hanzo Dev does not submit prompts into a signed-in AI web page. Read from each product's own terms (November 2026), driving a consumer web UI by script or extension is barred (it is "automated or non-human access") for ChatGPT, Claude.ai, Perplexity and Cursor, and nothing was found that permits it for Gemini, Grok or Copilot. So every browser login is class local: the browser source gives the user visibility (which products are signed in, usage the user generates by hand in the page) and nothing else. Work the user wants run through a provider goes through their API key (key) or a desktop's official client.

Web productDriven by extension?Basis
ChatGPTnoBars programmatic extraction, circumventing limits, making the account available to others (openai.com/policies/terms-of-use)
Claude.ainoBars access "through automated or non-human means, whether through a bot, script, or otherwise" except an API key (anthropic.com/legal/consumer-terms)
PerplexitynoBars bots and automation software (perplexity.ai/hub/legal/terms-of-service)
Cursor webnoBars scraping and extraction (cursor.com/terms-of-service)
Geminino (unclear; unread policy)Google terms bar automated access against machine-readable rules; Prohibited Use Policy not reviewed
Grokno (unread)xAI terms not retrievable
Copilot chatno (unread)One person per login; Section J not reviewed

A provider may be moved to a routable class only by a HIP amendment citing written permission from that provider.

Provider accounts

GET    /v1/sources/accounts
POST   /v1/sources/accounts            { provider, kind: "key", label, value }
→ 201 { id, provider, kind, label, fingerprint, created }   (fingerprint = first 8 hex of sha256 of the value; value never returned)
DELETE /v1/sources/accounts/{id}

A login account is created by the desktop's heartbeat (it appears when the user logs in there and disappears when they log out); users cannot create one from the web. A key account is created by POST with value: cloud seals it to KMS, stores { id, provider, label, key_ref, created } and zeroes the buffer. value appears in no response, log, trace or audit field. Deleting an account deletes the KMS secret first, then the row. A provider key is org-scoped by KMS path with the user's subject in it; nobody else in the org can resolve it.

Usage

What is reported

Default level metadata. The report is the Dev desktop's typed usage model, unchanged (packages/usage/src/schema.ts, @hanzodev/usage), so desktop, extension and cloud share one definition:

UsageReport { version: 1, deviceId, from, to, cost: [CostDay], snapshots: [ProviderSnapshot] }
CostDay { day, provider, model, inputTokens, outputTokens, cacheTokens, costUsd? }
ProviderSnapshot { provider, fetchedAt, source: oauth|api|local|cookies|none, plan?, account?,
                   windows: [UsageWindow], credits?: Credits, status?: ProviderStatus, error? }
UsageWindow { kind: session|daily|weekly|monthly|credits|other, label, usedPercent,
              windowMinutes?, resetsAt? }
Credits { currency, balance?, spent?, limit? }

deviceId is the source's registry id (src_…). The schema has no field for a prompt, reply, file path, repository, branch, diff or command, and the transport adds none. Two fields carry free text and are constrained at metadata: account must be absent (the reporter strips it; cloud rejects a non-empty value), and error is a short code (^[a-z0-9_.-]{1,64}$). status.description and incident names are public provider status text, capped at 200 characters. A payload that breaks a rule is rejected whole with 400, never trimmed. cost is per day, so cloud can count tokens and spend without learning a run.

POST /v1/sources/{id}/usage        body: UsageReport
header x-hanzo-sig: ed25519 by the device key, unpadded base64url, over
       "hanzo-source-usage/1\n" + id + "\n" + lowercase-hex(sha256(body)) + "\n"
→ 200 { "accepted": <records> }    410 when revoked, 401 on a bad signature

Idempotent: cost rows replace by (source, day, provider, model) and snapshots by (source, provider), so a resend never double counts. At most one report per source per 10 s and 1 MiB.

Level metadata+content is a per-source opt-in the user turns on. Content goes to the user's own Space (HIP-1337), readable only by them, deleted when they turn the level off or revoke the source. It is never aggregated and never visible to an org admin. Not built.

The user sees exactly what is sent

The desktop writes every batch to a local outbox before sending, and the "Linked to Hanzo" screen has a "What is reported" view that renders the outbox verbatim: the exact JSON, last 100 batches, with sent/pending state and a "Send nothing" switch. The reply level is shown next to it. What the user reads is the bytes that left.

One view

hanzo.app and the Hanzo desktop app render the same view: every linked source (desktops and browsers), its state, and its usage by provider and window, from GET /v1/sources and GET /v1/sources/usage. There is no second list for browsers.

Aggregation

GET /v1/sources/usage?by=source|provider|model|user&from=&to=
→ { "rows": [ { "key", "inputTokens", "outputTokens", "cacheTokens", "costUsd" } ],
    "snapshots": [ ProviderSnapshot & { "sourceId" } ] }

For the caller: their own rows and the latest snapshot per (source, provider). For an org admin, by=user returns per-user totals only (key is the user subject); no admin read reaches another user's sources, snapshots, plans or labels, and a SuperAdmin has no extra read. Aggregate storage is source_cost(owner, subject, source, day, provider, model, …) and source_snapshot(owner, subject, source, provider, json).

Routing

A /v1/dev session (HIP-1330) gets an execution field:

{ "via": "cell" }                                    default, cloud cell on Zen
{ "via": "key",     "account": "<provider account id>" }
{ "via": "desktop", "desktop": "<id>", "provider": "<instance id>" }

desktop resolves in the registry: the desktop must be the caller's, not revoked, online, have a zap endpoint, report the provider instance ready, and the provider's class must include desktop. Anything else is refused up front with the reason, never silently falling back to another credential. The machine DevRuntime (apps/web/src/embed/runtime.ts) is the resolved target: ZAP over WebTransport, the user's IAM bearer as cap, no new transport. POST /v1/sources/{id}/dispatch {provider, instance} is only the lookup-and-policy step that returns that runtime's endpoint; frames flow browser to desktop, not through cloud. key is resolved by the gateway from KMS at call time for the session's model calls.

The session's usage is reported by the executing side: a desktop reports its own, the gateway meters key and cell.

One view, one picker, four surfaces

People see and use their accounts along one chain: Hanzo extension, Hanzo desktop/Dev, hanzo.app, hanzo.team and hanzo.bot. There is one shared component package, @hanzo/sources (in hanzoai/app, pkg/sources): the sources view, the account picker, the cloud client and the pure availability logic. The extension popup, the desktop Settings, hanzo.app, hanzo.team and hanzo.bot mount it; none keeps a copy. The source of truth is /v1/sources and source.v1 and nothing else.

See. Every source and every provider account it detects shows in all surfaces with plan, usage windows, credits and state, labelled on <device name>.

Use. The picker lists the user's accounts and, for the current surface, whether each is usable. Availability is one pure function of (account, its source, the surface, the account's classes from cloud):

AccountUsable onOtherwise (greyed, with this reason)
keyevery surface that runs sessionsextension: "Runs from Hanzo Dev or hanzo.app"
login, device is this surfaceyes
login with desktop, shared, source onlineweb surfaces: "Run on <device>""Turn on Share on <device>" / "<device> is offline"
login with only localits own device"Stays on <device>: its terms do not allow remote use"
browser loginnever"Browser accounts are view-only"
revoked or unsupported sourcenever"<device> was unlinked"

Desktop UI

Settings → "Linked to Hanzo".

  1. Status. "Linked as z@hanzo.ai · org Hanzo", this desktop's name (editable), online dot, last heartbeat. Button: Unlink this desktop. Not linked: one button, "Link to Hanzo", which runs IAM sign-in.
  2. Your desktops. Every linked desktop with online/offline and last seen; Revoke on each, confirmed.
  3. Providers on this desktop. One row per instance: provider, plan, state, and a route chip: This desktop only, Available on hanzo.app, or API key. Chips are read-only for local, a toggle for desktop.
  4. API keys. Add a key; it is sent to KMS, the field is cleared, the row shows only the label and last four characters of the key's own fingerprint, never of the value.
  5. What is reported. Level selector (Metadata / Metadata and content), the outbox viewer, Send nothing.

Every control has its reverse: link/unlink, share/unshare a provider, add/remove a key, opt in/opt out.

Security

  • IAM only. No password, OTP or session scheme here; the device key signs, IAM authenticates.
  • User-scope everywhere: the subject comes from the validated token, and no op reads another user's desktop, account or content. SuperAdmin has no path in.
  • KMS paths only in docs and rows; values never leave KMS except to the gateway at call time.
  • Audit: link, revoke, key add and delete, level change, every Dispatch.
  • Rate: heartbeat 1 per 10 s per desktop; link 10 per hour per user.

Slices

  1. Registry: link, list, get, revoke, heartbeat, ZAP service; desktop "Linked to Hanzo" screen (status, your desktops, providers read-only). This HIP's first build.
  2. Provider accounts and KMS keys; route chips.
  3. Usage reports, outbox viewer, aggregation.
  4. Routing: execution on /v1/dev, Dispatch, hanzo.app picker.
  5. Browser source: the extension registers, heartbeats and reports usage (Browser sources).

Rejected

  • Storing provider tokens in KMS so any cell can use a subscription: violates provider terms and the one rule.
  • A second usage model: the desktop's typed usage module is the schema.
  • WebSocket or HTTP session bridges: ZAP only.

Amendment: how every client reaches a source (2026-11-21)

Desktop, mobile and web reach /v1/dev the same way (HIP-1330 amendment): lease a session, then open a ZAP session to it. What they add is the list of places a session can run, which they read from GET /v1/sources for the person's machines and from GET /v1/dev/sessions for their cloud sessions, and merge. There is no third list.

A route to a source is the session lease with runtime: "source" and the source's id. The reply has the same shape as every other session, {id, label, zap} with no sandbox; zap is the source's Connect relay endpoint, and the IAM bearer in the first envelope is the credential there as it is for a cell. Cloud does not carry the session's bytes for a source: it names the endpoint and the relay carries them, so a person's machine is never routed through a cloud cell and a cloud cell is never given a machine's credentials.