mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
fix(deepseek): make the Harness web tab render, not just authenticate
`dsh web` gates its own index behind a per-process launch token it prints on boot, and only that URL mints the `dsh-auth-*` cookie every later request needs. The managed tab stores the clean URL, so nothing on the browser side could present the token: the iframe rendered dsh's 401 text, a blank tab. Read the token out of the captured boot output, trade it for the cookie once at startup (`redirect: 'manual'`, since the 303 is what carries Set-Cookie), and let the proxy present it on both the HTTP and WebSocket legs. Scoped to the exact loopback authority the cookie was minted for; a token-less banner (an older dsh) keeps the previous behaviour untouched. The banner is scanned on its own 256 KB budget rather than the 16 KB error-tail buffer: a chatty profile can fill that cap before the banner prints. Authentication alone was not enough. dsh ships `<base href="./">`, which a browser resolves against the DOCUMENT url — and the proxy's runtime shim rewrites that url to strip the `/webview/<cap>/` prefix. The base therefore landed on Codeman's root: every module script 404'd and the page painted its inline `#151517` background with nothing on it (the black screen that replaced the white one). `rewriteHtml` now resolves a relative base against the proxy prefix before the mask can run, leaving a cross-origin base exactly as written. Verified against dsh 0.2.1-rc.5 and a live Codeman build: bare GET 401, captured cookie 200, proxied `/api` WebSocket 101, and a headless-Chrome load of the proxied tab boots the full Harness UI with no console errors.
This commit is contained in:
1 parent
e99b42c387
commit
0b3087918f
8 files changed
+474
-9
No files matched your search
@@ -288,6 +288,18 @@ dsh fences its `/api` behind a browser-trust check on the request authority, and
|
||||
Codeman web tab reaches it through Codeman's own origin via the webview proxy, not
|
||||
directly. Without it the page renders and every API call fails.
|
||||
|
||||
Since dsh's browser-auth gate, the index is not public either: boot prints
|
||||
`dsh web: http://127.0.0.1:<port>/?token=<one-time token>` and only a request
|
||||
carrying that token is answered with the `dsh-auth-*` cookie that authorizes
|
||||
everything after it. The saved tab deliberately keeps the clean URL, so the
|
||||
browser can never present that token, and the tab used to open on dsh's 401 page.
|
||||
`src/deepseek-web-server.ts` now reads the token out of the captured boot output,
|
||||
trades it for the cookie once at startup, and `webview-routes.ts` presents that
|
||||
cookie on both the HTTP and WebSocket legs — scoped to the exact loopback
|
||||
authority it was minted for, so a repointed or stale tab cannot carry it
|
||||
elsewhere. A dsh without the gate prints a token-less banner and keeps working
|
||||
unchanged.
|
||||
|
||||
## 7. Docker and remote cases
|
||||
|
||||
Docker cases work: the agent image installs `dsh` and bootstraps a `dsh-tui`
|
||||
|
||||
Reference in new issue
Block a user