@gatemux/dsh-gatemux-login 1.0.0 → 1.0.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 (3) hide show
  1. package/README.md +3 -1
  2. package/account.js +28 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -64,7 +64,9 @@ Model requests are billed to your own GateMux balance.
64
64
  ```
65
65
 
66
66
  Sign in from the app's account settings. Authorization opens in your browser and
67
- returns to the app.
67
+ returns to the app. The tab itself is left on a confirmation page — GateMux
68
+ serves no hosted completion page, so there is nothing else to show there — and it
69
+ never auto-closes; you can close it once the app is signed in.
68
70
 
69
71
  ## Models
70
72
 
package/account.js CHANGED
@@ -277,6 +277,12 @@ export class GateMuxAccount extends DeepSeekAccount {
277
277
  this.update(attempt, { phase: outcome.status === 'authorized' ? 'succeeded' : 'cancelled' })
278
278
  if (outcome.status === 'authorized' && attempt.completionUrl !== undefined) {
279
279
  attempt.callback?.writeHead(302, { location: attempt.completionUrl, 'cache-control': 'no-store' }).end()
280
+ } else if (outcome.status === 'authorized') {
281
+ // GateMux serves no hosted completion page, so this tab is the only place
282
+ // the result is visible; answering 204 would leave it blank.
283
+ this.writeCallbackPage(attempt, 'Signed in', attempt.loginSource === 'web'
284
+ ? 'Signed in to GateMux. Close this tab and continue in the original tab.'
285
+ : 'Signed in to GateMux. Close this tab and continue in DeepSeek Harness.')
280
286
  } else {
281
287
  attempt.callback?.writeHead(204, { 'cache-control': 'no-store' }).end()
282
288
  }
@@ -650,21 +656,30 @@ export class GateMuxAccount extends DeepSeekAccount {
650
656
  }
651
657
 
652
658
 
659
+ /**
660
+ * Answer the browser tab the flow was authorized in with a short page. The
661
+ * application opens that tab outside itself and never reads this response, so
662
+ * the page exists only for the person looking at it; text is static, which is
663
+ * why no script is needed and the policy can forbid every source.
664
+ * @param attempt - in-flight attempt whose callback is being answered.
665
+ * @param title - page title and heading.
666
+ * @param message - what the person should do next.
667
+ */
668
+ writeCallbackPage(attempt, title, message) {
669
+ attempt.callback?.writeHead(200, {
670
+ 'content-type': 'text/html; charset=utf-8',
671
+ 'cache-control': 'no-store',
672
+ 'content-security-policy': `default-src 'none'; frame-ancestors 'none'`,
673
+ 'referrer-policy': 'no-referrer',
674
+ }).end(`<!doctype html><html lang="en"><meta charset="utf-8"><title>${title}</title>`
675
+ + `<body><p>${message}</p></body></html>`)
676
+ }
677
+
653
678
  /** Return the browser to the application after a failed exchange. */
654
679
  finishFailedCallback(attempt) {
655
- if (attempt.loginSource === 'web') {
656
- const nonce = randomBytes(16).toString('base64url')
657
- const message = 'Sign-in failed. Close this tab and try again in the original tab.'
658
- attempt.callback?.writeHead(200, {
659
- 'content-type': 'text/html; charset=utf-8',
660
- 'cache-control': 'no-store',
661
- 'content-security-policy': `default-src 'none'; frame-ancestors 'none'`,
662
- 'referrer-policy': 'no-referrer',
663
- }).end(`<!doctype html><html lang="en"><meta charset="utf-8"><title>${message}</title>`
664
- + `<body><p>${message}</p></body></html>`)
665
- } else {
666
- attempt.callback?.writeHead(204, { 'cache-control': 'no-store' }).end()
667
- }
680
+ this.writeCallbackPage(attempt, 'Sign-in failed', attempt.loginSource === 'web'
681
+ ? 'Sign-in failed. Close this tab and try again in the original tab.'
682
+ : 'Sign-in failed. Close this tab and try again in DeepSeek Harness.')
668
683
  }
669
684
  }
670
685
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gatemux/dsh-gatemux-login",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "Sign in with GateMux for DeepSeek Harness: users pay from their own GateMux balance.",
6
6
  "publishConfig": {