# dsh-lan-loopback-compat

> Treat connections that arrive through a LAN proxy as loopback, so a DeepSeek Harness instance reached over a LAN/tunnel keeps its browser connection working.

Latest version **0.1.0** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install dsh-lan-loopback-compat
pnpm add dsh-lan-loopback-compat
yarn add dsh-lan-loopback-compat
bun add dsh-lan-loopback-compat
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2026-09-24 |
| First published | 2026-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | jipika |
| Keywords | dsh, dsh-plugin, deepseek-harness, lan, loopback, connection, compat, proxy |

## Links

- npm: https://www.npmjs.com/package/dsh-lan-loopback-compat
- Repository: https://github.com/jipika/dsh-lan-loopback-compat
- Homepage: https://github.com/jipika/dsh-lan-loopback-compat#readme
- Issues: https://github.com/jipika/dsh-lan-loopback-compat/issues
- npm.io page: https://npm.io/package/dsh-lan-loopback-compat

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2026-09-24

## README

# dsh-lan-loopback-compat

> Treat connections that arrive through a LAN proxy as loopback, so a DeepSeek Harness
> instance reached over a LAN or a tunnel keeps its browser connection working.
>
> 把经 LAN 代理进来的连接当成 loopback，让通过局域网 / 隧道访问的 DSH 实例保持浏览器连接可用。

[![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

---

## 它解决什么

DSH 的 client 会按 `connection.isLoopback` 判断「我是不是在本机打开」。当实例是通过反向代理或
LAN 转发访问时，这个判断为假，连接层的一些本机假定就不成立（表现为连接异常/被拒）。

本插件在**客户端**把该标志置为真 —— 前提是宿主显式声明了它确实处在 LAN 代理之下。

## 它做什么

```js
// client.js 全部逻辑
if (globalThis.__DSH_LAN_PROXY__ !== true || ctx.connection === undefined) return;
ctx.connection.isLoopback = true;
globalThis.__DSH_LAN_COMPAT_PLUGIN__ = true;
```

- 只有 `globalThis.__DSH_LAN_PROXY__ === true` 时才动手；条件不满足则**完全不碰**任何东西。
- 监听 `connection/reset` 事件，连接重建后重新打标（否则重连会丢）。
- 打上 `globalThis.__DSH_LAN_COMPAT_PLUGIN__ = true` 自证已生效。
- host 半边（`index.js`）是空 `apply()` —— 它存在只为了让 cordis 行能挂载 client bundle。

## 安装

```bash
dsh plugin --profile <profile> add github:jipika/dsh-lan-loopback-compat
```

```yaml
# ~/.dsh/profiles/<profile>/cordis.patch.yml
- insert:
    - id: dsh-lan-loopback-compat
      name: dsh-lan-loopback-compat
```

`__DSH_LAN_PROXY__` 由外部（代理页面 / 启动脚本）注入；本插件不设置它。

`desktop` profile 被 Electron 独占（CLI 子命令会被拒），需手改 `package.json` + `pnpm install`；
**改 client 半边必须重启应用**。

## 已知限制

- 直接改写 client 服务对象上的属性，依赖 `isLoopback` 这个内部约定；官方若改成 getter
  或受保护属性，写法即失效（会静默不生效，因为整段逻辑只做赋值）。
- 依赖 `connection/reset` 事件名。
- 安全性说明：它**不会**自己把实例暴露到 LAN —— 只有外部已声明处于 LAN 代理时才生效，
  真正的访问控制仍由 DSH 的鉴权负责。

## License

MIT © 2026 jipika

---
_Source: https://npm.io/package/dsh-lan-loopback-compat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
