@seaveyon/harness-switch 0.14.0 → 0.16.0

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.
package/README.md CHANGED
@@ -33,6 +33,10 @@ ssh -N -L 8787:127.0.0.1:8787 user@your-server
33
33
 
34
34
  Then open <http://127.0.0.1:8787> in your local browser.
35
35
 
36
+ ### Interface language
37
+
38
+ The web UI supports English and Simplified Chinese. Use the language button in the login page or dashboard header to switch languages. Chinese remains the default for existing behavior; your selection is stored in the browser and is reused on later visits. The setting affects only the web interface—it does not change profile data or generated configuration files.
39
+
36
40
  ## Configuration
37
41
 
38
42
  Create one or more profiles per harness in the web UI. A profile holds a display name, API Base URL, API key, model, notes, and whatever extra fields that harness needs. Select **Activate** to make a profile current.
@@ -70,7 +74,7 @@ Two known limitations:
70
74
 
71
75
  ### Advanced: taking over the raw file
72
76
 
73
- Any field the form does not expose can be set by editing the raw file content in the profile's **高级:原始配置** section. Once edited, that file is generated from your text instead of the form fields until you select **恢复为自动生成**. Content that cannot be parsed back is rejected before it reaches disk.
77
+ Any field the form does not expose can be set by editing the raw file content in the profile's **Advanced: raw configuration** section. Once edited, that file is generated from your text instead of the form fields until you select **Restore automatic generation**. Content that cannot be parsed back is rejected before it reaches disk.
74
78
 
75
79
  ### Backups and rollback
76
80
 
@@ -82,15 +86,17 @@ Switching away from a profile first reads the live file back into that profile's
82
86
 
83
87
  ### Moving every profile to another machine
84
88
 
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`.
89
+ Use **Import / Export** 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
90
 
87
91
  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
92
 
93
+ A Codex official-login cache (`$CODEX_HOME/auth.json`) is **excluded by default**. When a valid cache is available, you may explicitly include it in the encrypted bundle and then make a second explicit choice to write it on the destination. This carries a reusable Codex/ChatGPT login session: share such a bundle only with a trusted recipient, and expect upstream expiry or revocation to still require a fresh `codex login`. An existing destination cache is backed up before replacement; copied caches are written as the destination user with mode `0600`.
94
+
89
95
  Keep the migration password separately from the bundle. It cannot be recovered from the export file.
90
96
 
91
97
  ### Provider Vault: shared credentials
92
98
 
93
- The **凭据库 (Provider Vault)** stores an API key once under a named entry with one or more named endpoints (each a base URL), encrypted with the same AES-256-GCM key that protects `profiles.json`. A profile can reference a vault entry instead of carrying its own key:
99
+ The **Provider Vault** stores an API key once under a named entry with one or more named endpoints (each a base URL), encrypted with the same AES-256-GCM key that protects `profiles.json`. A profile can reference a vault entry instead of carrying its own key:
94
100
 
95
101
  - The vault owns the credential; the profile keeps a materialized cache so existing readers (transfer export, `active.json`, `env.sh`) keep working unchanged.
96
102
  - Rotating the vault key or an endpoint re-applies every **active** profile that references the entry, so the live files follow immediately. Failures are reported as warnings.
@@ -99,7 +105,7 @@ The **凭据库 (Provider Vault)** stores an API key once under a named entry wi
99
105
 
100
106
  ### Configuration drift
101
107
 
102
- The dashboard's **配置漂移** panel compares what the active profile would render against the actual files on disk, using parsed-value comparison for JSON/TOML/YAML so a re-render that only reorders keys does not count as drift. Each file is reported as:
108
+ The dashboard's **Configuration drift** panel compares what the active profile would render against the actual files on disk, using parsed-value comparison for JSON/TOML/YAML so a re-render that only reorders keys does not count as drift. Each file is reported as:
103
109
 
104
110
  - `in-sync` — disk matches what the profile would write,
105
111
  - `drifted` — disk differs from what the profile would write,
@@ -109,12 +115,12 @@ The dashboard's **配置漂移** panel compares what the active profile would re
109
115
 
110
116
  Two repair actions are offered per harness:
111
117
 
112
- - **重新应用 (re-apply)** rewrites the live files from the active profile, with the usual backup-before-write and all-or-nothing rollback.
113
- - **采纳现场配置 (adopt)** reads the live files back into the profile record (same path as the pre-switch backfill). It refuses with `409` when the profile has manual raw overrides, and never adopts content the tool itself could not parse.
118
+ - **Re-apply** rewrites the live files from the active profile, with the usual backup-before-write and all-or-nothing rollback.
119
+ - **Adopt live configuration** reads the live files back into the profile record (same path as the pre-switch backfill). It refuses with `409` when the profile has manual raw overrides, and never adopts content the tool itself could not parse.
114
120
 
115
121
  ### Diagnostics (Doctor)
116
122
 
117
- The **诊断 (Doctor)** panel runs read-only checks per harness: whether the tool's CLI is on `PATH` (`install`), whether each target's config directory exists (`configDir`), whether each target file exists and is readable/writable (`files`, with a warning when a config file holding credentials is group/other-readable), whether the files parse (`parse`), and whether live state drifts from the active profile (`drift`). A global update check reports whether a newer release exists (`updatedAvailable`).
123
+ The **Diagnostics (Doctor)** panel runs read-only checks per harness: whether the tool's CLI is on `PATH` (`install`), whether each target's config directory exists (`configDir`), whether each target file exists and is readable/writable (`files`, with a warning when a config file holding credentials is group/other-readable), whether the files parse (`parse`), and whether live state drifts from the active profile (`drift`). A global update check reports whether a newer release exists (`updatedAvailable`).
118
124
 
119
125
  The connectivity probe is **disabled by default in the MVP**: passing `--probe` only records a `unknown`-status check that reports the active base URL and explains that no network request is made.
120
126
 
@@ -124,6 +130,8 @@ The dashboard header can switch between local login users such as `root` and `al
124
130
 
