Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: eliminate cmd window flashes on Windows by using PM2 Node.js API for jlist

[._.]/ Adam Eivye5ea2b705f1b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index b8aded27d9..de2532de51 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -5,6 +5,8 @@
## Fixed
+- **Cmd prompt windows flashing on Windows** — `fetchJlist` in `pm2.js` was spawning a `node pm2.js jlist` subprocess every 400ms+ during app-status polling. Even with `windowsHide: true`, Windows briefly flashes the console for spawned Node.js processes on some configurations. Fixed by switching to the PM2 Node.js API (`pm2.list()` via IPC) for the default PM2_HOME case, eliminating subprocess spawning entirely. The CLI path is kept only for custom `pm2Home` (managed external apps).
+
- **POST drill scoring paired every answer to the first prompt** — `llmResponseSchema` in `postValidation.js` didn't list `questionIndex`, so Zod's default strip mode dropped the field on its way to the scorer. The scorer's `r.questionIndex ?? i` fallback then resolved to the response-array index — always 0 for the single-response submits the trainer makes — and every answer was evaluated against the FIRST prompt of the drill. Affected bridge-word, idiom-twist, double-meaning, and every other LLM-scored POST drill (the v1.43.0 client-side fix wired up `questionIndex` on the request but it never reached the scorer). Schema now declares `questionIndex` and a regression test in `postValidation.test.js` covers the round-trip.
- **Compound chain rejected the natural shorthand** — typing just the *other half* of a compound (e.g., `hose`, `pit`, `work` for the root `fire`) was scored as invalid because the local scorer required the user's input to literally include the root word. Players had to type `firehose` / `firepit` / `firework` in full, which slowed them down and produced misleading "0 valid compounds" scores. Scorer now accepts both the full compound and the half — bare root word still rejected, and the "you could also have said" suggestions correctly suppress examples the user already covered via either form. UI placeholder updated to "Type the full compound or just the other half...".
- **Brain inbox classification with Gemini CLI was slow** — the provider had no default model, so `gemini` fell back to `gemini-2.5-pro` (a thinking model) and was also invoked without `--prompt`, forcing interactive-mode detection on every classify call. `brain.js callAI()` now sends gemini-cli prompts via `--prompt`, passes `--output-format text`, and defaults to `gemini-2.5-flash-lite` (thinking disabled) when no model is set. Sample providers config populates `models`/`defaultModel`/`lightModel`/`mediumModel`/`heavyModel` for gemini-cli so new installs pick up the fast model automatically.
diff --git a/autofixer/package-lock.json b/autofixer/package-lock.json
index 608679790e..1ede00e078 100644
--- a/autofixer/package-lock.json
+++ b/autofixer/package-lock.json
@@ -8,7 +8,7 @@
"name": "portos-autofixer",
"version": "1.0.0",
"dependencies": {
- "express": "^5.2.1"
+ "express": "5.2.1"
}
},
"node_modules/accepts": {
diff --git a/server/services/pm2.js b/server/services/pm2.js
index 43deaa58bb..5dec4be356 100644
--- a/server/services/pm2.js
+++ b/server/services/pm2.js
@@ -253,7 +253,9 @@ export async function getAppStatus(name, pm2Home = null) {
}
/**
- * Fetch raw PM2 jlist output with TTL caching to reduce CLI churn.
+ * Fetch PM2 process list with TTL caching.
+ * Uses the PM2 Node.js API for the default PM2_HOME (no subprocess spawning — avoids
+ * visible cmd windows on Windows). Falls back to CLI only for custom PM2_HOME paths.
* @param {string} pm2Home Optional custom PM2_HOME path
* @returns {Promise<Array|null>} Raw process list from PM2, or null on error
*/
@@ -265,39 +267,65 @@ function fetchJlist(pm2Home = null) {
const inflight = jlistInflight.get(key);
if (inflight) return inflight;
- const promise = new Promise((resolve) => {
- const child = spawnPm2(['jlist'], {
- env: buildEnv(pm2Home)
+ let promise;
+
+ if (!pm2Home) {
+ // Default PM2_HOME: use PM2 Node.js API directly — no subprocess spawn, no cmd windows
+ promise = new Promise((resolve) => {
+ pm2.connect((err) => {
+ if (err) {
+ jlistInflight.delete(key);
+ resolve(null);
+ return;
+ }
+ pm2.list((err, list) => {
+ pm2.disconnect();
+ jlistInflight.delete(key);
+ if (err || !Array.isArray(list)) {
+ resolve(null);
+ return;
+ }
+ jlistCache.set(key, { data: list, ts: Date.now() });
+ resolve(list);
+ });
+ });
});
- let stdout = '';
+ } else {
+ // Custom PM2_HOME: must use CLI since the Node.js API only supports the default home
+ promise = new Promise((resolve) => {
+ const child = spawnPm2(['jlist'], {
+ env: buildEnv(pm2Home)
+ });
+ let stdout = '';
- child.stdout.on('data', (data) => {
- stdout += data.toString();
- });
+ child.stdout.on('data', (data) => {
+ stdout += data.toString();
+ });
- child.on('close', (code) => {
- jlistInflight.delete(key);
- if (code !== 0) {
- resolve(null);
- return;
- }
- const list = safeJSONParse(extractJSONArray(stdout), []);
- jlistCache.set(key, { data: list, ts: Date.now() });
- resolve(list);
- });
+ child.on('close', (code) => {
+ jlistInflight.delete(key);
+ if (code !== 0) {
+ resolve(null);
+ return;
+ }
+ const list = safeJSONParse(extractJSONArray(stdout), []);
+ jlistCache.set(key, { data: list, ts: Date.now() });
+ resolve(list);
+ });
- child.on('error', () => {
- jlistInflight.delete(key);
- resolve(null);
+ child.on('error', () => {
+ jlistInflight.delete(key);
+ resolve(null);
+ });
});
- });
+ }
jlistInflight.set(key, promise);
return promise;
}
/**
- * List all PM2 processes using CLI (avoids connection deadlocks)
+ * List all PM2 processes
* @param {string} pm2Home Optional custom PM2_HOME path
*/
export async function listProcesses(pm2Home = null) {