@lifeaitools/clauth 0.7.3 → 0.7.4

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.
@@ -1223,6 +1223,43 @@ function createServer(initPassword, whitelist, port, tunnelHostname = null) {
1223
1223
  res.end(JSON.stringify(data));
1224
1224
  }
1225
1225
 
1226
+ // ── Build status (populated via Supabase Realtime) ─────────
1227
+ let buildStatus = { active: false, status: "idle", apps: [], updated_at: null };
1228
+
1229
+ (async () => {
1230
+ try {
1231
+ const sbUrl = (api.getBaseUrl() || "").replace("/functions/v1/auth-vault", "");
1232
+ const sbKey = api.getAnonKey();
1233
+ if (!sbUrl || !sbKey) return;
1234
+
1235
+ const { createClient: createSB } = await import("@supabase/supabase-js");
1236
+ const sb = createSB(sbUrl, sbKey);
1237
+
1238
+ // Initial fetch
1239
+ const { data } = await sb.from("prt_storage").select("value").eq("key", "build_status").single();
1240
+ if (data?.value) buildStatus = typeof data.value === "string" ? JSON.parse(data.value) : data.value;
1241
+
1242
+ // Realtime subscription
1243
+ sb.channel("build-status")
1244
+ .on("postgres_changes", { event: "*", schema: "public", table: "prt_storage", filter: "key=eq.build_status" },
1245
+ (payload) => {
1246
+ const val = payload.new?.value;
1247
+ if (val) {
1248
+ buildStatus = typeof val === "string" ? JSON.parse(val) : val;
1249
+ const logMsg = `[${new Date().toISOString()}] Build status update: ${buildStatus.status} (${buildStatus.commit?.slice(0,8) || "?"})\n`;
1250
+ try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
1251
+ }
1252
+ })
1253
+ .subscribe();
1254
+
1255
+ const logMsg = `[${new Date().toISOString()}] Build status: Realtime subscription active\n`;
1256
+ try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
1257
+ } catch (err) {
1258
+ const logMsg = `[${new Date().toISOString()}] Build status subscription failed: ${err.message}\n`;
1259
+ try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
1260
+ }
1261
+ })();
1262
+
1226
1263
  const server = http.createServer(async (req, res) => {
1227
1264
  const remote = req.socket.remoteAddress;
1228
1265
  const isLocal = remote === "127.0.0.1" || remote === "::1" || remote === "::ffff:127.0.0.1";
@@ -1596,6 +1633,11 @@ function createServer(initPassword, whitelist, port, tunnelHostname = null) {
1596
1633
  });
1597
1634
  }
1598
1635
 
1636
+ // GET /builds — CI build status (no auth required, same as /ping)
1637
+ if (method === "GET" && reqPath === "/builds") {
1638
+ return ok(res, buildStatus);
1639
+ }
1640
+
1599
1641
  // GET /mcp-setup — OAuth credentials for claude.ai MCP setup (localhost only)
1600
1642
  if (method === "GET" && reqPath === "/mcp-setup") {
1601
1643
  return ok(res, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {