u-chan-secrets 5.0.0 → 5.1.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 +233 -91
- package/dist/cli.js +115 -19
- package/dist/client/claude-setup.js +97 -0
- package/dist/client/codex-setup.js +6 -5
- package/dist/client/discord.js +67 -0
- package/dist/client/github.js +28 -0
- package/dist/client/setup.js +40 -6
- package/dist/client/update-package.js +166 -0
- package/dist/client/update.js +138 -0
- package/dist/client/windows-command.js +54 -0
- package/dist/core/browser.js +0 -5
- package/dist/core/config.js +1 -0
- package/dist/core/doctor.js +5 -1
- package/dist/core/vault.js +110 -5
- package/dist/discord/http.js +84 -0
- package/dist/discord/policy.js +47 -0
- package/dist/discord/service.js +349 -0
- package/dist/discord/store.js +85 -0
- package/dist/github/http.js +93 -0
- package/dist/github/policy.js +24 -0
- package/dist/github/service.js +185 -0
- package/dist/github/store.js +54 -0
- package/dist/index.js +1 -1
- package/dist/ipc/client.js +74 -6
- package/dist/ipc/server.js +38 -3
- package/dist/mcp/server.js +25 -2
- package/dist/platform/windows/assets/prompt-src.js +160 -38
- package/dist/platform/windows/doctor.js +2 -2
- package/dist/platform/windows/install.js +4 -0
- package/dist/service/control.js +47 -5
- package/dist/service/doctor.js +3 -0
- package/dist/service/main.js +34 -17
- package/dist/service/manage.js +20 -16
- package/dist/service/state.js +28 -0
- package/dist/service/update/coordinator.js +171 -0
- package/dist/service/update/files.js +47 -0
- package/dist/service/update/gate.js +21 -0
- package/dist/service/update/journal.js +157 -0
- package/dist/service/update/native.js +50 -0
- package/dist/service/update/network.js +28 -0
- package/dist/service/update/protocol.js +28 -0
- package/dist/service/update/release.js +102 -0
- package/dist/service/update/worker-main.js +116 -0
- package/dist/service/update/worker.js +58 -0
- package/package.json +1 -1
- package/scripts/debug-install.bat +69 -69
- package/scripts/desktop-browser.ps1 +110 -103
- package/scripts/login-bw.bat +21 -21
- package/scripts/migrate.bat +4 -4
- package/scripts/start-browser.ps1 +33 -33
- package/scripts/windows-security/desktop-matrix.mjs +54 -54
package/README.md
CHANGED
|
@@ -1,73 +1,10 @@
|
|
|
1
|
-
# U-Chan Secrets
|
|
1
|
+
# U-Chan Secrets
|
|
2
2
|
|
|
3
3
|
A local MCP server that signs into approved websites with Bitwarden credentials. A privileged service performs credential entry in an isolated browser and transfers filtered session state into a dedicated Chrome or Edge profile.
|
|
4
4
|
|
|
5
|
-
Version `5.0.0` adds selectable Chrome/Edge desktop destinations and checks approved login evidence before and after session transfer. Chrome remains the default when no browser has been selected. Protocol and protected-state schema remain version 3. Source integration, publication, and installed verification are separate events.
|
|
6
|
-
|
|
7
5
|
**Verification:** Windows/macOS build and test CI is separate from installed-service security verification. Native process identity, input isolation, permissions, and installation rehearsals remain [release gates](docs/attack-checklist.md). See [V5 validation evidence](docs/superpowers/research/2026-10-30-v5-validation.md) and [SECURITY.md](SECURITY.md).
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## What V3 changes
|
|
12
|
-
|
|
13
|
-
- **Diagnose:** `u-chan doctor` explains service, vault, permission, Chrome, and browser-sharing problems without fetching credentials or repairing configuration.
|
|
14
|
-
- **Limit approval:** approve one login attempt, a fixed duration, or permanent future logins.
|
|
15
|
-
- **Confirm outcomes:** an approved URL or selector provides authentication evidence; generic form completion remains explicitly unconfirmed.
|
|
16
|
-
- **Manage access:** `u-chan manage` shows grant pages and recent sanitized activity, with lock, unlock, and revoke actions.
|
|
17
|
-
- **Preserve state:** privileged migration backup, schema/downgrade guards, and state-preserving reinstall replace manual editing of protected files.
|
|
18
|
-
|
|
19
|
-
Windows Hello and Touch ID remain [research only](docs/superpowers/research/2026-10-29-native-approval.md). Linux, general SSO/OAuth, passkeys, and automated CAPTCHA solving are outside V3.
|
|
20
|
-
|
|
21
|
-
## What V5 adds
|
|
22
|
-
|
|
23
|
-
Choose your browser from a normal Windows terminal:
|
|
24
|
-
|
|
25
|
-
```powershell
|
|
26
|
-
u-chan setup --browser edge --json
|
|
27
|
-
u-chan setup --browser edge --apply --replace-existing --start-browser
|
|
28
|
-
u-chan setup --browser chrome --apply --replace-existing --start-browser
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The first command inspects the proposed choice. `--apply` saves it in user-side `browser.json` and registers the matching MCP environment through the official Codex CLI. Later commands without `--browser` keep the saved choice; a new installation defaults to Chrome. Browser and Codex configuration backups are retained under their respective `#0 backup` directories. Each user's choice is independent.
|
|
32
|
-
|
|
33
|
-
Chrome and Edge use separate dedicated profiles. Only one browser owns the configured U-Chan CDP endpoint at a time. When switching, close the previous **dedicated U-Chan instance** and rerun setup; keep your personal browser windows open. U-Chan refuses wrong, unknown, personal-profile, or non-loopback listeners instead of silently attaching, selecting another port/browser, or terminating processes. It does not install browsers or change enterprise debugging policy. The legacy `scripts/start-chrome.ps1` explicitly selects Chrome; `scripts/start-browser.ps1 -Browser edge` selects Edge.
|
|
34
|
-
|
|
35
|
-
The service independently checks the installed owner's SID and dedicated profile before accessing the Windows destination. It derives that user's AppData paths from the profile registry. Advanced installations with a custom desktop profile root must align the trusted service environment's `U_CHAN_DESKTOP_HOME` with the user-side home; changing only a user-side environment variable does not redirect privileged session transfer.
|
|
36
|
-
|
|
37
|
-
An approved exact URL or visible selector must match in both the private login context and a new verification tab in the destination browser before `login` returns success. Existing user tabs are left alone. Missing evidence returns `authentication_unconfirmed`; private success with unverified desktop state returns `destination_unconfirmed`. Transfer failure/cancellation can leave partial session state and does not log the browser out. Expired or consumed grants are not refunded.
|
|
38
|
-
|
|
39
|
-
The private credential-bearing context uses a per-attempt HTTP/CONNECT proxy to block network destinations outside approved hosts, including redirect chains and worker/frame requests. Service workers are disabled. Private Chromium disables HTTP/2 and QUIC so connections cannot coalesce across approved and unapproved origins; HTTP/2-only sites may be unsupported. TLS remains end-to-end with normal browser certificate validation. Some sites requiring third-party resources or external identity providers also remain unsupported; U-Chan does not silently broaden host approval. CAPTCHA, passkey, push approval, or unavailable/rejected TOTP returns `needs_human` with manual sign-in guidance. V5 does not expose or resume the private challenge context, repeat credential submissions, or ask for passwords/codes in AI chat.
|
|
40
|
-
|
|
41
|
-
A V5 client requires the service's `verified_session_transfer` capability before login and binds the request to its selected browser. Update both CLI and service; an older service is refused before a login attempt is sent. An old client without a browser field retains its legacy Chrome destination. A stale MCP browser environment that conflicts with the saved choice is refused until the AI session restarts. Existing grants and vault data remain compatible. Native macOS runtime and ownership by an already-running AI session remain unverified.
|
|
42
|
-
|
|
43
|
-
Other MCP clients may set `U_CHAN_BROWSER=edge` (or `chrome`) and the matching loopback `U_CHAN_CDP` in their own registration, then launch the matching dedicated browser. Automatic registration remains Windows/Codex only; setting a desktop environment variable does not change the privileged service's endpoint.
|
|
44
|
-
|
|
45
|
-
## What V4 adds
|
|
46
|
-
|
|
47
|
-
Use a normal, non-administrator terminal after installing the matching trusted service:
|
|
48
|
-
|
|
49
|
-
```powershell
|
|
50
|
-
u-chan setup --json
|
|
51
|
-
u-chan setup --client codex --apply
|
|
52
|
-
u-chan setup --client codex --apply --replace-existing --start-browser
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
The first command only inspects. `--apply` adds missing Codex MCP registrations through the official Codex CLI. `--replace-existing` also permits replacement of recognized simple registrations. Existing configuration is backed up under the Codex configuration directory's `#0 backup` before mutation. Compatible enabled registrations retain custom environment, working directory, tool filters, timeouts, and other settings. Incompatible custom registrations, conflicting target overrides, disabled entries, and HTTP transports require manual configuration and remain untouched. Partial failures retain completed changes and the backup; setup never restores an obsolete whole configuration over concurrent edits.
|
|
56
|
-
|
|
57
|
-
`--start-browser` explicitly starts the selected dedicated browser profile in the background when its endpoint is unhealthy. No startup task is added. Setup refuses elevated execution and known service/desktop browser-target mismatches. It never installs the privileged service or changes UAC. Run `u-chan install` separately from a trusted administrator terminal.
|
|
58
|
-
|
|
59
|
-
Setup reports `configured` or `needs_attention`, plus `sharing` and `restartRequired`. `process_configured` means matching process arguments were observed; it does not verify active AI-session ownership. Unobservable sharing remains `unobserved`. Restart the AI session after registration changes. Exit codes: 1 means attention required, 2 means configured with restart required, and 0 means configured without a known restart requirement. A locked vault remains a valid installed state.
|
|
60
|
-
|
|
61
|
-
Automatic registration supports Codex on Windows only. Configure other clients manually using their documented MCP commands. macOS runtime remains unverified. `doctor` compares the actual CLI and installed service versions, both browser targets, and Windows UAC policy; missing metadata remains unknown. `manage` shows the installed service version and browser status.
|
|
62
|
-
|
|
63
|
-
Propose a site grant with an explicit success condition:
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
u-chan allow example.com --login-url https://example.com/login --item "Example account" --once --success-url https://example.com/dashboard
|
|
67
|
-
u-chan allow example.com --login-url https://example.com/login --item "Example account" --minutes 30 --success-selector "button[data-action='sign-out']"
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The service still requires protected approval. The CLI defaults to one login attempt; timed approvals accept 1–1440 whole minutes, and `--permanent` requests permanent future logins. URL and selector success conditions are mutually exclusive. Without one, login may return `authentication_unconfirmed`; independently verify the signed-in page. Grant expiry does not log out an already transferred browser session.
|
|
7
|
+
**Contents:** [Install](#install) · [Upgrade](#upgrade) · [Daily commands](#daily-commands) · [MCP tools](#mcp-tools-and-approvals) · [Setup reference](#setup-reference) · [Discord broker](#discord-broker) · [Release history](#release-history)
|
|
71
8
|
|
|
72
9
|
## Architecture
|
|
73
10
|
|
|
@@ -95,12 +32,16 @@ A Bitwarden session is held in service memory and passed to privileged Bitwarden
|
|
|
95
32
|
- Windows or macOS.
|
|
96
33
|
- Node.js 24+.
|
|
97
34
|
- A native Bitwarden CLI executable: `bw.exe` on Windows or `bw` on macOS. The Windows npm `.cmd` shim is unsupported.
|
|
98
|
-
- Google Chrome for the user-side dedicated profile.
|
|
35
|
+
- Google Chrome or Microsoft Edge for the user-side dedicated profile.
|
|
99
36
|
- The matching Playwright Chromium installation for service staging.
|
|
100
37
|
|
|
101
38
|
Install from a trusted shell before granting an AI unrestricted user-account access. On Windows, use UAC **Always notify** or run the AI from a standard user account. Existing administrator/root compromise is outside the threat model.
|
|
102
39
|
|
|
103
|
-
##
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
A fresh installation has four steps. Steps 1–2 run once from a trusted shell; steps 3–4 run from a normal user terminal.
|
|
43
|
+
|
|
44
|
+
### 1. Build from a reviewed checkout
|
|
104
45
|
|
|
105
46
|
Use a reviewed checkout for the desired source version. Unversioned npm installation can select a different published version; the package metadata in this repository is not proof of npm publication.
|
|
106
47
|
|
|
@@ -114,7 +55,9 @@ npx playwright install chromium
|
|
|
114
55
|
|
|
115
56
|
The following setup commands use `node dist/cli.js` from that checkout. After a matching package is globally installed, `u-chan` invokes the same CLI. The globally installed MCP command is `u-chan-secrets`.
|
|
116
57
|
|
|
117
|
-
###
|
|
58
|
+
### 2. Install the privileged service
|
|
59
|
+
|
|
60
|
+
#### Windows
|
|
118
61
|
|
|
119
62
|
From a trusted elevated PowerShell terminal in the checkout:
|
|
120
63
|
|
|
@@ -135,7 +78,7 @@ Remove-Item Env:\BITWARDENCLI_APPDATA_DIR
|
|
|
135
78
|
|
|
136
79
|
**Do not use `scripts/debug-install.bat` as a V3 setup or upgrade path.** That legacy script invokes uninstall, which deletes service data, and exports protected settings into the checkout. Use the CLI installer above.
|
|
137
80
|
|
|
138
|
-
|
|
81
|
+
#### macOS
|
|
139
82
|
|
|
140
83
|
From the trusted checkout:
|
|
141
84
|
|
|
@@ -148,33 +91,83 @@ sudo env -u BW_SESSION \
|
|
|
148
91
|
|
|
149
92
|
The daemon uses `/Library/Application Support/u-chan-secrets` and `/Library/LaunchDaemons/com.uchan.secrets.plist`. macOS always uses hardcore approval; easy mode is refused.
|
|
150
93
|
|
|
151
|
-
###
|
|
94
|
+
### 3. Connect AI clients and the browser
|
|
152
95
|
|
|
153
|
-
|
|
96
|
+
**Windows.** From a normal, non-administrator terminal (use `u-chan.cmd` if PowerShell blocks npm's launcher):
|
|
97
|
+
|
|
98
|
+
```powershell
|
|
99
|
+
u-chan setup --json
|
|
100
|
+
u-chan setup --apply --start-browser
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The first command only inspects. The second registers `u-chan-secrets` and a shared-CDP `playwright` server for every Codex and Claude Code CLI found on PATH, saves the browser choice, and starts the dedicated browser. Pass `--client codex`, `--client claude`, or `--client all` to choose clients explicitly, `--browser edge` to use Edge instead of the default Chrome, and `--replace-existing` to replace recognized simple registrations. Restart the AI session when setup reports `restart required: true`. See the [setup reference](#setup-reference) for states, backups, and exit codes.
|
|
104
|
+
|
|
105
|
+
**macOS and other MCP clients.** Register the absolute path to the thin client manually:
|
|
154
106
|
|
|
155
107
|
```sh
|
|
156
108
|
claude mcp add u-chan-secrets -- node "/absolute/path/to/u-chan-secrets/dist/index.js"
|
|
157
109
|
claude mcp add playwright -- npx @playwright/mcp@latest --cdp-endpoint http://127.0.0.1:9222
|
|
158
110
|
```
|
|
159
111
|
|
|
160
|
-
If a Playwright MCP registration already exists, replace it with the shared-CDP configuration and restart the AI session. A globally installed matching package can instead register `claude mcp add u-chan-secrets -- u-chan-secrets`.
|
|
161
|
-
|
|
162
|
-
Start the dedicated Chrome profile from the checkout:
|
|
163
|
-
|
|
164
|
-
| Platform | Command |
|
|
165
|
-
|---|---|
|
|
166
|
-
| Windows | `powershell -File scripts\start-chrome.ps1` |
|
|
167
|
-
| macOS | `bash scripts/start-chrome.sh` |
|
|
112
|
+
If a Playwright MCP registration already exists, replace it with the shared-CDP configuration and restart the AI session. A globally installed matching package can instead register `claude mcp add u-chan-secrets -- u-chan-secrets`. Start the dedicated browser profile with `bash scripts/start-chrome.sh` (macOS) or `powershell -File scripts\start-chrome.ps1` (Windows, manual setup).
|
|
168
113
|
|
|
169
|
-
|
|
114
|
+
### 4. Daily start
|
|
170
115
|
|
|
171
116
|
```sh
|
|
172
|
-
|
|
173
|
-
node dist/cli.js unlock
|
|
117
|
+
u-chan start
|
|
174
118
|
```
|
|
175
119
|
|
|
120
|
+
`start` launches the dedicated browser if needed, unlocks a locked vault through the protected prompt, and prints `doctor`.
|
|
121
|
+
|
|
176
122
|
Check the phrase in the genuine protected prompt before entering a password. Never send passwords, TOTP seeds/codes, or vault session keys to an AI conversation.
|
|
177
123
|
|
|
124
|
+
From a source checkout, use `node dist/cli.js` in place of `u-chan`.
|
|
125
|
+
|
|
126
|
+
## Upgrade
|
|
127
|
+
|
|
128
|
+
Pick the path for the version you have now (`u-chan doctor` reports both CLI and service versions):
|
|
129
|
+
|
|
130
|
+
| Installed | Path |
|
|
131
|
+
|---|---|
|
|
132
|
+
| 5.0.x → 5.1.0 | **Trusted reinstall.** 5.1.0 changes native helpers (protected unlock dialog, Discord review). Build the reviewed 5.1.0 checkout ([step 1](#1-build-from-a-reviewed-checkout)), rerun the service install ([step 2](#2-install-the-privileged-service)) from an elevated terminal, then from a normal terminal run `npm.cmd install --global u-chan-secrets@5.1.0`, `u-chan.cmd setup --apply`, and `u-chan unlock`. |
|
|
133
|
+
| 5.1.0 or later with `coordinated_update` | `u-chan update --check`, then `u-chan update` from a normal terminal. See [coordinated updates](#coordinated-updates). |
|
|
134
|
+
| 4.x / 5.0.0 → 5.0.1 | `npm.cmd install --global u-chan-secrets@5.0.1`, `u-chan.cmd update`, `u-chan.cmd setup --apply`, `u-chan doctor`. |
|
|
135
|
+
| 3.0.0–3.0.2 | See [older versions](#older-versions). |
|
|
136
|
+
| V2 data | See [backup and rollback](#backup-and-rollback). |
|
|
137
|
+
| V1 data | See [older versions](#older-versions). |
|
|
138
|
+
|
|
139
|
+
Reinstall preserves the existing owner, settings, grants, and vault data. Every service restart clears the in-memory vault unlock: enter the master password only in `u-chan unlock`'s protected prompt. **Do not uninstall as an upgrade shortcut: uninstall deletes the data.**
|
|
140
|
+
|
|
141
|
+
### Coordinated updates
|
|
142
|
+
|
|
143
|
+
Run `u-chan update --check` for a read-only plan, then `u-chan update` from a normal desktop terminal. The service and desktop independently verify the same signed registry artifact. Compatibility checks run before either installation changes. Windows application supports unchanged native helpers, dependency declarations, and a compatible Node runtime. macOS application is currently unsupported; planning remains available. Services without `coordinated_update` require a matching trusted desktop/service bootstrap; there is no legacy service-only fallback.
|
|
144
|
+
|
|
145
|
+
The command reports phases and elapsed time. It stages both components before restarting the service, waits for authenticated readiness from the target boot, then installs the desktop package with npm scripts disabled. A desktop-only change does not restart or relock the service. A service restart clears its in-memory unlock; enter any subsequent password only through `u-chan unlock`'s protected prompt. Update never unlocks automatically or launches a browser. Restart existing AI sessions when the final result requests it.
|
|
146
|
+
|
|
147
|
+
Interrupted terminal? Rerun `u-chan update` to observe the protected transaction and resume desktop work. A duplicate desktop invocation reports busy. A 15-minute observation timeout does not cancel an active service transaction. Unknown artifact identity, same-version local changes, and builds ahead of the published release require explicit trusted reconciliation, not an automatic downgrade. A completed npm install with a missing receipt can recover only from its matching desktop checkpoint and a fresh exact artifact verification.
|
|
148
|
+
|
|
149
|
+
Service rollback copies remain under `%ProgramData%\u-chan-secrets\#0 backup\update-<transaction-id>`. Failed target programs and job status remain under `updates\<transaction-id>`. Desktop rollback tarballs remain under `%APPDATA%\u-chan-secrets\#0 backup\update-<stage-id>\before`; the bounded `desktop-update.json` checkpoint identifies that stage. No automatic cleanup scans historical backups. Target startup failure restores the source program and verifies source readiness. `recovery_required` blocks credential work until trusted recovery. If automatic recovery fails, stop the service in an administrator terminal, preserve both programs, and restore the retained source using the trusted installer procedure. If desktop verification fails, rerun update; if its files are incomplete, reinstall the matching verified desktop release or its retained rollback tarball from a normal terminal using npm with `--ignore-scripts`, then repair managed registrations with `u-chan setup --apply`.
|
|
150
|
+
|
|
151
|
+
Source validation and native process fixtures do not publish the feature or upgrade an installed service. See the [validation boundaries](docs/superpowers/research/2026-11-06-update-workflow-validation.md).
|
|
152
|
+
|
|
153
|
+
### Backup and rollback
|
|
154
|
+
|
|
155
|
+
Use a trusted administrator reinstall for the first V3 installation; the thin client alone does not upgrade native helpers or private executables. Windows reinstall stops the service, waits for shutdown, stages a fresh private program copy, preserves the old program under protected `#0 backup`, and reuses service registration. Existing settings and grants remain.
|
|
156
|
+
|
|
157
|
+
Before the first grant-state mutation, the service creates a protected `#0 backup/v2-before-v3` snapshot and a `schema.json` marker. The snapshot may contain privileged configuration and encrypted vault data: never copy it into a user-readable checkout. Incomplete backups block mutation rather than being overwritten.
|
|
158
|
+
|
|
159
|
+
Supported V3 tooling refuses V2 downgrade after migration. Historical V2 administrator tools cannot enforce a newer schema guard. A deliberate rollback requires stopping the service, inspecting/restoring the protected pre-V3 state, and acknowledging that old permanent approvals return. Do not uninstall as an upgrade shortcut: uninstall deletes the data.
|
|
160
|
+
|
|
161
|
+
Package updates verify registry signatures and integrity and retain private dependencies. Changed dependencies or native helpers require a trusted administrator reinstall. Expired/exhausted grants and already transferred website sessions are separate from vault lock and upgrade state.
|
|
162
|
+
|
|
163
|
+
### Older versions
|
|
164
|
+
|
|
165
|
+
Versions 3.0.0–3.0.2 have an npm signature-verification defect and cannot reliably bootstrap their own update. Install the matching corrected package from a trusted shell, then use the administrator reinstall above. Version 3.0.3 requires SHA-512 integrity and a valid signature from its pinned npm key; unsigned repository-attestation JSON cannot replace that signature. Future signing-key rotation fails closed and requires a trusted verifier upgrade.
|
|
166
|
+
|
|
167
|
+
For V1 data, use `u-chan import-v1 [path]`: each entry requires protected approval. Retire user-side Bitwarden sessions and the old `bw-session` file through a trusted migration process; never copy them into the service as trusted authorization.
|
|
168
|
+
|
|
169
|
+
**5.0.1 update notes.** The signed service update restarts U-Chan and clears its in-memory vault unlock. Run `u-chan unlock` afterward and enter the master password only in the protected prompt. The explicit `.cmd` spelling bootstraps setup when npm's PowerShell launcher is blocked; afterward the short `u-chan` command works. Restart the AI session if setup requests it. Existing browser choice, grants, and vault data remain local; a site's success condition must be approved separately on each installation. Older versions with changed dependencies or native helpers may require the trusted administrator reinstall described above.
|
|
170
|
+
|
|
178
171
|
## Daily commands
|
|
179
172
|
|
|
180
173
|
The table uses the globally installed `u-chan` spelling; from source use `node dist/cli.js` with the same arguments.
|
|
@@ -183,8 +176,9 @@ In Windows PowerShell, use `u-chan.cmd` if execution policy blocks npm's `.ps1`
|
|
|
183
176
|
|
|
184
177
|
| Command | Purpose |
|
|
185
178
|
|---|---|
|
|
179
|
+
| `start` | Windows daily start: dedicated browser, protected unlock if locked, doctor report |
|
|
186
180
|
| `doctor [--json]` | Read-only diagnostic report and safe next actions |
|
|
187
|
-
| `setup [--client codex] [--browser chrome\|edge] [--apply] [--replace-existing] [--start-browser] [--json]` | Windows desktop inspection and explicit Codex/browser setup |
|
|
181
|
+
| `setup [--client codex\|claude\|all] [--browser chrome\|edge] [--apply] [--replace-existing] [--start-browser] [--json]` | Windows desktop inspection and explicit Codex and/or Claude Code/browser setup; without `--client`, configures every client CLI found on PATH |
|
|
188
182
|
| `allow <domain> --login-url <https-url> --item <label> [--once\|--minutes N\|--permanent] [--success-url URL\|--success-selector SELECTOR]` | Propose a scoped grant through protected approval |
|
|
189
183
|
| `manage` | Native status, grant pages, recent activity, lock/unlock, and revocation |
|
|
190
184
|
| `unlock` | Request the protected master-password prompt |
|
|
@@ -192,7 +186,7 @@ In Windows PowerShell, use `u-chan.cmd` if execution policy blocks npm's `.ps1`
|
|
|
192
186
|
| `mode <easy\|hardcore>` | Change approval mode; lowering protection requires a protected password check |
|
|
193
187
|
| `audit [limit]` | Read recent service audit records |
|
|
194
188
|
| `import-v1 [path]` | Approve each imported entry in a protected window; imported grants are permanent |
|
|
195
|
-
| `update` |
|
|
189
|
+
| `update [--check]` | Plan or apply a coordinated compatible desktop/service update; some changes require trusted reinstall |
|
|
196
190
|
| `install [--mode <easy\|hardcore>] [--phrase <phrase>]` | Privileged install/reinstall; existing settings are preserved |
|
|
197
191
|
| `uninstall` | Privileged removal of the service **and all its data** |
|
|
198
192
|
|
|
@@ -247,19 +241,167 @@ Without approved evidence, a generic completed flow may transfer filtered state
|
|
|
247
241
|
|
|
248
242
|
The service supports Bitwarden TOTP for recognized one-time-code fields. Passwords, TOTP seeds, and generated codes stay inside the privileged login flow. CAPTCHA, device verification, and unsupported challenges require the user; the AI must not request the underlying credentials.
|
|
249
243
|
|
|
250
|
-
##
|
|
244
|
+
## Setup reference
|
|
251
245
|
|
|
252
|
-
Use a
|
|
246
|
+
Use a normal, non-administrator terminal after installing the matching trusted service:
|
|
253
247
|
|
|
254
|
-
|
|
248
|
+
```powershell
|
|
249
|
+
u-chan setup --json
|
|
250
|
+
u-chan setup --apply
|
|
251
|
+
u-chan setup --apply --replace-existing --start-browser
|
|
252
|
+
```
|
|
255
253
|
|
|
256
|
-
|
|
254
|
+
The first command only inspects. `--apply` adds missing MCP registrations through the official Codex and Claude Code CLIs (`codex mcp`, `claude mcp --scope user`). `--replace-existing` also permits replacement of recognized simple registrations. Existing configuration is backed up before mutation, under `~/.codex/#0 backup` (or `$CODEX_HOME`) and `~/.claude/#0 backup` (or `$CLAUDE_CONFIG_DIR`). Compatible enabled registrations retain custom environment, working directory, tool filters, timeouts, and other settings. Incompatible custom registrations, conflicting target overrides, disabled entries, and HTTP transports require manual configuration and remain untouched. Partial failures retain completed changes and the backup; setup never restores an obsolete whole configuration over concurrent edits.
|
|
257
255
|
|
|
258
|
-
|
|
256
|
+
`--start-browser` explicitly starts the selected dedicated browser profile in the background when its endpoint is unhealthy. No startup task is added. Setup refuses elevated execution and known service/desktop browser-target mismatches. It never installs the privileged service or changes UAC. Run `u-chan install` separately from a trusted administrator terminal.
|
|
259
257
|
|
|
260
|
-
|
|
258
|
+
Setup reports `configured` or `needs_attention`, plus `sharing` and `restartRequired`. `process_configured` means matching process arguments were observed; it does not verify active AI-session ownership. Unobservable sharing remains `unobserved`. Restart the AI session after registration changes. Exit codes: 1 means attention required, 2 means configured with restart required, and 0 means configured without a known restart requirement. A locked vault remains a valid installed state.
|
|
261
259
|
|
|
262
|
-
|
|
260
|
+
Automatic registration supports Codex and Claude Code on Windows only. Configure other clients and platforms manually (see [step 3](#3-connect-ai-clients-and-the-browser)). macOS runtime remains unverified. `doctor` compares the actual CLI and installed service versions, both browser targets, and Windows UAC policy; missing metadata remains unknown. `manage` shows the installed service version and browser status.
|
|
261
|
+
|
|
262
|
+
On Windows, `setup --apply` also makes the short `u-chan` command work when PowerShell blocks scripts. It moves the recognized npm-generated `u-chan.ps1` launcher into the npm directory's `#0 backup`, leaving `u-chan.cmd` available for PowerShell to resolve automatically. Execution policy and PowerShell profiles are unchanged. Inspection without `--apply` is read-only, and custom launchers are preserved. If the first setup command is blocked, run `u-chan.cmd setup --apply`. Rerun setup after an npm installation or update recreates the PowerShell launcher. Shell results and the backup path appear in the setup JSON report.
|
|
263
|
+
|
|
264
|
+
### Browser choice and session transfer
|
|
265
|
+
|
|
266
|
+
Choose your browser from a normal Windows terminal:
|
|
267
|
+
|
|
268
|
+
```powershell
|
|
269
|
+
u-chan setup --browser edge --json
|
|
270
|
+
u-chan setup --browser edge --apply --replace-existing --start-browser
|
|
271
|
+
u-chan setup --browser chrome --apply --replace-existing --start-browser
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The first command inspects the proposed choice. `--apply` saves it in user-side `browser.json` and registers the matching MCP environment through the official Codex CLI. Later commands without `--browser` keep the saved choice; a new installation defaults to Chrome. Browser and Codex configuration backups are retained under their respective `#0 backup` directories. Each user's choice is independent.
|
|
275
|
+
|
|
276
|
+
Chrome and Edge use separate dedicated profiles. Only one browser owns the configured U-Chan CDP endpoint at a time. When switching, close the previous **dedicated U-Chan instance** and rerun setup; keep your personal browser windows open. U-Chan refuses wrong, unknown, personal-profile, or non-loopback listeners instead of silently attaching, selecting another port/browser, or terminating processes. It does not install browsers or change enterprise debugging policy. The legacy `scripts/start-chrome.ps1` explicitly selects Chrome; `scripts/start-browser.ps1 -Browser edge` selects Edge.
|
|
277
|
+
|
|
278
|
+
The service independently checks the installed owner's SID and dedicated profile before accessing the Windows destination. It derives that user's AppData paths from the profile registry. Advanced installations with a custom desktop profile root must align the trusted service environment's `U_CHAN_DESKTOP_HOME` with the user-side home; changing only a user-side environment variable does not redirect privileged session transfer.
|
|
279
|
+
|
|
280
|
+
An approved exact URL or visible selector must match in both the private login context and a new verification tab in the destination browser before `login` returns success. Existing user tabs are left alone. Missing evidence returns `authentication_unconfirmed`; private success with unverified desktop state returns `destination_unconfirmed`. Transfer failure/cancellation can leave partial session state and does not log the browser out. Expired or consumed grants are not refunded.
|
|
281
|
+
|
|
282
|
+
The private credential-bearing context uses a per-attempt HTTP/CONNECT proxy to block network destinations outside approved hosts, including redirect chains and worker/frame requests. Service workers are disabled. Private Chromium disables HTTP/2 and QUIC so connections cannot coalesce across approved and unapproved origins; HTTP/2-only sites may be unsupported. TLS remains end-to-end with normal browser certificate validation. Some sites requiring third-party resources or external identity providers also remain unsupported; U-Chan does not silently broaden host approval. CAPTCHA, passkey, push approval, or unavailable/rejected TOTP returns `needs_human` with manual sign-in guidance. V5 does not expose or resume the private challenge context, repeat credential submissions, or ask for passwords/codes in AI chat.
|
|
283
|
+
|
|
284
|
+
A V5 client requires the service's `verified_session_transfer` capability before login and binds the request to its selected browser. Update both CLI and service; an older service is refused before a login attempt is sent. An old client without a browser field retains its legacy Chrome destination. A stale MCP browser environment that conflicts with the saved choice is refused until the AI session restarts. Existing grants and vault data remain compatible. Native macOS runtime and ownership by an already-running AI session remain unverified.
|
|
285
|
+
|
|
286
|
+
Other MCP clients may set `U_CHAN_BROWSER=edge` (or `chrome`) and the matching loopback `U_CHAN_CDP` in their own registration, then launch the matching dedicated browser. Automatic registration remains Windows/Codex only; setting a desktop environment variable does not change the privileged service's endpoint.
|
|
287
|
+
|
|
288
|
+
### Site grants from the CLI
|
|
289
|
+
|
|
290
|
+
Propose a site grant with an explicit success condition:
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
u-chan allow example.com --login-url https://example.com/login --item "Example account" --once --success-url https://example.com/dashboard
|
|
294
|
+
u-chan allow example.com --login-url https://example.com/login --item "Example account" --minutes 30 --success-selector "button[data-action='sign-out']"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The service still requires protected approval. The CLI defaults to one login attempt; timed approvals accept 1–1440 whole minutes, and `--permanent` requests permanent future logins. URL and selector success conditions are mutually exclusive. Without one, login may return `authentication_unconfirmed`; independently verify the signed-in page. Grant expiry does not log out an already transferred browser session.
|
|
298
|
+
|
|
299
|
+
## Discord broker
|
|
300
|
+
|
|
301
|
+
The Windows service can use a Bitwarden bot token to configure **existing approved Discord servers**, without returning the token to the agent. This source upgrade requires a **trusted administrator reinstall** because its protected review helper changes. It is not available merely by updating the desktop MCP package. Existing website tools remain unchanged; macOS Discord requests fail closed.
|
|
302
|
+
|
|
303
|
+
The bot must already belong to the target server and have the needed Discord permissions and role hierarchy. Approve one connection for server/role/channel metadata. Every write batch then requires a protected prompt displaying its exact changes. The connection never authorizes unattended writes.
|
|
304
|
+
|
|
305
|
+
1. Keep the token in the login password or an explicitly named **hidden** custom field of your Bitwarden item. A username is not required for password-field token use. Never put the token in the following JSON files, chat, command arguments, or MCP configuration.
|
|
306
|
+
2. Create `discord-connection.json` using the exact server ID and your item reference (prefer its UUID). Example IDs below are placeholders, not a real target:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"alias": "vdn",
|
|
311
|
+
"item": "VDN Discord Bot",
|
|
312
|
+
"field": { "kind": "password" },
|
|
313
|
+
"guildId": "123456789012345678"
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
For a custom field, replace `field` with `{ "kind": "hidden", "name": "Bot token" }`. Missing, visible, or duplicate matching custom fields fail without fallback.
|
|
318
|
+
|
|
319
|
+
If the item already contains the setup information, use just `{ "alias": "vdn", "item": "VDN Discord Bot" }`. U-Chan first requests protected permission to discover metadata, then separately requests approval of the exact server ID, resolved item UUID, and token-field selector. No token value or raw note content is returned. Discovery accepts one server ID labeled `Guild ID`, `Server ID`, `Discord Guild ID`, or `Discord Server ID` in custom fields, note lines, or a top-level JSON note object. Application/client IDs are not server IDs. A single password or hidden field named `Token`, `Bot token`, `Discord token`, or `Discord bot token` supplies the selector. Ambiguous IDs/fields fail; provide both explicit `guildId` and `field` to resolve ambiguity. Protected state always stores the complete exact connection, never an unresolved discovery request.
|
|
320
|
+
|
|
321
|
+
3. After the trusted service reinstall, run from a normal terminal:
|
|
322
|
+
|
|
323
|
+
```powershell
|
|
324
|
+
u-chan doctor
|
|
325
|
+
u-chan unlock
|
|
326
|
+
u-chan discord allow discord-connection.json
|
|
327
|
+
u-chan discord list
|
|
328
|
+
u-chan discord test vdn
|
|
329
|
+
u-chan discord inspect vdn
|
|
330
|
+
u-chan discord inspect vdn --page 1
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Enter the master password only in the protected unlock prompt. Confirm the connection's item, field, and exact server ID in the protected approval. Metadata pages return one channel and one role, with `nextPage` and totals. Follow pages for complete results. An optional member ID inspects that member's role IDs: `u-chan discord inspect vdn 223456789012345678`.
|
|
334
|
+
|
|
335
|
+
`u-chan discord test <alias>` (PowerShell may require `u-chan.cmd`) checks an existing approved connection through read-only metadata inspection. Success reports `status: "connected"`, server ID, channel count, and role count. Failures retain service guidance for locked vaults, missing approval, unavailable services, or Discord rejection. It never grants access, changes resources, returns raw metadata, or proves write permissions. Agents can use the equivalent `discord_test_connection` tool. This desktop-only feature works with an installed service that already supports `discord_broker`; no service reinstall or vault relock is needed.
|
|
336
|
+
|
|
337
|
+
4. Put a requested tournament setup batch in `discord-operations.json`, then review it through U-Chan:
|
|
338
|
+
|
|
339
|
+
```json
|
|
340
|
+
[
|
|
341
|
+
{ "type": "role_create", "name": "Debater", "permissions": "1024" },
|
|
342
|
+
{ "type": "role_create", "name": "Adjudicator", "permissions": "1024" },
|
|
343
|
+
{ "type": "channel_create", "kind": "category", "name": "Tournament" }
|
|
344
|
+
]
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
```powershell
|
|
348
|
+
u-chan discord apply vdn discord-operations.json
|
|
349
|
+
u-chan discord revoke vdn
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
New resource IDs are returned after creation. Use those IDs in a later approved batch to create child channels, assign roles, or set permissions. Each batch is limited to 10 operations and 8 KiB of canonical JSON; larger review displays must be split further. Overlapping existing targets are rejected before approval; combine fields into one edit or use separate batches. Server state is checked again after approval, so conflicting changes and indirect role-position shifts may stop execution. Revoke also works from `u-chan manage` using the distinctly labeled Discord target.
|
|
353
|
+
|
|
354
|
+
Supported operations and payload fields:
|
|
355
|
+
|
|
356
|
+
| `type` | Fields |
|
|
357
|
+
|---|---|
|
|
358
|
+
| `role_create` | `name`; optional `permissions` (decimal string, default `"0"`), `color` (integer), `hoist`, `mentionable` |
|
|
359
|
+
| `role_edit` | `roleId`, nonempty `changes` using the role fields above |
|
|
360
|
+
| `role_reorder` | `positions`: array of `{ "id": "...", "position": 1 }` |
|
|
361
|
+
| `channel_create` | `kind`: `category`, `text`, or `voice`; `name`; optional `parentId`, `topic` (text only), `overwrites` |
|
|
362
|
+
| `channel_edit` | `channelId`, nonempty `changes`: `name`, `parentId`, `topic`, `overwrites` |
|
|
363
|
+
| `channel_reorder` | `positions`: array of `{ "id": "...", "position": 1 }` |
|
|
364
|
+
| `member_role_add`, `member_role_remove` | `memberId`, `roleId` |
|
|
365
|
+
|
|
366
|
+
An overwrite is `{ "id": "...", "type": 0, "allow": "1024", "deny": "2048" }`: type 0 targets a role; type 1 targets a verified server member. **Supplying `overwrites` replaces that channel's overwrite list**, which can expose private channels. The protected review displays numeric bits and known permission names; the server ID denotes `@everyone`. Unknown permission bits and administrator grants, including assignment of an existing administrator role, are refused. Managed roles and the bot's authority roles are protected. Discord itself also enforces permissions and hierarchy.
|
|
367
|
+
|
|
368
|
+
No deletion, messages, kicks/bans, server creation, webhook access, arbitrary HTTP, or secret-injected shell execution is exposed. A batch stops at its first failure without rollback. Results distinguish completed operations, operations not sent, and unknown write outcomes. **Inspect the server before retrying an unknown outcome**; U-Chan does not replay uncertain writes. Rate-limit results provide `retryAfter` where available.
|
|
369
|
+
|
|
370
|
+
Agents get six additional tools: `discord_request_allow`, `discord_list_allowed`, `discord_test_connection`, `discord_inspect`, `discord_apply`, and `discord_revoke`. Website login and Discord approval are separate. An old service returns an upgrade-required error. Restart the AI session after configuring the updated desktop package to discover the additional tools.
|
|
371
|
+
|
|
372
|
+
Connection metadata resides in protected `discord-allowlist.json`; tokens remain in Bitwarden and service memory. The service snapshots protected metadata under protected `#0 backup` before its first broker state mutation per process. Reinstallation preserves connections; a compatible older service leaves the separate file inert. Revocation and vault lock cannot undo completed Discord changes or recall an already dispatched request. See [validation status](docs/superpowers/research/2026-11-06-discord-broker-validation.md) before treating source checks as installed verification.
|
|
373
|
+
|
|
374
|
+
## GitHub connector and agent unlock
|
|
375
|
+
|
|
376
|
+
5.1.0 adds agent-triggered protected unlock and a repository-scoped GitHub connector. A matching installed service and fresh AI session are required. See [setup, supported actions, and boundaries](docs/github-connector.md) and [validation scope](docs/superpowers/research/2026-11-06-agent-unlock-github-validation.md).
|
|
377
|
+
|
|
378
|
+
## Release history
|
|
379
|
+
|
|
380
|
+
### 5.1
|
|
381
|
+
|
|
382
|
+
- **Claude Code setup:** `u-chan setup --client claude [--apply] [--replace-existing]` checks the user-scope `u-chan-secrets` and `playwright` registrations in `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`) and repairs a Playwright entry missing `--cdp-endpoint`. Inspection reads the file without changing it; changes go through `claude mcp remove`/`add-json --scope user` after a backup in `~/.claude/#0 backup`. Custom registrations are preserved and reported for manual configuration.
|
|
383
|
+
- **Multi-client setup:** without `--client`, `u-chan setup` inspects (and with `--apply`, configures) every Codex and Claude Code CLI found on PATH; `--client all` targets both explicitly. Each client is attempted independently, the report lists per-client results, and the overall state is the least ready one.
|
|
384
|
+
- **Daily start:** `u-chan start` starts the selected dedicated browser when its endpoint is down, opens the protected unlock prompt only when the vault is locked, then prints the doctor report. It needs no administrator rights and changes no configuration. It exits 1 if a required check fails or the vault remains locked. Windows only.
|
|
385
|
+
|
|
386
|
+
### V5
|
|
387
|
+
|
|
388
|
+
Version `5.0.0` adds selectable Chrome/Edge desktop destinations and checks approved login evidence before and after session transfer. Chrome remains the default when no browser has been selected. Protocol and protected-state schema remain version 3. Source integration, publication, and installed verification are separate events.
|
|
389
|
+
|
|
390
|
+
### V4
|
|
391
|
+
|
|
392
|
+
The [Windows V4 rollout](docs/superpowers/research/2026-10-29-v4-rollout.md) records matching service/CLI versions, preserved protected state, real setup and fresh MCP/browser checks. It builds on the tightened V3.0.3 [native closeout](docs/superpowers/research/2026-10-29-v3-windows-closeout.md). macOS runtime remains unverified; source merge, installed verification, and package publication are recorded separately.
|
|
393
|
+
|
|
394
|
+
### V3
|
|
395
|
+
|
|
396
|
+
- **Diagnose:** `u-chan doctor` explains service, vault, permission, Chrome, and browser-sharing problems without fetching credentials or repairing configuration.
|
|
397
|
+
- **Limit approval:** approve one login attempt, a fixed duration, or permanent future logins.
|
|
398
|
+
- **Confirm outcomes:** an approved URL or selector provides authentication evidence; generic form completion remains explicitly unconfirmed.
|
|
399
|
+
- **Manage access:** `u-chan manage` shows grant pages and recent sanitized activity, with lock, unlock, and revoke actions.
|
|
400
|
+
- **Preserve state:** privileged migration backup, schema/downgrade guards, and state-preserving reinstall replace manual editing of protected files.
|
|
401
|
+
|
|
402
|
+
Windows Hello and Touch ID remain [research only](docs/superpowers/research/2026-10-29-native-approval.md). Linux, general SSO/OAuth, passkeys, and automated CAPTCHA solving are outside V3.
|
|
403
|
+
|
|
404
|
+
See [CHANGELOG.md](CHANGELOG.md) for full notes.
|
|
263
405
|
|
|
264
406
|
## Validation and security
|
|
265
407
|
|