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
feat: add CLI provider catalog refresh task (#5074)
[._.]/ Adam Eivyad7b9e2d4d71
diff --git a/server/services/autonomousJobs/defaults.js b/server/services/autonomousJobs/defaults.jsindex 896b93ca66..601b8c554b 100644--- a/server/services/autonomousJobs/defaults.js+++ b/server/services/autonomousJobs/defaults.js@@ -11,6 +11,7 @@import { DAY, WEEK, JOB_STRUCTURAL_FIELDS, JOB_ADDITIVE_FIELDS } from './constants.js'import { PORTOS_CATALOG_REFRESH_JOB } from './portosCatalogRefresh.js'+import { PORTOS_CLI_CATALOG_REFRESH_JOB } from './portosCliCatalogRefresh.js'/*** Default job definitions@@ -291,6 +292,7 @@ Phase 4 — Report:updatedAt: null},PORTOS_CATALOG_REFRESH_JOB,+ PORTOS_CLI_CATALOG_REFRESH_JOB,// 'job-layered-intelligence' removed (#2322): Layered Intelligence is now a// per-app HANDLER-BACKED scheduled task (CoS → Schedule) rather than a global// autonomous-job sweep. Migration 184 tombstones the persisted job record anddiff --git a/server/services/autonomousJobs/portosCliCatalogRefresh.js b/server/services/autonomousJobs/portosCliCatalogRefresh.jsnew file mode 100644index 0000000000..af1c258ec6--- /dev/null+++ b/server/services/autonomousJobs/portosCliCatalogRefresh.js@@ -0,0 +1,79 @@+/**+ * PortOS-owned custom job for auditing the bundled CLI-provider catalogs.+ *+ * The job deliberately lives in the PortOS app's custom-task collection rather+ * than the global task-type registry. Its prompt is the ownership boundary for+ * the shipped fallback catalogs; live provider refresh remains authoritative for+ * the provider record that a user has already configured.+ */++import { PORTOS_APP_ID } from '../../lib/appIdentity.js'+import { DAY } from './constants.js'++export const PORTOS_CLI_CATALOG_REFRESH_JOB_ID = 'job-refresh-cli-provider-catalogs'+export const PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE = 'refresh-cli-provider-catalogs'++const PORTOS_CLI_CATALOG_REFRESH_PROMPT = `[Autonomous Job] Refresh CLI Provider Catalogs++Audit only the static CLI-provider fallback catalogs that PortOS ships. This is a+PortOS maintenance task, not a managed-app task and not a live provider-refresh+operation.++The authoritative static surface is server/lib/aiToolkit/providers.js. Start by+reading its CODEX_MODELS, ANTIGRAVITY_MODELS, and+PRIOR_ANTIGRAVITY_MODEL_CATALOGS constants, then read the related provider,+migration, seed-parity, pin-validation, and model-picker tests. Do not assume+that a list returned by a single signed-in account is the universal fallback.++Research current model IDs from authoritative provider documentation, release+notes, or the provider CLI's model-list command when that command is supported+(for example, agy models). Treat an installed account-specific list as evidence+to compare against, not as sufficient proof for the shipped catalog. Do not make+provider calls during PortOS startup and do not duplicate or bypass the live+refresh path in server/services/providers.js.++If a shipped fallback is stale, update only the PortOS static catalog and the+compatibility recognition that protects independently upgraded installs. When a+shipped default changes, preserve the old seeded Antigravity list in+PRIOR_ANTIGRAVITY_MODEL_CATALOGS (and update any equivalent provider-specific+prior-default recognition required by the migration). Preserve configured-default+sentinels, user-selected provider records, live-refreshed model lists, and every+user-selected default/light/medium/heavy pin. Never rewrite data/providers.json or+replace a customized provider list merely because it differs from the shipped+fallback.++Validate that every shipped model ID is unique, every real default/light/medium/heavy+pin resolves to an ID in its provider catalog, configured-default sentinels remain+valid, and the server and client provider model pickers still render valid choices.+Add or update focused tests covering fresh seeding, untouched-default upgrades,+customized-list preservation, pin validity, and picker behavior. Run the relevant+server and client tests.++If the shipped catalogs are already current, leave the worktree clean and report+that no change is needed. Do NOT create a commit, push a branch, or open a PR for+that no-op. If a real change is needed, run the configured simplify pass, commit+the focused change, and open a PR with a concise summary and test plan. Do not+create or edit a changelog file or fragment.`++export const PORTOS_CLI_CATALOG_REFRESH_JOB = Object.freeze({+ id: PORTOS_CLI_CATALOG_REFRESH_JOB_ID,+ name: 'Refresh CLI Provider Catalogs',+ description: 'Audit and refresh the static Codex and Antigravity model fallbacks that PortOS ships.',+ category: 'portos-maintenance',+ appId: PORTOS_APP_ID,+ interval: 'monthly',+ intervalMs: 30 * DAY,+ enabled: false,+ priority: 'MEDIUM',+ autonomyLevel: 'manager',+ type: 'agent',+ promptTemplate: PORTOS_CLI_CATALOG_REFRESH_PROMPT,+ taskMetadata: { useWorktree: true, openPR: true, simplify: true },+ providerId: null,+ model: null,+ effort: null,+ lastRun: null,+ runCount: 0,+ createdAt: null,+ updatedAt: null+})diff --git a/server/services/autonomousJobs/portosCliCatalogRefresh.test.js b/server/services/autonomousJobs/portosCliCatalogRefresh.test.jsnew file mode 100644index 0000000000..65cb26a519--- /dev/null+++ b/server/services/autonomousJobs/portosCliCatalogRefresh.test.js@@ -0,0 +1,112 @@+import { describe, expect, it } from 'vitest'+import { PORTOS_APP_ID } from '../../lib/appIdentity.js'+import { DEFAULT_TASK_INTERVALS, SELF_IMPROVEMENT_TASK_TYPES, TASK_TYPE_DESCRIPTIONS } from '../taskScheduleRegistry.js'+import { generateTaskFromJob } from './skillTemplates.js'+import { DAY } from './constants.js'+import { DEFAULT_JOBS, createDefaultJobsData, mergeWithDefaults } from './defaults.js'+import {+ PORTOS_CLI_CATALOG_REFRESH_JOB_ID,+ PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE,+ PORTOS_CLI_CATALOG_REFRESH_JOB+} from './portosCliCatalogRefresh.js'++describe('PortOS CLI provider catalog refresh custom task', () => {+ it('ships as a disabled monthly PortOS custom task, not a global task type', () => {+ const job = DEFAULT_JOBS.find((candidate) => candidate.id === PORTOS_CLI_CATALOG_REFRESH_JOB_ID)++ expect(job).toBe(PORTOS_CLI_CATALOG_REFRESH_JOB)+ expect(job).toMatchObject({+ appId: PORTOS_APP_ID,+ type: 'agent',+ interval: 'monthly',+ intervalMs: 30 * DAY,+ enabled: false,+ taskMetadata: { useWorktree: true, openPR: true, simplify: true }+ })+ expect(SELF_IMPROVEMENT_TASK_TYPES).not.toContain(PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE)+ expect(DEFAULT_TASK_INTERVALS[PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE]).toBeUndefined()+ expect(TASK_TYPE_DESCRIPTIONS[PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE]).toBeUndefined()+ })++ it('keeps the prompt in the prepared PortOS workspace and makes the no-op contract explicit', () => {+ expect(PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate).toContain('CODEX_MODELS')+ expect(PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate).toContain('ANTIGRAVITY_MODELS')+ expect(PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate).toContain('PRIOR_ANTIGRAVITY_MODEL_CATALOGS')+ expect(PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate).toContain('Do NOT create a commit, push a branch, or open a PR')+ expect(PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate).toContain('data/providers.json')+ })++ it('seeds a fresh install with the app scope, workflow metadata, and snapshot fields', () => {+ const data = createDefaultJobsData()+ const job = data.jobs.find((candidate) => candidate.id === PORTOS_CLI_CATALOG_REFRESH_JOB_ID)++ expect(job).toMatchObject({+ appId: PORTOS_APP_ID,+ taskMetadata: { useWorktree: true, openPR: true, simplify: true },+ providerId: null,+ model: null,+ effort: null,+ createdAt: expect.any(String),+ updatedAt: expect.any(String),+ _shippedDefaults: {+ name: PORTOS_CLI_CATALOG_REFRESH_JOB.name,+ interval: 'monthly',+ intervalMs: 30 * DAY,+ promptTemplate: PORTOS_CLI_CATALOG_REFRESH_JOB.promptTemplate+ }+ })+ })++ it('preserves a customized task during an upgrade', () => {+ const seededData = createDefaultJobsData()+ const seededJob = seededData.jobs.find((job) => job.id === PORTOS_CLI_CATALOG_REFRESH_JOB_ID)+ const customized = {+ ...seededJob,+ name: 'My provider audit',+ description: 'Keep my wording',+ interval: 'weekly',+ intervalMs: 7 * DAY,+ enabled: true,+ promptTemplate: 'Keep my provider instructions',+ taskMetadata: { useWorktree: false, openPR: false, simplify: false },+ createdAt: '2026-01-01T00:00:00.000Z',+ updatedAt: '2026-01-02T00:00:00.000Z',+ _shippedDefaults: { ...seededJob._shippedDefaults }+ }+ const storedJobs = seededData.jobs.map((job) => (+ job.id === PORTOS_CLI_CATALOG_REFRESH_JOB_ID ? customized : job+ ))+ const { data, dirty } = mergeWithDefaults({ version: 1, jobs: storedJobs })+ const job = data.jobs.find((candidate) => candidate.id === PORTOS_CLI_CATALOG_REFRESH_JOB_ID)++ expect(dirty).toBe(false)+ expect(job).toMatchObject({+ name: 'My provider audit',+ description: 'Keep my wording',+ interval: 'weekly',+ intervalMs: 7 * DAY,+ enabled: true,+ promptTemplate: 'Keep my provider instructions',+ taskMetadata: { useWorktree: false, openPR: false, simplify: false }+ })+ })++ it('forwards app scope and provider/model/effort pins to the spawned task', async () => {+ const task = await generateTaskFromJob({+ ...PORTOS_CLI_CATALOG_REFRESH_JOB,+ providerId: 'codex-cli',+ model: 'gpt-example',+ effort: 'high'+ })++ expect(task.metadata).toMatchObject({+ app: PORTOS_APP_ID,+ useWorktree: true,+ openPR: true,+ simplify: true,+ provider: 'codex-cli',+ model: 'gpt-example',+ effort: 'high'+ })+ })+})diff --git a/server/services/workflow.js b/server/services/workflow.jsindex 23cde20bf4..94490e49c8 100644--- a/server/services/workflow.js+++ b/server/services/workflow.js@@ -78,7 +78,7 @@ export const WORKFLOW_STAGES = ['mobile-responsive','ux'],- jobIds: ['job-wiki-maintenance', 'job-refresh-local-llm-catalog']+ jobIds: ['job-wiki-maintenance', 'job-refresh-local-llm-catalog', 'job-refresh-cli-provider-catalogs']},{id: 'build',diff --git a/server/services/workflow.test.js b/server/services/workflow.test.jsindex 7826bf6c16..cdcb794829 100644--- a/server/services/workflow.test.js+++ b/server/services/workflow.test.js@@ -46,10 +46,12 @@ describe('WORKFLOW_STAGES contract', () => {expect(review.taskTypes).toContain('pr-reviewer');});- it('places the PortOS catalog refresh custom task in the audit stage', () => {+ it('places PortOS catalog refresh custom tasks in the audit stage', () => {const audit = WORKFLOW_STAGES.find(s => s.id === 'audit');expect(audit.taskTypes).not.toContain('refresh-local-llm-catalog');expect(audit.jobIds).toContain('job-refresh-local-llm-catalog');+ expect(audit.taskTypes).not.toContain('refresh-cli-provider-catalogs');+ expect(audit.jobIds).toContain('job-refresh-cli-provider-catalogs');});it('does not place the same task type in two stages', () => {