deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
English | 中文
A floating position P&L card for the DeepSeek Harness (DSH) web GUI. It automatically syncs your real portfolio data from the Tonghuashun investment-ledger (同花顺投资账本) — no manual stock picking. Displays 今日盈亏 (today's P&L), 上证指数 (Shanghai Composite Index), and an intraday mini chart, all in the A-share red-up/green-down convention.
Unlike watchlist tools, this plugin reads your actual positions and shows your real profit & loss — both as a percentage and as a yuan amount — updating every 20 seconds.

dsh plugin --profile web add dsh-ths-holdings
Installation is pnpm add inside your web profile: the package's dsh.bundle.patch is applied to the profile layer automatically. Then restart dsh web — a floating card appears at the bottom-right corner.
To install manually (without dsh plugin), edit $DSH_HOME/profiles/web/package.json:
{
"dependencies": {
"dsh-ths-holdings": "^0.1.0"
},
"dsh": {
"profile": {
"bundles": [
// ...existing bundles,
"dsh-ths-holdings"
]
}
}
}
then cd $DSH_HOME/profiles/web && pnpm install and restart dsh web. The plugin row itself comes from the package's cordis.patch.yml — you don't write it by hand.
copy(document.cookie)
The session cookie expires eventually — when it does, the card shows a Token 已过期 banner; repeat steps 1–5 with a fresh cookie (the v anti-bot token is handled automatically).
💡 After completing a new trade, re-upload your data from the investment-ledger app to the web version so your holdings stay consistent between the two.
fund_key is discovered from the portfolio list; multi-account selection via dropdown┌─────────────── Web browser ───────────────┐
│ lib/client.js (browser module) │
│ · shell.overlay slot → floating card │
│ · React + CSS Modules │
│ · config in localStorage │
│ │ fetch (same-origin) │
└──────────┼─────────────────────────────────┘
▼
┌─────────────── DSH Host (lib/index.js) ───┐
│ cordis plugin: webServer routes │
│ · GET /api/stock-pnl snapshot │
│ · GET /api/stock-pnl/portfolios accounts │
│ resolves Cookie via ctx.credentials │
│ auto-discovers user_id + fund_key │
│ POSTs Tonghuashun ledger APIs │
└───────────────────────────────────────────┘
The node half reads the login Cookie per request through the credential-reference seam (ctx.credentials) — it never reaches the browser. Credential-bearing requests never follow a redirect. The v anti-bot token is minted per request from the User-Agent; the stored Cookie only needs its session fields.
| Key | Default | Meaning |
|---|---|---|
cookieEnv |
STOCK_PNL_COOKIE |
Credential reference holding the ledger Cookie. |
fundKeyEnv |
STOCK_PNL_FUND_KEY |
Credential reference holding the ledger fund key (saved from the card's ⚙ form). |
user_id |
the Cookie's userid |
The ledger user id, included in every form payload; an empty value falls back to the Cookie's own userid. |
fund_key |
auto-discovered | The ledger fund key selecting the managed portfolio; overridden by the fundKeyEnv credential when set, auto-discovered from the account list when empty. |
pnlUrl |
Tonghuashun time_share endpoint |
P&L endpoint override (tests point at a scripted server). |
indexUrl |
Tonghuashun getQuotes endpoint |
Index endpoint override (tests point at a scripted server). |
pollMs |
20000 |
Poll interval (ms) the card uses; reported to the browser in each response's poll_ms. |
dsh-ths-holdings/
├── src/
│ ├── index.ts # node half: webServer routes + credential resolution
│ ├── fetch.ts # Tonghuashun ledger API calls + auto-discovery
│ └── client/
│ ├── index.ts # browser half: shell.overlay registration
│ └── StockPnlCard.tsx
├── lib/ # built artifacts (index.js + client.js)
├── cordis.patch.yml # dsh.bundle patch layer
├── package.json # dsh.bundle + dsh.client manifests
├── tests/ # ledger acquisition unit tests
└── README.md
| Symptom | Cause & fix |
|---|---|
Card shows 请配置 Cookie |
STOCK_PNL_COOKIE is empty — paste your cookie in the ⚙ panel. |
Card shows Token 已过期 |
The session Cookie expired — re-run copy(document.cookie) and paste the fresh one. |
| No portfolio in the dropdown | The account list needs a valid Cookie first; save the Cookie, then click ↻ to refresh. |
| Multiple portfolios | Select the one you want from the dropdown — the choice is saved as STOCK_PNL_FUND_KEY. |
| Cookie pasted with line breaks | The plugin strips whitespace on save, so wrapped lines are fine. |
None — the card is a browser-side overlay over a host data route and registers nothing model-facing.
None — the plugin contributes no prompt, schema, or result.
account_list) requires the Cookie to be saved first — the portfolio selector appears after you paste a valid Cookie.pollMs interval; there is no shared cache or push channel.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。