@seaveyon/harness-switch 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +20 -3
  2. package/dist/harness-switch.js +407 -51
  3. package/package.json +1 -1
  4. package/public/06ac09dcb8ec7d56.woff2 +0 -0
  5. package/public/110e2a7693b4a5f3.woff2 +0 -0
  6. package/public/192d14b24f70b621.woff2 +0 -0
  7. package/public/2258ff2f7eae77c2.woff +0 -0
  8. package/public/2a0db5363856276c.woff2 +0 -0
  9. package/public/5a49cbe35ab2dd3c.woff2 +0 -0
  10. package/public/60bbe6c85a6afad1.woff2 +0 -0
  11. package/public/651bc97e3669e21f.woff2 +0 -0
  12. package/public/66a2e8650a2dcd92.woff2 +0 -0
  13. package/public/7d495472d32ca07d.woff +0 -0
  14. package/public/88f8fd5b09b976bb.woff +0 -0
  15. package/public/9533b5204f120066.woff +0 -0
  16. package/public/994c96595d20046b.woff +0 -0
  17. package/public/9faee8e8b774991c.woff2 +0 -0
  18. package/public/a7358d2e3dd919a9.woff2 +0 -0
  19. package/public/a8a9073d6f10c294.woff2 +0 -0
  20. package/public/assets/{4952.5b132c3d.js → 4952.58f3b893.js} +1 -1
  21. package/public/assets/{5646.a72b2c1e.js → 5646.1b33e69c.js} +1 -1
  22. package/public/assets/{6150.910aaed9.js → 6150.5cb126a5.js} +1 -1
  23. package/public/assets/main.5b6d51f1.css +2 -0
  24. package/public/assets/main.5e14383f.js +1 -0
  25. package/public/b0b919fcf36c2073.woff2 +0 -0
  26. package/public/bdc4ddcb892cb87b.woff2 +0 -0
  27. package/public/cd8df815c9344be0.woff2 +0 -0
  28. package/public/d2ac083e197becc1.woff +0 -0
  29. package/public/dece0821e8ed059f.woff2 +0 -0
  30. package/public/e32cf7a40c90e778.woff +0 -0
  31. package/public/e53d79b9a7d8ae7b.woff +0 -0
  32. package/public/ef1c8a30e0ed6275.woff2 +0 -0
  33. package/public/f14ffb91743624fd.woff +0 -0
  34. package/public/f9f2cfdc8f44d943.woff +0 -0
  35. package/public/index.html +1 -1
  36. package/public/assets/main.9128def8.css +0 -2
  37. package/public/assets/main.95434834.js +0 -1
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40seaveyon%2Fharness-switch.svg)](https://www.npmjs.com/package/@seaveyon/harness-switch)
4
4
 
5
+ English | [简体中文](https://github.com/B1anker/harness-switch/blob/main/README.zh-CN.md)
6
+
5
7
  **harness-switch** is a Bun-powered web control plane for managing API profiles on an SSH or headless server. It switches API Base URL, API key, and model profiles for **Claude Code**, **Codex**, **Kimi Code**, **Pi**, and **DeepSeek Harness (DSH)**.
6
8
 
7
9
  It is a configuration manager, not an API proxy: it does not route or inspect model traffic.
@@ -78,12 +80,22 @@ A write either lands completely or not at all: content is validated first, and a
78
80
 
79
81
  Switching away from a profile first reads the live file back into that profile's record, so edits you made directly in the CLI tool are not lost on the next switch.
80
82
 
83
+ ### Moving every profile to another machine
84
+
85
+ Use **导入 / 导出** in the top bar to create one `.hsw-backup` file containing every Harness profile, API key, raw-file override, and current activation choice. The bundle is encrypted with a migration password you choose, so it does not depend on the source machine's `aes-256-gcm.key`.
86
+
87
+ On the destination machine, select the bundle and enter the migration password. The UI shows profile counts and same-name conflicts before it writes anything. Import keeps destination profiles by default; overwriting is an explicit choice. Restoring the exported activation state is optional.
88
+
89
+ Keep the migration password separately from the bundle. It cannot be recovered from the export file.
90
+
81
91
  ## Security
82
92
 
83
93
  The service defaults to loopback only. Do **not** expose the management port directly to the public Internet. Use SSH port forwarding or a TLS-enabled reverse proxy with additional access control.
84
94
 
85
95
  API keys are encrypted with AES-256-GCM in `~/.harness-switch/profiles.json`; the local encryption key lives in `~/.harness-switch/aes-256-gcm.key`. Those files, the generated password, and `env.sh` are stored with permissions set to `0600` on POSIX systems. When writing a harness's own configuration file, existing permissions are preserved and newly created files start at `0600`.
86
96
 
97
+ Web sessions live in `~/.harness-switch/sessions.json` (also `0600`) so restarting the service does not log you out. Only a SHA-256 digest of each session token is stored, so the file cannot be replayed as a cookie, and the table is tied to a fingerprint of the password that issued it: replacing `web_password` invalidates every existing session.
98
+
87
99
  Two places deliberately expose a key to an authenticated session: the raw config preview and the generated files themselves must contain the credential to be useful. Profile listings never echo it.
88
100
 
89
101
  This protects against accidental plaintext disclosure in profile storage, but does not replace host-level controls such as disk encryption and a secure Unix account.
@@ -94,8 +106,9 @@ This protects against accidental plaintext disclosure in profile storage, but do
94
106
  |---|---:|---|
95
107
  | `HOST` | `127.0.0.1` | Bind address. Keep the default when using SSH tunnelling. |
96
108
  | `PORT` | `8787` | Listening port. |
97
- | `HSW_DATA_DIR` | `~/.harness-switch` | Directory for encrypted profiles, active state, key, password, backups, and env file. |
109
+ | `HSW_DATA_DIR` | `~/.harness-switch` | Directory for encrypted profiles, active state, key, password, sessions, backups, and env file. |
98
110
  | `HSW_HOME_DIR` | `$HOME` | Home directory used to locate the harness config directories. |
111
+ | `HSW_SESSION_TTL_HOURS` | `24` | How long a Web login stays valid. Sessions survive a service restart. |
99
112
  | `HSW_BACKUP_RETAIN` | `10` | Number of snapshots to keep. |
100
113
  | `HSW_PUBLIC_DIR` | auto | Optional override for the built frontend directory. |
101
114
 
@@ -120,6 +133,9 @@ The UI is a React SPA. Authentication uses an HttpOnly `hsw_session` cookie.
120
133
  | `POST` | `/api/harnesses/:id/profiles/:name/activate` | Write the native config, then commit the switch |
121
134
  | `GET` | `/api/backups` | Snapshots, newest first |
122
135
  | `POST` | `/api/backups/:id/restore` | Restore a snapshot verbatim |
136
+ | `POST` | `/api/transfer/export` | Create a passphrase-encrypted portable bundle |
137
+ | `POST` | `/api/transfer/preview` | Decrypt and report profile counts and conflicts without writing |
138
+ | `POST` | `/api/transfer/import` | Import with `skip` or `overwrite` conflict handling |
123
139
 
124
140
  ## systemd
125
141
 
@@ -173,11 +189,12 @@ bun run dev:server
173
189
  bun run dev:web
174
190
  ```
175
191
 
176
- Linting and formatting are split: **Oxlint** for diagnostics, **Biome** for format and import organization.
192
+ Quality gates are three-layered: **tsc** for type checking, **Oxlint** for diagnostics, **Biome** for format and import organization. `bun run check` runs all three.
177
193
 
178
194
  ```bash
179
195
  bun run lint
180
196
  bun run lint:fix
197
+ bun run typecheck
181
198
  bun run format
182
199
  bun run format:check
183
200
  bun run check
@@ -201,7 +218,7 @@ The web dev server listens on `http://127.0.0.1:5173` and proxies `/api` to the
201
218
 
202
219
  ## Release
203
220
 
204
- Pushes to `main` run [semantic-release](https://semantic-release.gitbook.io/). It reads conventional commits, bumps `@seaveyon/harness-switch`, tags `v*`, and publishes to npm via Trusted Publishing.
221
+ Pushes to `main` run [semantic-release](https://semantic-release.gitbook.io/). It reads conventional commits, bumps `@seaveyon/harness-switch`, tags `v*`, and publishes to npm via Trusted Publishing. The tarball is published to the npm registry **before** the `v*` tag and GitHub release are created, so a failed registry publish never leaves a tag without a matching npm version, and a re-run skips versions that are already on the registry.
205
222
 
206
223
  | Commit | Version bump |
207
224
  |---|---|