Skip to content

Commit 9613d44

Browse files
committed
feat(ai): Enhance Neural Link health check response (#8331)
- Remove redundant 'details' array - Add structured 'sessions', 'windows', and 'agents' lists - Include window dimensions in 'windows' list - Update openapi.yaml schema
1 parent b6080d7 commit 9613d44

5 files changed

Lines changed: 105 additions & 41 deletions

File tree

.github/ISSUE/issue-8169.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ subIssues:
6666
- '[x] 8280 [Neural Link] Feature: Tool inspect_class'
6767
- '[x] 8281 [Neural Link] Feature: Tool get_computed_styles'
6868
subIssuesCompleted: 68
69-
subIssuesTotal: 70
69+
subIssuesTotal: 71
7070
blockedBy: []
7171
blocking: []
7272
---

.github/ISSUE/issue-8331.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
id: 8331
3+
title: Enhance Neural Link Health Check Response
4+
state: OPEN
5+
labels:
6+
- enhancement
7+
- ai
8+
- architecture
9+
assignees:
10+
- tobiu
11+
createdAt: '2026-01-05T11:51:14Z'
12+
updatedAt: '2026-01-05T11:51:31Z'
13+
githubUrl: 'https://github.com/neomjs/neo/issues/8331'
14+
author: tobiu
15+
commentsCount: 0
16+
parentIssue: 8169
17+
subIssues: []
18+
subIssuesCompleted: 0
19+
subIssuesTotal: 0
20+
blockedBy: []
21+
blocking: []
22+
---
23+
# Enhance Neural Link Health Check Response
24+
25+
The current `healthcheck` response contains a redundant `details` array and lacks specific identification for active sessions and windows.
26+
27+
**Goal:**
28+
1. Remove the `details` array.
29+
2. Enrich the response object to include:
30+
- `sessions`: List of active App Worker Sessions (id, connectedAt).
31+
- `windows`: List of connected Windows (id, appName, width, height, x, y).
32+
- `agents`: List of other connected Agents (ids).
33+
34+
**Rationale for Dimensions:**
35+
Including basic dimensions (width/height) helps immediately distinguish between main application windows and smaller popups/dialogs without requiring an extra `get_window_topology` call, saving agent turns.
36+
37+
**Changes:**
38+
- `ConnectionService.getStatus()`: Return richer window metadata.
39+
- `HealthService.healthcheck()`: Construct the new response payload.
40+
- `openapi.yaml`: Update `HealthCheckResponse` schema.
41+
42+
Reference: #8169 (Epic)
43+
44+
## Activity Log
45+
46+
- 2026-01-05 @tobiu added the `enhancement` label
47+
- 2026-01-05 @tobiu added the `ai` label
48+
- 2026-01-05 @tobiu added the `architecture` label
49+
- 2026-01-05 @tobiu assigned to @tobiu
50+
- 2026-01-05 @tobiu added parent issue #8169
51+

ai/mcp/server/neural-link/openapi.yaml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,18 +1231,35 @@ components:
12311231
type: string
12321232
port:
12331233
type: integer
1234-
session:
1235-
type: object
1236-
properties:
1237-
activeApps:
1238-
type: integer
1239-
connectedWindows:
1240-
type: integer
1241-
agents:
1242-
type: array
1243-
items:
1234+
sessions:
1235+
type: array
1236+
items:
1237+
type: object
1238+
properties:
1239+
id:
1240+
type: string
1241+
connectedAt:
1242+
type: number
1243+
activeApps:
1244+
type: integer
1245+
windows:
1246+
type: array
1247+
items:
1248+
type: object
1249+
properties:
1250+
id:
1251+
type: string
1252+
appName:
12441253
type: string
1245-
details:
1254+
width:
1255+
type: number
1256+
height:
1257+
type: number
1258+
x:
1259+
type: number
1260+
y:
1261+
type: number
1262+
agents:
12461263
type: array
12471264
items:
12481265
type: string

ai/mcp/server/neural-link/services/ConnectionService.mjs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,33 @@ class ConnectionService extends Base {
235235
* @returns {Object}
236236
*/
237237
getStatus() {
238-
const windows = [];
238+
const
239+
sessions = [],
240+
windows = [];
241+
242+
for (const [id, meta] of this.sessionData.entries()) {
243+
sessions.push({
244+
id,
245+
connectedAt: meta.connectedAt,
246+
activeApps : meta.windows ? meta.windows.size : 0
247+
});
239248

240-
for (const meta of this.sessionData.values()) {
241249
if (meta.windows) {
242250
for (const win of meta.windows.values()) {
243-
windows.push(win)
251+
windows.push({
252+
id : win.windowId,
253+
appName: win.appName,
254+
width : win.outerRect?.width,
255+
height : win.outerRect?.height,
256+
x : win.outerRect?.x,
257+
y : win.outerRect?.y
258+
})
244259
}
245260
}
246261
}
247262

248263
return {
249-
sessions : this.sessionData.size,
264+
sessions,
250265
windows,
251266
bridgeConnected: !!this.bridgeSocket,
252267
agentId : this.agentId,

ai/mcp/server/neural-link/services/HealthService.mjs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,11 @@ class HealthService extends Base {
3333
*/
3434
async healthcheck() {
3535
try {
36-
const status = ConnectionService.getStatus();
37-
const details = [];
38-
let health = 'healthy';
36+
const status = ConnectionService.getStatus();
37+
let health = 'healthy';
3938

4039
if (!status.bridgeConnected) {
41-
health = 'unhealthy';
42-
details.push('Not connected to Neural Link Bridge');
43-
} else {
44-
details.push('Connected to Neural Link Bridge');
45-
}
46-
47-
if (status.sessions === 0) {
48-
details.push('No active App Worker sessions');
49-
} else {
50-
details.push(`${status.sessions} active App Worker session(s)`);
51-
details.push(`${status.windows.length} connected window(s)`);
52-
}
53-
54-
if (status.agents && status.agents.length > 0) {
55-
details.push(`${status.agents.length} other agent(s) connected`);
40+
health = 'unhealthy'
5641
}
5742

5843
return {
@@ -63,20 +48,16 @@ class HealthService extends Base {
6348
agentId : status.agentId,
6449
port : ConnectionService.port
6550
},
66-
session : {
67-
activeApps : status.sessions,
68-
connectedWindows: status.windows.length,
69-
agents : status.agents || []
70-
},
71-
details,
51+
sessions : status.sessions,
52+
windows : status.windows,
53+
agents : status.agents,
7254
version : process.env.npm_package_version || '1.0.0',
7355
uptime : process.uptime()
7456
};
7557
} catch (error) {
7658
logger.error('[HealthService] Unexpected error during health check:', error);
7759
return {
7860
status : 'unhealthy',
79-
details: [`Unexpected error: ${error.message}`],
8061
error : 'Health check failed unexpectedly',
8162
message: error.message,
8263
code : 'HEALTH_CHECK_ERROR'

0 commit comments

Comments
 (0)