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

5.3 KB
Raw Blame
{
  "source": "PR #8874, head 85d06e9223cedf9724658ef9d7608554c35d19c8; objective reconstructed from the calibration report.",
  "objective": "Now that we have refactored the running processes, update the default PortOS manifest to match production startup. Remove portos-ui from the expected processes so the UI no longer shows it as missing, including for existing manifests.",
  "diff": "diff --git a/data.reference/apps.json b/data.reference/apps.json\nindex e5d13d6d1..81fef619e 100644\n--- a/data.reference/apps.json\n+++ b/data.reference/apps.json\n@@ -7,14 +7,15 @@\n       \"repoPath\": \"__PORTOS_ROOT__\",\n       \"type\": \"express\",\n       \"uiPort\": 5555,\n-      \"apiPort\": 5554,\n+      \"apiPort\": 5555,\n+      \"devUiPort\": 5554,\n+      \"buildCommand\": \"npm run build\",\n       \"startCommands\": [\n-        \"npm run dev\"\n+        \"npm start\"\n       ],\n       \"pm2ProcessNames\": [\n         \"portos-server\",\n         \"portos-cos\",\n-        \"portos-ui\",\n         \"portos-autofixer\",\n         \"portos-autofixer-ui\",\n         \"portos-browser\"\n@@ -28,19 +29,14 @@\n       \"processes\": [\n         {\n           \"name\": \"portos-server\",\n-          \"port\": 5554,\n-          \"ports\": { \"api\": 5554 }\n+          \"port\": 5555,\n+          \"ports\": { \"api\": 5555 }\n         },\n         {\n           \"name\": \"portos-cos\",\n           \"port\": 5558,\n           \"ports\": { \"api\": 5558 }\n         },\n-        {\n-          \"name\": \"portos-ui\",\n-          \"port\": 5555,\n-          \"ports\": { \"ui\": 5555 }\n-        },\n         {\n           \"name\": \"portos-autofixer\",\n           \"port\": 5559,\ndiff --git a/server/services/apps.js b/server/services/apps.js\nindex f128ea5db..e80a4ac58 100644\n--- a/server/services/apps.js\n+++ b/server/services/apps.js\n@@ -43,10 +43,10 @@ function buildPortosApp() {\n     tlsPort: certPresent ? PORTS.API : null,\n     buildCommand: 'npm run build',\n     startCommands: ['npm start'],\n+    // Match npm start: Vite is development-only, not an expected production process.\n     pm2ProcessNames: [\n       'portos-server',\n       'portos-cos',\n-      'portos-ui',\n       'portos-autofixer',\n       'portos-autofixer-ui',\n       'portos-browser'\n@@ -57,7 +57,6 @@ function buildPortosApp() {\n       // there and Overview would otherwise show a dead port.\n       { name: 'portos-server', port: PORTS.API, ports: certPresent ? { api: PORTS.API, 'api-local': PORTS.API_LOCAL } : { api: PORTS.API } },\n       { name: 'portos-cos', port: PORTS.COS, ports: { api: PORTS.COS } },\n-      { name: 'portos-ui', port: PORTS.UI, ports: { devUi: PORTS.UI } },\n       { name: 'portos-autofixer', port: PORTS.AUTOFIXER, ports: { api: PORTS.AUTOFIXER } },\n       { name: 'portos-autofixer-ui', port: PORTS.AUTOFIXER_UI, ports: { ui: PORTS.AUTOFIXER_UI } },\n       { name: 'portos-browser', port: PORTS.CDP, ports: { cdp: PORTS.CDP, health: PORTS.CDP_HEALTH } }\ndiff --git a/server/services/apps.test.js b/server/services/apps.test.js\nindex f77a89fa8..397994a7f 100644\n--- a/server/services/apps.test.js\n+++ b/server/services/apps.test.js\n@@ -1,3 +1,4 @@\n+import { readFileSync } from 'node:fs';\n import { describe, it, expect, vi, beforeEach } from 'vitest';\n \n vi.mock('fs/promises', () => ({\n@@ -440,3 +441,37 @@ describe('__PORTOS_ROOT__ placeholder expansion on load', () => {\n     expect(persisted.apps['other-app'].appIconPath).toBe('/mock/root/icon.png');\n   });\n });\n+\n+\n+describe('PortOS production process manifest', () => {\n+  beforeEach(() => {\n+    invalidateCache();\n+    vi.clearAllMocks();\n+  });\n+\n+  it.each([false, true])('matches production startup and repairs legacy manifests (existing: %s)', async (existing) => {\n+    const seed = JSON.parse(readFileSync(new URL('../../data.reference/apps.json', import.meta.url), 'utf8')).apps[PORTOS_APP_ID];\n+    const scripts = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).scripts;\n+    const expectedNames = scripts.start.match(/--only \"([^\"]+)\"/)[1].split(',');\n+    readJSONFile.mockResolvedValue({ apps: existing ? {\n+      [PORTOS_APP_ID]: {\n+        ...seed,\n+        description: 'Custom description',\n+        pm2ProcessNames: [...expectedNames, 'portos-ui'],\n+        processes: [...seed.processes, { name: 'portos-ui', port: 5554 }],\n+      },\n+    } : {} });\n+\n+    const app = (await getAllApps()).find(({ id }) => id === PORTOS_APP_ID);\n+    expect(app.pm2ProcessNames).toEqual(expectedNames);\n+    expect(app.processes.map(({ name }) => name)).toEqual(expectedNames);\n+    expect(app).toMatchObject({ uiPort: 5555, apiPort: 5555, devUiPort: 5554, startCommands: ['npm start'] });\n+    expect(app.processes[0]).toMatchObject({ name: 'portos-server', port: 5555, ports: { api: 5555 } });\n+    expect(seed.pm2ProcessNames).toEqual(expectedNames);\n+    expect(seed.processes.map(({ name }) => name)).toEqual(expectedNames);\n+    expect(seed).toMatchObject({ uiPort: app.uiPort, apiPort: app.apiPort, devUiPort: app.devUiPort, startCommands: app.startCommands, buildCommand: app.buildCommand });\n+    expect(seed.processes[0]).toEqual(app.processes[0]);\n+    if (existing) expect(app.description).toBe('Custom description');\n+    expect(atomicWrite.mock.calls.at(-1)[1].apps[PORTOS_APP_ID].pm2ProcessNames).toEqual(expectedNames);\n+  });\n+});\n"
}