125
131
  “Sync user config” performs a one-time copy of another user's profiles and referenced Provider Vault credentials into the selected user. Secrets are decrypted only on the server and re-encrypted with the destination user's local key. Active state, backups and native config files are not copied. Same-name profiles are skipped by default and can be explicitly overwritten.
126
132
 
133
+ A source user's Codex official-login cache (`auth.json`) is the sole optional exception: it remains unchecked by default and requires an irreversible confirmation that identifies the source and destination users. Choose it only when the destination user is allowed to use that login session. The previous destination cache is backed up, and the replacement is destination-owned with mode `0600`; source ownership and permissions are never copied.
134
+
127
135
  Cross-user writes require access to the destination home. Managing both `root` and regular users therefore normally requires running harness-switch as root; newly created files and directories are assigned to the destination UID/GID. The Web password then grants control over every exposed user's configs, so keep the loopback bind and SSH tunnel. Use `HSW_USERS=root,alice` to restrict the manageable accounts.
128
136
 
129
137
  ### CLI automation
@@ -142,6 +150,7 @@ harness-switch list --user alice # inspect alice's independent store
142
150
  harness-switch activate codex main --user alice --yes
143
151
  harness-switch sync --from root --to alice # one-time copy; skips conflicts
144
152
  harness-switch sync --from root --to alice --overwrite
153
+ harness-switch sync --from root --to alice --copy-codex-auth # explicitly copy Codex auth.json
145
154
  ```
146
155
 
147
156
  `plan <harness>` prints the drift inspection of the active profile (expected vs. current content per file); without an active profile it reports `status: unknown`. `activate` prompts for confirmation on a TTY and requires `--yes` in non-interactive terminals (CI). JSON output mirrors the HTTP API response shapes (`HarnessesResponse`, `ProvidersResponse`, `DoctorResponse`, `DriftSummary`, `ActivateResponse`), so scripts can reuse the same field names. `HSW_DATA_DIR` and `HSW_HOME_DIR` override where it reads state (defaults: `~/.harness-switch` and `$HOME`).