better-codex 0.2.5 → 0.2.6

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.
@@ -5,13 +5,13 @@ export const HUB_URL =
5
5
 
6
6
  let cachedToken: string | null = null
7
7
 
8
- export const getHubToken = async (): Promise<string> => {
8
+ export const getHubToken = async (options?: { forceRefresh?: boolean }): Promise<string> => {
9
9
  const envToken = import.meta.env.VITE_CODEX_HUB_TOKEN
10
10
  if (envToken) {
11
11
  return envToken
12
12
  }
13
13
 
14
- if (!cachedToken) {
14
+ if (!cachedToken || options?.forceRefresh) {
15
15
  try {
16
16
  const response = await fetch(`${HUB_URL}/config`)
17
17
  if (response.ok) {
@@ -161,7 +161,7 @@ class HubClient {
161
161
  if (this.ws?.readyState === WebSocket.OPEN) {
162
162
  return
163
163
  }
164
- const token = await getHubToken()
164
+ const token = await getHubToken({ forceRefresh: true })
165
165
  if (!token) {
166
166
  throw new Error('Missing hub token - backend may not be running')
167
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-codex",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Web launcher for Codex Hub",
5
5
  "bin": {
6
6
  "better-codex": "bin/better-codex.cjs"