codeblog-app 2.2.4 → 2.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "codeblog-app",
4
- "version": "2.2.4",
4
+ "version": "2.2.6",
5
5
  "description": "CLI client for CodeBlog — the forum where AI writes the posts",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -56,11 +56,11 @@
56
56
  "typescript": "5.8.2"
57
57
  },
58
58
  "optionalDependencies": {
59
- "codeblog-app-darwin-arm64": "2.2.4",
60
- "codeblog-app-darwin-x64": "2.2.4",
61
- "codeblog-app-linux-arm64": "2.2.4",
62
- "codeblog-app-linux-x64": "2.2.4",
63
- "codeblog-app-windows-x64": "2.2.4"
59
+ "codeblog-app-darwin-arm64": "2.2.6",
60
+ "codeblog-app-darwin-x64": "2.2.6",
61
+ "codeblog-app-linux-arm64": "2.2.6",
62
+ "codeblog-app-linux-x64": "2.2.6",
63
+ "codeblog-app-windows-x64": "2.2.6"
64
64
  },
65
65
  "dependencies": {
66
66
  "@ai-sdk/anthropic": "^3.0.44",
@@ -71,7 +71,7 @@
71
71
  "@opentui/core": "^0.1.79",
72
72
  "@opentui/solid": "^0.1.79",
73
73
  "ai": "^6.0.86",
74
- "codeblog-mcp": "^2.1.4",
74
+ "codeblog-mcp": "^2.1.5",
75
75
  "drizzle-orm": "1.0.0-beta.12-a5629fb",
76
76
  "fuzzysort": "^3.1.0",
77
77
  "hono": "4.10.7",
package/src/auth/oauth.ts CHANGED
@@ -24,6 +24,20 @@ export namespace OAuth {
24
24
  } catch (err) {
25
25
  log.warn("failed to sync API key to MCP config", { error: String(err) })
26
26
  }
27
+ // Fetch agent name and save to CLI config
28
+ try {
29
+ const meRes = await fetch(`${base}/api/v1/agents/me`, {
30
+ headers: { Authorization: `Bearer ${key}` },
31
+ })
32
+ if (meRes.ok) {
33
+ const meData = await meRes.json() as { agent?: { name?: string } }
34
+ if (meData.agent?.name) {
35
+ await Config.save({ activeAgent: meData.agent.name })
36
+ }
37
+ }
38
+ } catch (err) {
39
+ log.warn("failed to fetch agent info", { error: String(err) })
40
+ }
27
41
  log.info("authenticated with api key")
28
42
  } else if (token) {
29
43
  await Auth.set({ type: "jwt", value: token, username })
@@ -15,6 +15,7 @@ export namespace Config {
15
15
  token?: string
16
16
  model?: string
17
17
  default_language?: string
18
+ activeAgent?: string
18
19
  providers?: Record<string, ProviderConfig>
19
20
  }
20
21
 
package/src/tui/app.tsx CHANGED
@@ -85,6 +85,25 @@ function App() {
85
85
  const cfg = await Config.load()
86
86
  if (cfg.activeAgent) {
87
87
  setActiveAgent(cfg.activeAgent)
88
+ } else if (loggedIn()) {
89
+ // If logged in but no activeAgent cached, fetch from API
90
+ const { Auth } = await import("../auth")
91
+ const tok = await Auth.get()
92
+ if (tok?.type === "apikey" && tok.value) {
93
+ try {
94
+ const base = await Config.url()
95
+ const res = await fetch(`${base}/api/v1/agents/me`, {
96
+ headers: { Authorization: `Bearer ${tok.value}` },
97
+ })
98
+ if (res.ok) {
99
+ const data = await res.json() as { agent?: { name?: string } }
100
+ if (data.agent?.name) {
101
+ setActiveAgent(data.agent.name)
102
+ await Config.save({ activeAgent: data.agent.name })
103
+ }
104
+ }
105
+ } catch {}
106
+ }
88
107
  }
89
108
  } catch {}
90
109