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
refactor: share deploy flags below service layer (#4901)
[._.]/ Adam Eivyebcdb4da20d5
diff --git a/server/lib/README.md b/server/lib/README.mdindex 8e5bf38f43..7fc3152412 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -23,6 +23,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| Module | Purpose ||---|---|+| `appDeployFlags.js` | Shared allowlist of flags PortOS may forward to a managed app's `deploy.sh`, consumed by socket validation and deployment orchestration without reversing the lib/services dependency. || `agentContextValidation.js` | Shared settings, MCP request/tool input/output schemas, result + approximate-token bounds, source-freshness status, and `advertiseAgentContextTools(scopes)` for the opt-in read-only agent-context surface. || `validation.js` | Catch-all Zod schemas (app/process/provider, social accounts, GitHub, backup/sharing, document/legacy-export) + the `validateRequest` middleware + shared helpers (`optionalBooleanMap`, `isSafeRecordId`, `parseIndexParam`, `parsePagination`). Re-exports the per-domain validation files below so existing deep imports keep working. || `sharedSchemas.js` | Cross-domain Zod fragments that `validation.js` and the per-domain `*Validation.js` files both need, kept in a leaf module so the domain files never import back through `validation.js` (its hoisted `export * from` lines would TDZ). `grokVideoDurationSchema` (grok clip-length union), `cloudModelIdString(message)` (cloud-CLI model-id charset/bounds), `recordRenderPinFields` (the `imageMode`/`imageModelId` per-record render pin pair), and `isSafeSubdirFilter(v)` (relative path with no wildcard, `..` segment, or leading `/`), and `csvIdsParam({ max, maxIdLength, truncate })` (the `?ids=a,b,c` batch-by-id query param: trims, drops empties, reads all-blank as absent, and either 400s or silently slices an over-cap batch). |diff --git a/server/lib/appDeployFlags.js b/server/lib/appDeployFlags.jsnew file mode 100644index 0000000000..462633c02e--- /dev/null+++ b/server/lib/appDeployFlags.js@@ -0,0 +1,13 @@+/**+ * Flags PortOS may forward to a managed app's deploy.sh script.+ *+ * Kept below the service layer so request validation and deployment+ * orchestration share one allowlist without lib importing services.+ */+export const DEPLOY_FLAGS = Object.freeze([+ '--ios',+ '--macos',+ '--watch',+ '--all',+ '--skip-tests',+]);diff --git a/server/lib/index.js b/server/lib/index.jsindex 09793f250c..61beb2c971 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -16,6 +16,7 @@// brain and digital-twin) can be disambiguated as `brainValidation.X` /// `digitalTwinValidation.X`. The catch-all `validation.js` stays flat — its// names are the canonical PortOS-wide schemas.+export * from './appDeployFlags.js';export * as agentValidation from './agentValidation.js';export * as agentContextValidation from './agentContextValidation.js';export * as appleHealthValidation from './appleHealthValidation.js';diff --git a/server/lib/socketValidation.js b/server/lib/socketValidation.jsindex 849bde427c..998ab26713 100644--- a/server/lib/socketValidation.js+++ b/server/lib/socketValidation.js@@ -1,4 +1,5 @@import { z } from 'zod';+import { DEPLOY_FLAGS } from './appDeployFlags.js';// =============================================================================// SOCKET EVENT SCHEMAS@@ -94,7 +95,6 @@ export const appStandardizeSchema = z.object({});// app:deploy — app ID and optional flags for Xcode deploy-import { DEPLOY_FLAGS } from '../services/appDeployer.js';const appDeployFlagSchema = z.enum(DEPLOY_FLAGS, {errorMap: () => ({ message: `flag must be one of: ${DEPLOY_FLAGS.join(', ')}` })});diff --git a/server/services/appDeployer.js b/server/services/appDeployer.jsindex 596cc89b00..1bf0e14fc8 100644--- a/server/services/appDeployer.js+++ b/server/services/appDeployer.js@@ -4,8 +4,9 @@ import { join } from 'path';import { NON_PM2_TYPES } from './streamingDetect.js';import { getAppById } from './apps.js';import { resolveBashBinary } from '../lib/bashResolver.js';+import { DEPLOY_FLAGS } from '../lib/appDeployFlags.js';-export const DEPLOY_FLAGS = ['--ios', '--macos', '--watch', '--all', '--skip-tests'];+export { DEPLOY_FLAGS };const VALID_FLAGS = new Set(DEPLOY_FLAGS);const FLUSH_INTERVAL_MS = 80;// Maximum time (ms) a deploy.sh may run before the child is killed and thediff --git a/server/services/appDeployer.test.js b/server/services/appDeployer.test.jsindex 9248b554ca..01333f3636 100644--- a/server/services/appDeployer.test.js+++ b/server/services/appDeployer.test.js@@ -1,5 +1,13 @@import { describe, it, expect, vi } from 'vitest';-import { runDeployFlow } from './appDeployer.js';+import { DEPLOY_FLAGS as sharedDeployFlags } from '../lib/appDeployFlags.js';+import { DEPLOY_FLAGS, runDeployFlow } from './appDeployer.js';++describe('deploy flag contract', () => {+ it('preserves the service export as the shared lib allowlist', () => {+ expect(DEPLOY_FLAGS).toBe(sharedDeployFlags);+ expect(DEPLOY_FLAGS).toEqual(['--ios', '--macos', '--watch', '--all', '--skip-tests']);+ });+});describe('runDeployFlow', () => {const app = { id: 'app-1', name: 'MyApp', repoPath: '/repo', type: 'xcode' };