Skip to content
dsh.fish
Bundle

dsh-model-account-login

Persistent DSH model-account authorization UI for ChatGPT, Claude, and other llm-pi-ai login flows

Source
hongbaiqi
License
MIT
Updated
Updated 2 days ago

Readme

# dsh-model-account-login

Persistent model-account authorization UI for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/DeepSeek-Harness) — sign in to ChatGPT, Claude, and other `llm-pi-ai` login flows once, and keep the session alive across restarts.

> 中文说明见下文 [中文](#中文)。

## What it does

DSH core ships an authorization seam (`@deepseek-ai/dsh-authorization`) plus credential storage, but no built-in UI for interactive provider login flows (device codes, external URLs, text/secret/select prompts). This package adds that missing piece:

- **Host half** (`lib/host.js`) — bridges the official `authorization` service to a package-private JSON-RPC channel (`/model-account-login`), tracks every login attempt in an `AttemptRegistry` (notices, prompts, cancellation, settle states), and persists results through `credentials` / `settings`.
- **Web Client half** (`lib/client.js`) — registers a **Settings → Model Accounts** section (`settings.section` slot). Each login flow renders as a card showing signed-in / route-enabled state with actions: login, re-login, sign-out, enable/disable route. An in-flight attempt expands an inline panel with the shared state machine: notices, external URL, device code, prompts (text / secret / select), submit and cancel.

## Install

This is a Cordis composition plugin. Mount it into your DSH **host composition** with the bundled patch:

```yaml
# cordis.patch.yml (bundled)
- insert:
    - id: model-account-authorization
      name: '@deepseek-ai/dsh-authorization'
      inject: [credentials]

    - id: model-account-login
      name: 'dsh-model-account-login'
      inject: [authorization, credentials, settings, connection]
```

The Web Client entry is declared through `package.json → dsh.client` and joins the Web module graph automatically once the host row is mounted.

### Requirements

- Node.js >= 20
- A DSH deployment providing these peer services:
  - `@deepseek-ai/cordis` ^4.0.1
  - `@deepseek-ai/dsh-authorization` ^0.1.1-rc.2
  - `@deepseek-ai/dsh-credentials` ^0.1.1-rc.2
  - `@deepseek-ai/dsh-settings` ^0.1.1-rc.2
  - `@deepseek-ai/dsh-client-connection` / `dsh-client-runtime` / `dsh-client-ui-settings` ^0.1.1-rc.2
  - `react` ^18.2.0

## Repository layout

```
lib/
  host.js       Host plugin: RPC bridge + attempt lifecycle
  client.js     Web client: settings.section UI (React)
  protocol.js   Shared RPC protocol, view types, validators
  state.js      AttemptRegistry state machine
  *.d.ts        Type declarations for all of the above
cordis.patch.yml  Composition patch for mounting
```

> **Note:** this repository currently ships the **built artifacts** of the plugin
> (compiled JS + type declarations). The TypeScript sources are not yet published;
> contributions that help reconstruct them are welcome — see [AGENTS.md](./AGENTS.md).

## Protocol at a glance

Client → Host calls go over the `/model-account-login` channel as lossless JSON, returning `RpcResult<T>` (`{ ok: true, value }` / `{ ok: false, error }`). Key view types (see `lib/protocol.d.ts`):

- `OverviewView` — all known flows, their methods, `inFlight` / `signedIn` / `routeEnabled` flags
- `AttemptView` — one login attempt: status (`running | authorized | cancelled | failed`), notices, current prompt, error
- `PromptView` — `text` / `secret` / `select` prompt descriptions

Credentials are stored under the `llm-pi-ai` credential scope; settings under the `llm-pi-ai` namespace.

## License

[MIT](./LICENSE) © 2026 hongbaiqi

---

## 中文

**dsh-model-account-login** 是 DeepSeek Harness(DSH)的模型账号登录插件:为 ChatGPT、Claude 等 `llm-pi-ai` 登录流程提供持久化的授权界面。

- **Host 端**:把官方 `authorization` 服务桥接到包内私有 RPC 通道,管理每次登录尝试的状态机(通知、设备码、交互提示、取消、成败落定),并通过 `credentials` / `settings` 持久化登录结果。
- **Web 端**:在设置页注册「模型账号」面板,每个登录流程一张卡片,显示已登录 / 路由启用状态,支持登录、重新登录、退出、启停路由;进行中的登录会展开内联面板,展示通知、外部链接、设备码和输入提示。

### 安装

用随包附带的 `cordis.patch.yml` 把插件挂进 DSH 的 host 组合(composition)即可,Web 客户端会随模块图自动加载。要求 Node.js >= 20 及上文列出的 peer 依赖。

### 说明

本仓库当前发布的是**编译产物**(JS + 类型声明),TypeScript 源码尚未公开,欢迎贡献重建。

许可证:[MIT](./LICENSE) © 2026 hongbaiqi

Install

dsh plugin --profile web add github:hongbaiqi/dsh-model-account-login#10298a6328d71fc1b6300e72b4b46c3136e0828a

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
Source