@anusornneal/chat-relay 1.1.0 โ†’ 1.1.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.
@@ -64,16 +64,20 @@ function classifyResponse(response, body) {
64
64
 
65
65
  try {
66
66
  const health = JSON.parse(body);
67
- if (health?.error === "relay_unavailable") return { state: "unavailable", reason: "relay_unavailable" };
68
- if (!response.ok) return { state: "unavailable", code: response.status };
69
- if (health?.reauthorizationRequired === true) return { state: "reauthorize" };
67
+ const features = health?.features && typeof health.features === "object"
68
+ ? { learn: health.features.learn === true }
69
+ : null;
70
+ const withFeatures = (value) => features ? { ...value, features } : value;
71
+ if (health?.error === "relay_unavailable") return withFeatures({ state: "unavailable", reason: "relay_unavailable" });
72
+ if (!response.ok) return withFeatures({ state: "unavailable", code: response.status });
73
+ if (health?.reauthorizationRequired === true) return withFeatures({ state: "reauthorize" });
70
74
  if (health?.authorized === false) {
71
- return health?.enabled === false
75
+ return withFeatures(health?.enabled === false
72
76
  ? { state: "agent-disabled" }
73
- : { state: "agent-access" };
77
+ : { state: "agent-access" });
74
78
  }
75
- if (health?.online === true) return { state: "reachable" };
76
- if (health?.online === false) return { state: "unavailable", reason: "agent_offline" };
79
+ if (health?.online === true) return withFeatures({ state: "reachable" });
80
+ if (health?.online === false) return withFeatures({ state: "unavailable", reason: "agent_offline" });
77
81
  } catch {}
78
82
  if (!response.ok) return { state: "unavailable", code: response.status };
79
83
  return { state: "unavailable", code: response.status };
package/cli/tui.mjs CHANGED
@@ -119,6 +119,24 @@ function combinedStatusStyle(status, relayHealth) {
119
119
  : STYLE.red;
120
120
  }
121
121
 
122
+ function learnStatusText(value) {
123
+ if (value === true) return "enabled";
124
+ if (value === false) return "disabled";
125
+ return "checking";
126
+ }
127
+
128
+ function learnStatusStyle(value) {
129
+ if (value === true) return STYLE.green;
130
+ if (value === false) return STYLE.red;
131
+ return STYLE.yellow;
132
+ }
133
+
134
+ function compactLearnStatus(value) {
135
+ if (value === true) return "on";
136
+ if (value === false) return "off";
137
+ return "checking";
138
+ }
139
+
122
140
  export function formatTwoColumnHeader(state, width = 110, { color = false } = {}) {
123
141
  const usable = clamp(Number(width) || 110, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
124
142
  const leftWidth = Math.floor((usable - GAP) / 2);
@@ -128,7 +146,7 @@ export function formatTwoColumnHeader(state, width = 110, { color = false } = {}
128
146
  ["Status", combinedStatusText(state.status, state.relayHealth), "Relay", state.relay || "-"],
129
147
  ["Root", state.root || "-", "Reconnects", String(state.reconnects ?? 0)],
130
148
  ["Session up", formatUptime(state.uptimeMs), "Terminal", state.terminal ? "enabled" : "disabled"],
131
- ["Desktop", state.desktop ? "enabled" : "disabled", "Learn", state.learn !== false ? "enabled" : "disabled"],
149
+ ["Desktop", state.desktop ? "enabled" : "disabled", "Learn", learnStatusText(state.learn)],
132
150
  ];
133
151
  return rows
134
152
  .map(([leftLabel, leftValue, rightLabel, rightValue]) => {
@@ -138,7 +156,7 @@ export function formatTwoColumnHeader(state, width = 110, { color = false } = {}
138
156
  const rightStyle = rightLabel === "Reconnects" && Number(state.reconnects || 0) > 0
139
157
  ? STYLE.yellow
140
158
  : rightLabel === "Learn"
141
- ? (state.learn !== false ? STYLE.green : STYLE.red)
159
+ ? learnStatusStyle(state.learn)
142
160
  : null;
143
161
  return field(leftLabel, leftValue, leftWidth, color, leftStyle)
144
162
  + " ".repeat(GAP)
@@ -292,7 +310,7 @@ export class RemoteTui {
292
310
  reconnects: 0,
293
311
  terminal: config.terminalEnabled !== false,
294
312
  desktop: config.desktopEnabled === true,
295
- learn: config.learnEnabled !== false,
313
+ learn: null,
296
314
  };
297
315
  this.version = version || "-";
298
316
  this.colorEnabled = shouldUseColor(output, env);
@@ -473,6 +491,11 @@ export class RemoteTui {
473
491
  ...(health && typeof health === "object" ? health : { state: "unavailable" }),
474
492
  checkedAt: Date.now(),
475
493
  };
494
+ if (health?.features && Object.prototype.hasOwnProperty.call(health.features, "learn")) {
495
+ this.state.learn = health.features.learn === true;
496
+ } else if (health?.state === "reachable") {
497
+ this.state.learn = false;
498
+ }
476
499
  this.scheduleRender();
477
500
  }
478
501
 
@@ -497,7 +520,7 @@ export class RemoteTui {
497
520
  if (width < MIN_FRAME_WIDTH) {
498
521
  const compactHeader = [
499
522
  truncateCells(`๐Ÿ‘ค ${headerState.account || "-"} ยท ๐Ÿ’ป ${headerState.agent || "-"}`, width),
500
- truncateCells(`๐Ÿ”— ${combinedStatusText(headerState.status, headerState.relayHealth)} ยท ๐Ÿง  Learn ${headerState.learn !== false ? "on" : "off"} ยท ๐Ÿ“ ${headerState.root || "-"}`, width),
523
+ truncateCells(`๐Ÿ”— ${combinedStatusText(headerState.status, headerState.relayHealth)} ยท ๐Ÿง  Learn ${compactLearnStatus(headerState.learn)} ยท ๐Ÿ“ ${headerState.root || "-"}`, width),
501
524
  ];
502
525
  headerLines = compactHeader.map((line) => this.colorEnabled ? paint(line, STYLE.gray) : line);
503
526
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anusornneal/chat-relay",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Zero-checkout remote MCP agent for ChatGPT with terminal, filesystem, process, multi-user, and multi-agent support.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -66,6 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@modelcontextprotocol/server": "^2.0.0",
68
68
  "agents": "^0.24.0",
69
+ "esbuild": "^0.28.1",
69
70
  "wrangler": "^4.143.0",
70
71
  "zod": "^4.6.5"
71
72
  },