horizon-code 0.3.2 → 0.3.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "horizon-code",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "AI-powered trading strategy terminal for Polymarket",
5
5
  "type": "module",
6
6
  "bin": {
package/src/app.ts CHANGED
@@ -907,7 +907,8 @@ export class App {
907
907
  this.authenticated = loggedIn;
908
908
 
909
909
  const cfg = loadConfig();
910
- const email = cfg.user_email || getUser()?.email || undefined;
910
+ const rawEmail = cfg.user_email || getUser()?.email;
911
+ const email = typeof rawEmail === "string" ? rawEmail : undefined;
911
912
 
912
913
  if (!loggedIn) {
913
914
  this.splash.setAuthStatus(false);
@@ -17,7 +17,6 @@ export class Footer {
17
17
  id: "footer",
18
18
  height: 1,
19
19
  width: "100%",
20
- backgroundColor: COLORS.bgDarker,
21
20
  flexDirection: "row",
22
21
  alignItems: "center",
23
22
  paddingLeft: 2,
@@ -31,7 +31,6 @@ export class InputBar {
31
31
  width: "100%",
32
32
  flexDirection: "column",
33
33
  paddingLeft: 4,
34
- backgroundColor: COLORS.bgSecondary,
35
34
  });
36
35
  this.acBox.visible = false;
37
36
  this.container.add(this.acBox);
@@ -52,7 +51,6 @@ export class InputBar {
52
51
  width: "100%",
53
52
  flexDirection: "row",
54
53
  alignItems: "center",
55
- backgroundColor: COLORS.bgDarker,
56
54
  paddingLeft: 2,
57
55
  });
58
56
  this.container.add(inputRow);
@@ -34,7 +34,6 @@ export class TabBar {
34
34
  width: "100%",
35
35
  flexDirection: "row",
36
36
  alignItems: "center",
37
- backgroundColor: COLORS.bgDarker,
38
37
  flexShrink: 0,
39
38
  paddingLeft: 1,
40
39
  });
@@ -214,7 +214,10 @@ export async function loginWithBrowser(): Promise<{ success: boolean; error?: st
214
214
  // Save everything
215
215
  const config = loadConfig();
216
216
  saveSessionTokens(config, sd.session.access_token, sd.session.refresh_token);
217
- config.user_email = data.email || sd.session.user.email;
217
+ // Defensively extract email server might return string or object
218
+ const rawEmail = data.email ?? sd.session.user.email ?? sd.session.user?.user_metadata?.email;
219
+ const email = typeof rawEmail === "string" ? rawEmail : typeof rawEmail === "object" && rawEmail !== null ? (rawEmail as any).address ?? (rawEmail as any).email ?? String(rawEmail) : "";
220
+ config.user_email = email;
218
221
  config.user_id = sd.session.user.id;
219
222
 
220
223
  if (!config.api_key) {
@@ -227,7 +230,7 @@ export async function loginWithBrowser(): Promise<{ success: boolean; error?: st
227
230
  }
228
231
 
229
232
  saveConfig(config);
230
- return { success: true, email: data.email };
233
+ return { success: true, email };
231
234
  }
232
235
  }
233
236
  if (res.status === 410) return { success: false, error: "Session expired. Type /login to sign in again." };
@@ -249,7 +252,8 @@ export async function loginWithPassword(email: string, password: string): Promis
249
252
 
250
253
  const config = loadConfig();
251
254
  saveSessionTokens(config, data.session.access_token, data.session.refresh_token);
252
- config.user_email = data.session.user.email ?? email;
255
+ const userEmail = data.session.user.email;
256
+ config.user_email = typeof userEmail === "string" ? userEmail : email;
253
257
  config.user_id = data.session.user.id;
254
258
 
255
259
  if (!config.api_key) {