clay-server 2.27.0-beta.4 → 2.27.0-beta.5

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.
Files changed (2) hide show
  1. package/lib/server.js +23 -19
  2. package/package.json +1 -1
package/lib/server.js CHANGED
@@ -15,6 +15,7 @@ var { CONFIG_DIR } = require("./config");
15
15
  var { provisionLinuxUser } = require("./os-users");
16
16
 
17
17
  var https = require("https");
18
+ var pkg = require("../package.json");
18
19
 
19
20
  var publicDir = path.join(__dirname, "public");
20
21
  var bundledThemesDir = path.join(__dirname, "themes");
@@ -1124,31 +1125,34 @@ function createServer(opts) {
1124
1125
  return;
1125
1126
  }
1126
1127
 
1127
- // Health check endpoint (no auth required, for monitoring tools)
1128
+ // Health check endpoint
1129
+ // Unauthenticated: minimal liveness info only
1130
+ // Authenticated: full system details (memory, pid, version, sessions)
1128
1131
  if (req.method === "GET" && fullUrl === "/api/health") {
1129
- var mem = process.memoryUsage();
1130
- var activeSessions = 0;
1131
- projects.forEach(function (ctx) {
1132
- if (ctx && ctx.clients) {
1133
- activeSessions += ctx.clients.size || 0;
1134
- }
1135
- });
1136
- var pkg = require("../package.json");
1137
1132
  var health = {
1138
1133
  status: "ok",
1139
- uptime: process.uptime(),
1140
- version: pkg.version,
1141
- node: process.version,
1142
- sessions: activeSessions,
1143
- projects: projects.size,
1144
- memory: {
1134
+ timestamp: new Date().toISOString(),
1135
+ };
1136
+ if (isRequestAuthed(req)) {
1137
+ var mem = process.memoryUsage();
1138
+ var activeSessions = 0;
1139
+ projects.forEach(function (ctx) {
1140
+ if (ctx && ctx.clients) {
1141
+ activeSessions += ctx.clients.size || 0;
1142
+ }
1143
+ });
1144
+ health.uptime = process.uptime();
1145
+ health.version = pkg.version;
1146
+ health.node = process.version;
1147
+ health.sessions = activeSessions;
1148
+ health.projects = projects.size;
1149
+ health.memory = {
1145
1150
  rss: mem.rss,
1146
1151
  heapUsed: mem.heapUsed,
1147
1152
  heapTotal: mem.heapTotal,
1148
- },
1149
- pid: process.pid,
1150
- timestamp: new Date().toISOString(),
1151
- };
1153
+ };
1154
+ health.pid = process.pid;
1155
+ }
1152
1156
  res.writeHead(200, { "Content-Type": "application/json" });
1153
1157
  res.end(JSON.stringify(health));
1154
1158
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.27.0-beta.4",
3
+ "version": "2.27.0-beta.5",
4
4
  "description": "Self-hosted Claude Code in your browser. Multi-session, multi-user, push notifications.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",