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 prompt editing for scheduled improvement tasks
Adam Eivy3ae10b5342fd
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsxindex 3212c6c423..985ddff7a9 100644--- a/client/src/components/cos/tabs/ScheduleTab.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.jsx@@ -39,6 +39,8 @@ function TaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, category,const [selectedType, setSelectedType] = useState(config.type);const [selectedProviderId, setSelectedProviderId] = useState(config.providerId || '');const [selectedModel, setSelectedModel] = useState(config.model || '');+ const [editingPrompt, setEditingPrompt] = useState(false);+ const [promptValue, setPromptValue] = useState(config.prompt || '');const handleTypeChange = async (newType) => {setUpdating(true);@@ -75,8 +77,24 @@ function TaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, category,setUpdating(false);};+ const handleSavePrompt = async () => {+ setUpdating(true);+ const prompt = promptValue.trim() === '' ? null : promptValue;+ await onUpdate(taskType, { prompt }).catch(() => {+ setPromptValue(config.prompt || '');+ });+ setEditingPrompt(false);+ setUpdating(false);+ };++ const handleCancelPromptEdit = () => {+ setPromptValue(config.prompt || '');+ setEditingPrompt(false);+ };+const selectedProvider = providers?.find(p => p.id === (selectedProviderId || ''));const availableModels = selectedProvider?.models || [];+ const hasCustomPrompt = config.prompt && config.prompt.trim() !== '';const status = config.status || {};const isEligible = status.shouldRun;@@ -229,6 +247,73 @@ function TaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, category,</p></div>+ <div>+ <div className="flex items-center justify-between mb-2">+ <label className="text-sm text-gray-400">+ Task Prompt {hasCustomPrompt && <span className="text-port-accent">(custom)</span>}+ </label>+ {!editingPrompt && (+ <button+ onClick={() => setEditingPrompt(true)}+ className="text-xs text-port-accent hover:text-port-accent/80"+ >+ {hasCustomPrompt ? 'Edit' : 'Customize'}+ </button>+ )}+ </div>+ {editingPrompt ? (+ <div className="space-y-2">+ <textarea+ value={promptValue}+ onChange={(e) => setPromptValue(e.target.value)}+ disabled={updating}+ rows={12}+ className="w-full bg-port-bg border border-port-border rounded px-3 py-2 text-white text-sm font-mono"+ placeholder="Enter custom prompt (leave empty to use default)"+ />+ <div className="flex gap-2">+ <button+ onClick={handleSavePrompt}+ disabled={updating}+ className="px-3 py-1.5 text-sm bg-port-accent hover:bg-port-accent/80 text-white rounded transition-colors"+ >+ Save Prompt+ </button>+ <button+ onClick={handleCancelPromptEdit}+ disabled={updating}+ className="px-3 py-1.5 text-sm bg-port-border hover:bg-port-border/80 text-white rounded transition-colors"+ >+ Cancel+ </button>+ {hasCustomPrompt && (+ <button+ onClick={() => {+ setPromptValue('');+ handleSavePrompt();+ }}+ disabled={updating}+ className="px-3 py-1.5 text-sm bg-port-error/20 hover:bg-port-error/30 text-port-error rounded transition-colors"+ >+ Reset to Default+ </button>+ )}+ </div>+ <p className="text-xs text-gray-500">+ Leave empty to use the default prompt. For app improvement tasks, use <code className="bg-port-border px-1 rounded">{'{appName}'}</code> and <code className="bg-port-border px-1 rounded">{'{repoPath}'}</code> as placeholders.+ </p>+ </div>+ ) : (+ <div className="bg-port-bg border border-port-border rounded px-3 py-2 text-xs text-gray-400 font-mono max-h-32 overflow-y-auto">+ {hasCustomPrompt ? (+ <pre className="whitespace-pre-wrap">{promptValue}</pre>+ ) : (+ <span className="italic">Using default prompt (click Customize to edit)</span>+ )}+ </div>+ )}+ </div>+<div className="flex gap-2"><buttononClick={() => onTrigger(taskType)}diff --git a/server/routes/cos.js b/server/routes/cos.jsindex 09235df224..24aaa7122e 100644--- a/server/routes/cos.js+++ b/server/routes/cos.js@@ -457,7 +457,7 @@ router.get('/schedule/self-improvement/:taskType', asyncHandler(async (req, res)// PUT /api/cos/schedule/self-improvement/:taskType - Update interval for self-improvement taskrouter.put('/schedule/self-improvement/:taskType', asyncHandler(async (req, res) => {const { taskType } = req.params;- const { type, enabled, intervalMs, providerId, model } = req.body;+ const { type, enabled, intervalMs, providerId, model, prompt } = req.body;const settings = {};if (type !== undefined) settings.type = type;@@ -465,6 +465,7 @@ router.put('/schedule/self-improvement/:taskType', asyncHandler(async (req, res)if (intervalMs !== undefined) settings.intervalMs = intervalMs;if (providerId !== undefined) settings.providerId = providerId;if (model !== undefined) settings.model = model;+ if (prompt !== undefined) settings.prompt = prompt;const result = await taskSchedule.updateSelfImprovementInterval(taskType, settings);res.json({ success: true, taskType, interval: result });@@ -480,7 +481,7 @@ router.get('/schedule/app-improvement/:taskType', asyncHandler(async (req, res)// PUT /api/cos/schedule/app-improvement/:taskType - Update interval for app improvement taskrouter.put('/schedule/app-improvement/:taskType', asyncHandler(async (req, res) => {const { taskType } = req.params;- const { type, enabled, intervalMs, providerId, model } = req.body;+ const { type, enabled, intervalMs, providerId, model, prompt } = req.body;const settings = {};if (type !== undefined) settings.type = type;@@ -488,6 +489,7 @@ router.put('/schedule/app-improvement/:taskType', asyncHandler(async (req, res)if (intervalMs !== undefined) settings.intervalMs = intervalMs;if (providerId !== undefined) settings.providerId = providerId;if (model !== undefined) settings.model = model;+ if (prompt !== undefined) settings.prompt = prompt;const result = await taskSchedule.updateAppImprovementInterval(taskType, settings);res.json({ success: true, taskType, interval: result });diff --git a/server/services/cos.js b/server/services/cos.jsindex 11c87e8651..9589a11dc0 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -1002,9 +1002,8 @@ async function generateSelfImprovementTaskForType(taskType, state, taskDescripticonst taskSchedule = await import('./taskSchedule.js');const interval = await taskSchedule.getSelfImprovementInterval(taskType);- // Use provided descriptions or generate default ones- const descriptions = taskDescriptions || getSelfImprovementTaskDescriptions();- const description = descriptions[taskType] || `[Self-Improvement] ${taskType} analysis`;+ // Get the effective prompt (custom or default)+ const description = await taskSchedule.getSelfImprovementPrompt(taskType);const metadata = {analysisType: taskType,@@ -1391,7 +1390,15 @@ async function generateManagedAppImprovementTask(app, state) {emitLog('info', `Generating comprehensive improvement task for ${app.name}: ${nextType} (${selectionReason})`, { appId: app.id, analysisType: nextType });- // Task descriptions for each analysis type+ // Get the effective prompt (custom or default template)+ const promptTemplate = await taskSchedule.getAppImprovementPrompt(nextType);++ // Replace template variables in the prompt+ const description = promptTemplate+ .replace(/\{appName\}/g, app.name)+ .replace(/\{repoPath\}/g, app.repoPath);++ // Legacy task descriptions - keeping for fallback but they won't be usedconst taskDescriptions = {'security-audit': `[App Improvement: ${app.name}] Security Audit@@ -1649,16 +1656,6 @@ Repository: ${app.repoPath}Use model: claude-opus-4-5-20251101 for thorough typing`};- const description = taskDescriptions[nextType] || `[App Improvement: ${app.name}] ${nextType}--Perform ${nextType} analysis on ${app.name}.--Repository: ${app.repoPath}--Analyze the codebase and make improvements. Commit changes with clear descriptions.--Use model: claude-opus-4-5-20251101`;-// Get interval settings to determine provider/modelconst interval = await taskSchedule.getAppImprovementInterval(nextType);diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex ff09dd5853..7f1df0f4af 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -42,34 +42,537 @@ const HOUR = 60 * 60 * 1000;const DAY = 24 * HOUR;const WEEK = 7 * DAY;+// Default prompts for self-improvement task types+const DEFAULT_SELF_IMPROVEMENT_PROMPTS = {+ 'ui-bugs': `[Self-Improvement] UI Bug Analysis++Use Playwright MCP (browser_navigate, browser_snapshot, browser_console_messages) to analyze PortOS UI:++1. Navigate to http://localhost:5555/+2. Check each main route: /, /apps, /cos, /cos/tasks, /cos/agents, /devtools, /devtools/history, /providers, /usage+3. For each route:+ - Take a browser_snapshot to see the page structure+ - Check browser_console_messages for JavaScript errors+ - Look for broken UI elements, missing data, failed requests+4. Fix any bugs found in the React components or API routes+5. Run tests and commit changes`,++ 'mobile-responsive': `[Self-Improvement] Mobile Responsiveness Analysis++Use Playwright MCP to test PortOS at different viewport sizes:++1. browser_resize to mobile (375x812), then navigate to http://localhost:5555/+2. Take browser_snapshot and analyze for:+ - Text overflow or truncation+ - Buttons too small to tap (< 44px)+ - Horizontal scrolling issues+ - Elements overlapping+ - Navigation usability+3. Repeat at tablet (768x1024) and desktop (1440x900)+4. Fix Tailwind CSS responsive classes (sm:, md:, lg:) as needed+5. Test fixes and commit changes++Focus on these routes: /cos, /cos/tasks, /devtools, /providers`,++ 'security': `[Self-Improvement] Security Audit++Analyze PortOS codebase for security vulnerabilities:++1. Review server/routes/*.js for:+ - Command injection in exec/spawn calls+ - Path traversal in file operations+ - Missing input validation+ - XSS in rendered content++2. Review server/services/*.js for:+ - Unsafe eval() or Function()+ - Hardcoded credentials+ - SQL/NoSQL injection++3. Review client/src/ for:+ - XSS vulnerabilities in React+ - Sensitive data in localStorage+ - CSRF protection++4. Check server/lib/commandAllowlist.js is comprehensive++Fix any vulnerabilities and commit with security advisory notes.`,++ 'code-quality': `[Self-Improvement] Code Quality Review++Analyze PortOS codebase for maintainability:++1. Find DRY violations - similar code in multiple places+2. Identify functions >50 lines that should be split+3. Look for missing error handling+4. Find dead code and unused imports+5. Check for console.log that should be removed+6. Look for TODO/FIXME that need addressing++Focus on:+- server/services/*.js+- client/src/pages/*.jsx+- client/src/components/*.jsx++Refactor issues found and commit improvements.`,++ 'console-errors': `[Self-Improvement] Console Error Investigation++Use Playwright MCP to find and fix console errors:++1. Navigate to http://localhost:5555/+2. Call browser_console_messages with level: "error"+3. Visit each route and capture errors:+ - /, /apps, /cos, /cos/tasks, /cos/agents+ - /devtools, /devtools/history, /devtools/runner+ - /providers, /usage, /prompts++4. For each error:+ - Identify the source file and line+ - Understand the root cause+ - Implement a fix++5. Test fixes and commit changes`,++ 'performance': `[Self-Improvement] Performance Analysis++Analyze PortOS for performance issues:++1. Review React components for:+ - Unnecessary re-renders+ - Missing useMemo/useCallback+ - Large component files that should be split++2. Review server code for:+ - N+1 query patterns+ - Missing caching opportunities+ - Inefficient file operations++3. Review client bundle for:+ - Missing code splitting+ - Large dependencies that could be tree-shaken++4. Check Socket.IO for:+ - Event handler memory leaks+ - Unnecessary broadcasts++Optimize and commit improvements.`,++ 'cos-enhancement': `[Self-Improvement] Enhance CoS Capabilities++Review the CoS system and add new capabilities:++1. Read data/COS-GOALS.md to understand the mission and goals+2. Review server/services/cos.js for improvement opportunities:+ - Better task prioritization logic+ - Smarter model selection+ - More informative status messages+ - Better error recovery++3. Review the self-improvement task prompts:+ - Are they comprehensive enough?+ - Do they lead to quality fixes?+ - What new analysis types could be added?++4. Consider adding:+ - New MCP server integrations+ - Better metrics tracking+ - Learning from completed tasks+ - Smarter cooldown logic++5. Implement ONE meaningful enhancement and commit it++Focus on making CoS more autonomous and effective.`,++ 'test-coverage': `[Self-Improvement] Improve Test Coverage++Analyze and improve test coverage for PortOS:++1. Check existing tests in server/tests/ and client/tests/+2. Identify untested critical paths:+ - API routes without tests+ - Services with complex logic+ - Error handling paths++3. Add tests for:+ - CoS task evaluation logic+ - Agent spawning and lifecycle+ - Socket.IO event handlers+ - API endpoints++4. Ensure tests:+ - Follow existing patterns+ - Use appropriate mocks+ - Test edge cases++5. Run npm test to verify all tests pass+6. Commit test additions with clear message describing what's covered`,++ 'documentation': `[Self-Improvement] Update Documentation++Review and improve PortOS documentation:++1. Update PLAN.md:+ - Mark completed milestones+ - Add any new features implemented+ - Document architectural decisions++2. Check docs/ folder:+ - Are all features documented?+ - Is the information current?+ - Add any missing guides++3. Review code comments:+ - Add JSDoc to exported functions+ - Document complex algorithms+ - Explain non-obvious code++4. Update README.md if needed:+ - Installation instructions+ - Quick start guide+ - Feature overview++5. Consider adding:+ - Architecture diagrams+ - API documentation+ - Troubleshooting guide++Commit documentation improvements.`,++ 'feature-ideas': `[Self-Improvement] Brainstorm and Implement Feature++Think about ways to make PortOS more useful:++1. Read data/COS-GOALS.md for context on user goals+2. Review recent completed tasks to understand patterns+3. Consider these areas:+ - User task management improvements+ - Better progress visualization+ - New automation capabilities+ - Enhanced monitoring features++4. Choose ONE small, high-impact feature to implement:+ - Something that saves user time+ - Improves the developer experience+ - Makes CoS more helpful++5. Implement it:+ - Write clean, tested code+ - Follow existing patterns+ - Update relevant documentation++6. Commit with a clear description of the new feature++Think creatively but implement practically.`,++ 'accessibility': `[Self-Improvement] Accessibility Audit++Use Playwright MCP to audit PortOS accessibility:++1. Navigate to http://localhost:5555/+2. Use browser_snapshot to get accessibility tree+3. Check each main route for:+ - Missing ARIA labels+ - Missing alt text on images+ - Insufficient color contrast+ - Keyboard navigation issues+ - Focus indicators++4. Fix accessibility issues in React components+5. Add appropriate aria-* attributes+6. Test and commit changes`,++ 'dependency-updates': `[Self-Improvement] Dependency Updates and Security Audit++Check PortOS dependencies for updates and security vulnerabilities:++1. Run npm audit in both server/ and client/ directories+2. Check for outdated packages with npm outdated+3. Review CRITICAL and HIGH severity vulnerabilities+4. For each vulnerability:+ - Assess the actual risk (is the vulnerable code path used?)+ - Check if an update is available+ - Test that updates don't break functionality++5. Update dependencies carefully:+ - Update patch versions first (safest)+ - Then minor versions+ - Major versions need more careful review++6. After updating:+ - Run npm test in server/+ - Run npm run build in client/+ - Verify the app starts correctly++7. Commit with clear changelog of what was updated and why`+};+// Default interval settings for self-improvement task typesconst DEFAULT_SELF_IMPROVEMENT_INTERVALS = {- 'ui-bugs': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'mobile-responsive': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'security': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'cos-enhancement': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'documentation': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'feature-ideas': { type: INTERVAL_TYPES.DAILY, enabled: true, providerId: null, model: null },- 'accessibility': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'dependency-updates': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null }+ 'ui-bugs': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'mobile-responsive': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'security': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'cos-enhancement': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'documentation': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'feature-ideas': { type: INTERVAL_TYPES.DAILY, enabled: true, providerId: null, model: null, prompt: null },+ 'accessibility': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'dependency-updates': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null }+};++// Default prompts for app improvement task types (templates with {appName} and {repoPath} variables)+const DEFAULT_APP_IMPROVEMENT_PROMPTS = {+ 'security-audit': `[App Improvement: {appName}] Security Audit++Analyze the {appName} codebase for security vulnerabilities:++Repository: {repoPath}++1. Review routes/controllers for:+ - Command injection in exec/spawn calls+ - Path traversal in file operations+ - Missing input validation+ - XSS vulnerabilities+ - SQL/NoSQL injection++2. Review services for:+ - Unsafe eval() or Function()+ - Hardcoded credentials+ - Insecure dependencies++3. Review client code for:+ - XSS vulnerabilities+ - Sensitive data in localStorage+ - CSRF protection++4. Check authentication and authorization:+ - Secure password handling+ - Token management+ - Access control++Fix any vulnerabilities found and commit with security advisory notes.`,++ 'code-quality': `[App Improvement: {appName}] Code Quality Review++Analyze {appName} for maintainability improvements:++Repository: {repoPath}++1. Find DRY violations - similar code in multiple places+2. Identify functions >50 lines that should be split+3. Look for missing error handling+4. Find dead code and unused imports+5. Check for console.log that should be removed+6. Look for TODO/FIXME that need addressing+7. Identify magic numbers that should be constants++Focus on the main source directories. Refactor issues found and commit improvements.`,++ 'test-coverage': `[App Improvement: {appName}] Improve Test Coverage++Analyze and improve test coverage for {appName}:++Repository: {repoPath}++1. Check existing tests and identify untested critical paths+2. Look for:+ - API routes without tests+ - Services with complex logic+ - Error handling paths+ - Edge cases++3. Add tests following existing patterns in the project+4. Ensure tests:+ - Use appropriate mocks+ - Test edge cases+ - Follow naming conventions++5. Run tests to verify all pass+6. Commit test additions with clear message describing coverage`,++ 'performance': `[App Improvement: {appName}] Performance Analysis++Analyze {appName} for performance issues:++Repository: {repoPath}++1. Review components/views for:+ - Unnecessary re-renders+ - Missing memoization+ - Large files that should be split++2. Review backend for:+ - N+1 query patterns+ - Missing caching opportunities+ - Inefficient file operations+ - Slow API endpoints++3. Review build/bundle for:+ - Missing code splitting+ - Large dependencies that could be optimized++4. Check for:+ - Memory leaks+ - Unnecessary broadcasts/events++Optimize and commit improvements.`,++ 'accessibility': `[App Improvement: {appName}] Accessibility Audit++Audit {appName} for accessibility issues:++Repository: {repoPath}++If the app has a web UI:+1. Navigate to the app's UI+2. Check for:+ - Missing ARIA labels+ - Missing alt text on images+ - Insufficient color contrast+ - Keyboard navigation issues+ - Focus indicators+ - Semantic HTML usage++3. Fix accessibility issues in components+4. Add appropriate aria-* attributes+5. Test and commit changes`,++ 'console-errors': `[App Improvement: {appName}] Console Error Investigation++Find and fix console errors in {appName}:++Repository: {repoPath}++1. If the app has a UI, check browser console for errors+2. Check server logs for errors+3. For each error:+ - Identify the source file and line+ - Understand the root cause+ - Implement a fix++4. Test fixes and commit changes`,++ 'dependency-updates': `[App Improvement: {appName}] Dependency Updates++Check {appName} dependencies for updates and security vulnerabilities:++Repository: {repoPath}++1. Run npm audit (or equivalent package manager)+2. Check for outdated packages+3. Review CRITICAL and HIGH severity vulnerabilities+4. For each vulnerability:+ - Assess actual risk+ - Check if update available+ - Test updates don't break functionality++5. Update dependencies carefully:+ - Patch versions first (safest)+ - Then minor versions+ - Major versions need careful review++6. After updating:+ - Run tests+ - Verify the app starts correctly++7. Commit with clear changelog++IMPORTANT: Only update one major version bump at a time.`,++ 'documentation': `[App Improvement: {appName}] Update Documentation++Review and improve {appName} documentation:++Repository: {repoPath}++1. Check README.md:+ - Installation instructions current?+ - Quick start guide clear?+ - Feature overview complete?++2. Review inline documentation:+ - Add JSDoc to exported functions+ - Document complex algorithms+ - Explain non-obvious code++3. Check for docs/ folder:+ - Are all features documented?+ - Is information current?+ - Add missing guides if needed++4. Update PLAN.md or similar if present:+ - Mark completed milestones+ - Document architectural decisions++Commit documentation improvements.`,++ 'error-handling': `[App Improvement: {appName}] Improve Error Handling++Enhance error handling in {appName}:++Repository: {repoPath}++1. Review code for:+ - Missing try-catch blocks where needed+ - Silent failures (empty catch blocks)+ - Errors that should be logged+ - User-facing error messages++2. Add error handling for:+ - Network requests+ - File operations+ - Database queries+ - External API calls++3. Ensure errors are:+ - Logged appropriately+ - Have clear messages+ - Include relevant context+ - Don't expose sensitive data++4. Test error paths and commit improvements`,++ 'typing': `[App Improvement: {appName}] TypeScript Type Improvements++Improve TypeScript types in {appName}:++Repository: {repoPath}++1. Review TypeScript files for:+ - 'any' types that should be specific+ - Missing type annotations+ - Type assertions that could be avoided+ - Missing interfaces/types for objects++2. Add types for:+ - Function parameters and returns+ - Component props+ - API responses+ - Configuration objects++3. Ensure:+ - Types are properly exported+ - No implicit any+ - Types are reusable++4. Run type checking and commit improvements`};// Default interval settings for managed app improvement task typesconst DEFAULT_APP_IMPROVEMENT_INTERVALS = {- 'security-audit': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'accessibility': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null },- 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'dependency-updates': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null },- 'documentation': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null },- 'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null },- 'typing': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null }+ 'security-audit': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'code-quality': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'test-coverage': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'performance': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'accessibility': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null, prompt: null },+ 'console-errors': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'dependency-updates': { type: INTERVAL_TYPES.WEEKLY, enabled: true, providerId: null, model: null, prompt: null },+ 'documentation': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null, prompt: null },+ 'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: true, providerId: null, model: null, prompt: null },+ 'typing': { type: INTERVAL_TYPES.ONCE, enabled: true, providerId: null, model: null, prompt: null }};/**@@ -677,3 +1180,40 @@ export async function resetExecutionHistory(taskType, category = 'selfImprovemenreturn { success: true, taskType, appId };}++/**+ * Get default prompt for a self-improvement task type+ */+export function getDefaultSelfImprovementPrompt(taskType) {+ return DEFAULT_SELF_IMPROVEMENT_PROMPTS[taskType] || null;+}++/**+ * Get default prompt for an app improvement task type (with template variables)+ */+export function getDefaultAppImprovementPrompt(taskType) {+ return DEFAULT_APP_IMPROVEMENT_PROMPTS[taskType] || null;+}++/**+ * Get the effective prompt for a self-improvement task type+ * Returns custom prompt if set, otherwise returns default+ */+export async function getSelfImprovementPrompt(taskType) {+ const interval = await getSelfImprovementInterval(taskType);+ return interval.prompt || DEFAULT_SELF_IMPROVEMENT_PROMPTS[taskType] || `[Self-Improvement] ${taskType} analysis`;+}++/**+ * Get the effective prompt for an app improvement task type+ * Returns custom prompt if set, otherwise returns default template+ */+export async function getAppImprovementPrompt(taskType) {+ const interval = await getAppImprovementInterval(taskType);+ return interval.prompt || DEFAULT_APP_IMPROVEMENT_PROMPTS[taskType] || `[App Improvement] ${taskType} analysis++Repository: {repoPath}++Perform ${taskType} analysis on {appName}.+Analyze the codebase and make improvements. Commit changes with clear descriptions.`;+}