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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (local): honest 405, one world-title fallback, and descriptor tests that own their state
Adam Eivy85883c962042
diff --git a/server/services/eidoverseHost.js b/server/services/eidoverseHost.jsindex 67ddec883b..60e5bd758c 100644--- a/server/services/eidoverseHost.js+++ b/server/services/eidoverseHost.js@@ -29,10 +29,13 @@ const forwardedHeaders = (req, protocol, targetHost, targetPort) => ({const requestPathname = (url) => String(url || '').split('?')[0].replace(/\/+$/, '') || '/';-const writePlainText = (res, status, body) => {+// Node suppresses the body of a HEAD response itself, so every writer here can+// pass one unconditionally.+const writePlainText = (res, status, body, headers = {}) => {res.writeHead(status, {'content-type': 'text/plain; charset=utf-8','content-length': Buffer.byteLength(body),+ ...headers,});res.end(body);};@@ -43,7 +46,7 @@ const writePlainText = (res, status, body) => {*/const serveHostDescriptor = async (req, res) => {if (req.method !== 'GET' && req.method !== 'HEAD') {- writePlainText(res, 405, 'The PortOS host descriptor is read-only.');+ writePlainText(res, 405, 'The PortOS host descriptor is read-only.', { allow: 'GET, HEAD' });return;}// Deferred import: this bridge is constructed from the always-loaded settings@@ -66,7 +69,7 @@ const serveHostDescriptor = async (req, res) => {'content-length': Buffer.byteLength(body),'cache-control': 'no-store',});- res.end(req.method === 'HEAD' ? undefined : body);+ res.end(body);};const writeBadGateway = (res) => {diff --git a/server/services/eidoverseWorld.runtime.test.js b/server/services/eidoverseWorld.runtime.test.jsindex 0031c33910..e26748244f 100644--- a/server/services/eidoverseWorld.runtime.test.js+++ b/server/services/eidoverseWorld.runtime.test.js@@ -1,3 +1,4 @@+import { homedir, hostname, userInfo } from 'node:os';import { beforeEach, describe, expect, it, vi } from 'vitest';const mocks = vi.hoisted(() => ({@@ -637,6 +638,44 @@ describe('Eidoverse private-world lifecycle', () => {resolveAppStatuses([]);});+ // Anyone who can reach the Eidoverse door reads this payload, so a field+ // naming the machine, its network, or its operator would leak on every join.+ it('names its host opaquely on GET /host, and carries no machine identity', async () => {+ const descriptor = await world.readEidoverseHostDescriptor();++ expect(Object.keys(descriptor).sort()).toEqual(['caps', 'id', 'kind', 'label', 'version']);+ expect(descriptor).toMatchObject({+ id: expect.stringMatching(/^hst_[0-9a-f]{12}$/),+ kind: 'portos',+ label: world.DEFAULT_EIDOVERSE_PROJECTION_RECIPE.name,+ version: expect.any(String),+ caps: { eido: false },+ });++ const serialized = JSON.stringify(descriptor);+ for (const identity of [hostname(), hostname().split('.')[0], homedir(), userInfo().username]) {+ if (identity) expect(serialized).not.toContain(identity);+ }+ expect(serialized).not.toContain(mocks.self.instanceId);+ expect(serialized).not.toContain(mocks.self.name);+ expect(serialized).not.toMatch(/\d{1,3}(?:\.\d{1,3}){3}|\.ts\.net|\/Users\/|\/home\//);+ // Stable across reads: the id is a digest of this install, not a nonce.+ expect((await world.readEidoverseHostDescriptor()).id).toBe(descriptor.id);+ });++ // The label is the operator's, not a constant: a renamed world has to reach+ // the door, or `GET /host` and the world's own meta entity disagree.+ it('serves the operator-chosen world title as the host descriptor label', async () => {+ const recipe = structuredClone(world.DEFAULT_EIDOVERSE_PROJECTION_RECIPE);+ recipe.name = 'Example Systems Garden';+ const updated = await world.updateEidoverseWorldConfig({ recipe });++ const descriptor = await world.readEidoverseHostDescriptor();+ expect(descriptor.label).toBe('Example Systems Garden');+ // The same string the projection hangs on the world's meta entity.+ expect(updated.design.name).toBe(descriptor.label);+ });+// The world says who hosts it. A live projection has to actually supply that// meta, or the reconciliation sweep deletes the carrier on the next run.it('plants the world meta entity, naming its host opaquely and never by machine', async () => {diff --git a/server/services/eidoverseWorld.test.js b/server/services/eidoverseWorld.test.jsindex 25960920e6..d5b6dfc110 100644--- a/server/services/eidoverseWorld.test.js+++ b/server/services/eidoverseWorld.test.js@@ -1,25 +1,12 @@-import { homedir, hostname, userInfo } from 'node:os';-import { afterAll, describe, expect, it, vi } from 'vitest';-import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../lib/mockPathsDataRoot.js';--// `readEidoverseHostDescriptor` reads world config and the local identity off-// disk. Re-root both at a scratch tree so the descriptor under test is the-// shipped default rather than whatever this machine happens to hold.-vi.mock('../lib/fileUtils.js', async (importOriginal) => makePathsProxy(await importOriginal(), {- dataRoot: () => lazyTempDataRoot('portos-eidoverse-world-'),-}));--const {+import { describe, expect, it } from 'vitest';+import {buildProjectionPlan,DEFAULT_EIDOVERSE_PROJECTION_RECIPE,projectedJiraTickets,projectedStorage,- readEidoverseHostDescriptor,-} = await import('./eidoverseWorld.js');-const { eidoverseProjectionRecipeSchema } = await import('../lib/validation.js');-const { EIDOVERSE_META_ENTITY_ID } = await import('../lib/eidoverseWorldDesign.js');--afterAll(cleanupTempDataRoots);+} from './eidoverseWorld.js';+import { eidoverseProjectionRecipeSchema } from '../lib/validation.js';+import { EIDOVERSE_META_ENTITY_ID, EIDOVERSE_WORLD_DESIGN_VERSION } from '../lib/eidoverseWorldDesign.js';const APP_FALLBACK = DEFAULT_EIDOVERSE_PROJECTION_RECIPE.assetRecipe.slots.app.fallback;@@ -773,7 +760,7 @@ describe('Eidoverse world self-description', () => {expect(entity.comp.portos).toMatchObject({managedBy: 'portos',kind: 'world-meta',- designVersion: DEFAULT_EIDOVERSE_PROJECTION_RECIPE.version,+ designVersion: EIDOVERSE_WORLD_DESIGN_VERSION,meta: { title: 'Example Garden', hostId: 'hst_0123456789ab' },});// No record contents ride along — the payload is identity, not data.@@ -826,32 +813,3 @@ describe('Eidoverse world self-description', () => {});});});--describe('Eidoverse host descriptor', () => {- // Anyone who can reach the door reads this payload, so a field naming the- // machine, its network, or its operator would leak on every join.- it('names the host opaquely and carries no machine, network, or account identity', async () => {- const descriptor = await readEidoverseHostDescriptor();-- expect(Object.keys(descriptor).sort()).toEqual(['caps', 'id', 'kind', 'label', 'version']);- expect(descriptor.id).toMatch(/^hst_[0-9a-f]{12}$/);- expect(descriptor.kind).toBe('portos');- expect(descriptor.label).toBe(DEFAULT_EIDOVERSE_PROJECTION_RECIPE.name);- expect(descriptor.caps).toEqual({ eido: false });- expect(typeof descriptor.version).toBe('string');-- const serialized = JSON.stringify(descriptor);- for (const identity of [hostname(), hostname().split('.')[0], homedir(), userInfo().username]) {- if (identity) expect(serialized).not.toContain(identity);- }- expect(serialized).not.toMatch(/\d{1,3}(?:\.\d{1,3}){3}|\.ts\.net|\/Users\/|\/home\//);- });-- it('gives the same install the same opaque id on every read', async () => {- const [first, second] = await Promise.all([- readEidoverseHostDescriptor(),- readEidoverseHostDescriptor(),- ]);- expect(second.id).toBe(first.id);- });-});diff --git a/server/services/eidoverseWorldProjection.js b/server/services/eidoverseWorldProjection.jsindex 14a2939994..764769f6ba 100644--- a/server/services/eidoverseWorldProjection.js+++ b/server/services/eidoverseWorldProjection.js@@ -489,7 +489,7 @@ export function buildProjectionPlan({ source = {}, recipe = DEFAULT_EIDOVERSE_PR// World title and host identity only — never a record, a machine name,// an address, or a filesystem path.meta: {- title: safeText(meta.title, 'PortOS world', 120),+ title: safeText(meta.title, effectiveRecipe.name, 120),hostId: safeText(meta.hostId, '', 64) || null,},},