Personal AI, On Personal Devices
Python
chore: remove superpowers plan/spec artifacts from repo
Jon Saad-Falcon5dc64872fd69
diff --git a/docs/superpowers/plans/2026-03-14-agents-updates.md b/docs/superpowers/plans/2026-03-14-agents-updates.mddeleted file mode 100644index 2a5a6c05..00000000--- a/docs/superpowers/plans/2026-03-14-agents-updates.md+++ /dev/null@@ -1,625 +0,0 @@-# Agent UX, Auto-Update, and CLI Version Check Implementation Plan--> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.--**Goal:** Fix agent error visibility, add standing instructions + model selection to agents, wire up the scheduler, add desktop auto-update, and CLI version check.--**Architecture:** Three independent sub-projects. Sub-project 1 (agents) touches frontend + backend Python. Sub-project 2 (auto-update) is frontend-only (Tauri plugin already configured). Sub-project 3 (CLI version check) is Python-only.--**Tech Stack:** React 19, TypeScript, Zustand, sonner (toasts), Python (Click CLI, SQLite agent manager), Tauri updater plugin, GitHub releases API--**Spec:** `docs/superpowers/specs/2026-03-14-agents-updates-design.md`-------## Chunk 1: CLI Version Check (Sub-project 3)--This is the simplest sub-project and fully independent. Start here.--### Task 1: Create _version_check.py--**Files:**-- Create: `src/openjarvis/cli/_version_check.py`--- [ ] **Step 1: Create the version check module**--```python-"""Check for newer OpenJarvis releases on GitHub."""--from __future__ import annotations--import json-import logging-import sys-import time-from pathlib import Path--logger = logging.getLogger(__name__)--_CACHE_PATH = Path("~/.openjarvis/version-check.json").expanduser()-_CACHE_TTL = 86400 # 24 hours-_GITHUB_API = "https://api.github.com/repos/open-jarvis/OpenJarvis/releases/latest"-_CHECK_COMMANDS = {"ask", "chat", "serve"}---def check_for_updates(command_name: str) -> None:- """Print a message if a newer version is available. Best-effort, never raises."""- if command_name not in _CHECK_COMMANDS:- return- try:- _do_check()- except Exception:- pass # Silent — never break CLI for a version check---def _do_check() -> None:- import openjarvis-- current = openjarvis.__version__- latest = _get_latest_version(current)- if latest is None:- return-- from packaging.version import Version, InvalidVersion-- try:- if Version(latest) > Version(current):- sys.stderr.write(- f"\033[33mA new version of OpenJarvis is available "- f"(v{current} \u2192 v{latest})\n"- f"Update: cd ~/OpenJarvis && git pull && uv sync\033[0m\n\n"- )- except InvalidVersion:- pass---def _get_latest_version(current: str) -> str | None:- """Return latest version string from cache or GitHub API."""- # Check cache- try:- if _CACHE_PATH.exists():- data = json.loads(_CACHE_PATH.read_text())- last_check = data.get("last_check", 0)- if time.time() - last_check < _CACHE_TTL:- return data.get("latest_version")- except Exception:- pass-- # Fetch from GitHub- try:- import urllib.request-- req = urllib.request.Request(- _GITHUB_API,- headers={"Accept": "application/vnd.github.v3+json"},- )- with urllib.request.urlopen(req, timeout=3) as resp:- data = json.loads(resp.read())- tag = data.get("tag_name", "")- latest = tag.lstrip("v")- except Exception:- return None-- # Update cache- try:- _CACHE_PATH.parent.mkdir(parents=True, exist_ok=True)- _CACHE_PATH.write_text(json.dumps({- "last_check": time.time(),- "latest_version": latest,- "current_version": current,- }))- except Exception:- pass-- return latest-```--- [ ] **Step 2: Wire into CLI group callback**--In `src/openjarvis/cli/__init__.py`, update the `cli` function (line 39-46) to call the version check:--```python[email protected](help="OpenJarvis — modular AI assistant backend")[email protected]_option(version=openjarvis.__version__, prog_name="jarvis")[email protected]("--verbose", is_flag=True, default=False, help="Enable debug logging")[email protected]("--quiet", is_flag=True, default=False, help="Suppress non-error output")[email protected]_context-def cli(ctx: click.Context, verbose: bool, quiet: bool) -> None:- """Top-level CLI group."""- from openjarvis.cli.log_config import setup_logging-- ctx.ensure_object(dict)- ctx.obj["verbose"] = verbose- ctx.obj["quiet"] = quiet- setup_logging(verbose=verbose, quiet=quiet)-- # Check for updates on interactive commands- if not quiet and ctx.invoked_subcommand:- from openjarvis.cli._version_check import check_for_updates- check_for_updates(ctx.invoked_subcommand)-```--- [ ] **Step 3: Verify lint passes**--Run: `uv run ruff check src/openjarvis/cli/_version_check.py src/openjarvis/cli/__init__.py`-Expected: All checks passed--- [ ] **Step 4: Commit**--```bash-git add src/openjarvis/cli/_version_check.py src/openjarvis/cli/__init__.py-git commit -m "feat: CLI version check against GitHub releases (daily, cached)"-```-------## Chunk 2: Desktop Auto-Update (Sub-project 2)--### Task 2: Wire Tauri updater in App.tsx--**Files:**-- Modify: `frontend/src/App.tsx`--- [ ] **Step 1: Add auto-update check**--In `frontend/src/App.tsx`, add a new `useEffect` after the existing effects (around line 104, after the opt-in modal effect). The `isTauri` import is already present.--```typescript- // Desktop auto-update check (runs once on launch)- const updateChecked = useRef(false);- useEffect(() => {- if (!isTauri() || updateChecked.current) return;- updateChecked.current = true;-- (async () => {- try {- const { check } = await import('@tauri-apps/plugin-updater');- const update = await check();- if (update) {- await update.downloadAndInstall();- // Update downloaded — user can restart when ready- const { toast } = await import('sonner');- toast.info('Update ready', {- description: 'A new version has been downloaded. Restart to apply.',- duration: Infinity,- action: {- label: 'Restart Now',- onClick: async () => {- const { relaunch } = await import('@tauri-apps/plugin-process');- await relaunch();- },- },- });- }- } catch {- // Silent — no internet or endpoint issue- }- })();- }, []);-```--Also add `useRef` to the React import at line 1 (if not already present):-```typescript-import { useEffect, useState, useCallback, useRef } from 'react';-```--- [ ] **Step 2: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 3: Commit**--```bash-git add frontend/src/App.tsx-git commit -m "feat: desktop auto-update — download in background, toast to restart"-```-------## Chunk 3: Agent UX — Backend (Sub-project 1, Part A)--### Task 3: Write error details to summary_memory on tick failure--**Files:**-- Modify: `src/openjarvis/agents/executor.py:270-280`--- [ ] **Step 1: Add error detail to summary_memory in _finalize_tick**--In `executor.py`, in the error handler (lines 270-280), after `self._manager.update_agent(agent_id, status="error")`, add:--```python- # Write error detail to summary_memory so frontend can display it- error_msg = str(error)[:2000]- self._manager.update_summary_memory(agent_id, f"ERROR: {error_msg}")-```--The full block (lines 270-280) should become:--```python- else:- self._manager.end_tick(agent_id)- self._manager.update_agent(agent_id, status="error")- # Write error detail to summary_memory so frontend can display it- error_msg = str(error)[:2000]- self._manager.update_summary_memory(agent_id, f"ERROR: {error_msg}")- self._bus.publish(EventType.AGENT_TICK_ERROR, {- "agent_id": agent_id,- "error": str(error),- "error_type": (- "fatal" if isinstance(error, FatalError) else "retryable_exhausted"- ),- "duration": duration,- })-```--- [ ] **Step 2: Inject standing instruction into agent context**--In `executor.py`, in `_invoke_agent` (lines 196-205), modify the context building to prepend the instruction:--Replace lines 196-201:-```python- # Build input from summary_memory + pending messages- context = agent.get("summary_memory", "") or "Continue your assigned task."-```--With:-```python- # Build input from instruction + summary_memory + pending messages- instruction = config.get("instruction", "")- memory = agent.get("summary_memory", "")- if instruction:- context = f"Standing instruction: {instruction}"- if memory:- context += f"\n\nPrevious context: {memory}"- else:- context = memory or "Continue your assigned task."-```--- [ ] **Step 3: Run lint and tests**--Run: `uv run ruff check src/openjarvis/agents/executor.py`-Run: `uv run pytest tests/server/ -v --tb=short`-Expected: all pass--- [ ] **Step 4: Commit**--```bash-git add src/openjarvis/agents/executor.py-git commit -m "fix: write error to summary_memory on tick failure, inject standing instruction"-```-------### Task 4: Wire AgentScheduler into the server--**Files:**-- Modify: `src/openjarvis/cli/serve.py:239-260`-- Modify: `src/openjarvis/server/agent_manager_routes.py`--- [ ] **Step 1: Instantiate and start scheduler in serve.py**--In `serve.py`, after the agent_manager creation block (line 250, after `agent_manager = AgentManager(db_path=am_db)`), add scheduler creation:--```python- # Set up agent scheduler for cron/interval agents- agent_scheduler = None- if agent_manager is not None:- try:- from openjarvis.agents.executor import AgentExecutor- from openjarvis.agents.scheduler import AgentScheduler-- executor = AgentExecutor(manager=agent_manager, event_bus=bus)- # Build system for executor- from openjarvis.system import SystemBuilder- system = SystemBuilder(config).build()- executor.set_system(system)-- agent_scheduler = AgentScheduler(- manager=agent_manager,- executor=executor,- event_bus=bus,- )- # Register existing scheduled agents- for ag in agent_manager.list_agents():- sched_type = ag.get("config", {}).get("schedule_type", "manual")- if sched_type in ("cron", "interval") and ag["status"] not in ("archived", "error"):- agent_scheduler.register_agent(ag["id"])- agent_scheduler.start()- console.print(" Scheduler: [cyan]active[/cyan]")- except Exception as exc:- logger.debug("Agent scheduler init failed: %s", exc)-```--Then pass `agent_scheduler` to `create_app` — add it as a keyword argument:--```python- app = create_app(- engine, model_name, agent=agent, bus=bus,- engine_name=engine_name, agent_name=agent_key or "",- channel_bridge=channel_bridge, config=config,- speech_backend=speech_backend,- agent_manager=agent_manager,- agent_scheduler=agent_scheduler,- )-```--- [ ] **Step 2: Accept scheduler in create_app and store on app state**--In `src/openjarvis/server/app.py`, update the `create_app` function signature to accept `agent_scheduler=None` and store it:--Add parameter: `agent_scheduler=None`--Add to app state (after `app.state.agent_manager = agent_manager`):-```python- app.state.agent_scheduler = agent_scheduler-```--- [ ] **Step 3: Register new agents with scheduler in create endpoint**--In `src/openjarvis/server/agent_manager_routes.py`, in the create endpoint (around line 78), after the agent is created, register it with the scheduler:--```python- # Register with scheduler if cron/interval- scheduler = getattr(request.app.state, "agent_scheduler", None)- config = body.get("config", {})- if scheduler and config.get("schedule_type") in ("cron", "interval"):- scheduler.register_agent(agent["id"])-```--- [ ] **Step 4: Run lint and tests**--Run: `uv run ruff check src/openjarvis/cli/serve.py src/openjarvis/server/app.py src/openjarvis/server/agent_manager_routes.py`-Run: `uv run pytest tests/server/ -v --tb=short`-Expected: all pass--- [ ] **Step 5: Commit**--```bash-git add src/openjarvis/cli/serve.py src/openjarvis/server/app.py src/openjarvis/server/agent_manager_routes.py-git commit -m "feat: wire AgentScheduler into server, register agents on create"-```-------## Chunk 4: Agent UX — Frontend (Sub-project 1, Part B)--### Task 5: Add instruction + model fields to agent wizard--**Files:**-- Modify: `frontend/src/pages/AgentsPage.tsx`--- [ ] **Step 1: Add fields to WizardState interface**--Find the `WizardState` interface (around line 133) and add:--```typescript-interface WizardState {- step: number;- templateId: string;- name: string;- instruction: string; // NEW- model: string; // NEW- scheduleType: string;- scheduleValue: string;- selectedTools: string[];- budget: string;- learningEnabled: boolean;-}-```--Update the `useState<WizardState>` initial value (around line 154) to include:--```typescript- instruction: '',- model: '',-```--- [ ] **Step 2: Add instruction textarea and model dropdown to wizard Step 2**--Find the Step 2 configuration section in the JSX (search for "Schedule Type" or `scheduleType`). Add the instruction textarea and model dropdown BEFORE the schedule type selector:--```tsx- {/* Instruction */}- <div>- <div className="text-xs mb-1" style={{ color: 'var(--color-text-secondary)' }}>- What should this agent do?- {(wizard.scheduleType === 'cron' || wizard.scheduleType === 'interval') && (- <span style={{ color: 'var(--color-error)' }}> *</span>- )}- </div>- <textarea- value={wizard.instruction}- onChange={(e) => update({ instruction: e.target.value })}- placeholder="e.g. Monitor my inbox and summarize new emails every hour"- rows={3}- className="w-full text-sm px-3 py-2 rounded-lg outline-none resize-none"- style={{- background: 'var(--color-bg-secondary)',- color: 'var(--color-text)',- border: '1px solid var(--color-border)',- }}- />- <div className="text-[10px] mt-0.5" style={{ color: 'var(--color-text-tertiary)' }}>- This instruction runs every tick. Tasks are optional one-off goals.- </div>- </div>-- {/* Model */}- <div>- <div className="text-xs mb-1" style={{ color: 'var(--color-text-secondary)' }}>Model</div>- <select- value={wizard.model}- onChange={(e) => update({ model: e.target.value })}- className="w-full text-sm px-3 py-2 rounded-lg outline-none cursor-pointer"- style={{- background: 'var(--color-bg-secondary)',- color: 'var(--color-text)',- border: '1px solid var(--color-border)',- }}- >- <option value="">Server default</option>- {useAppStore.getState().models.map((m) => (- <option key={m.id} value={m.id}>{m.id}</option>- ))}- </select>- </div>-```--- [ ] **Step 3: Pass instruction and model to config in handleLaunch**--Update the `handleLaunch` function (around line 192) to include instruction and model:--```typescript- const config: Record<string, unknown> = {- schedule_type: wizard.scheduleType,- schedule_value: wizard.scheduleValue || undefined,- tools: wizard.selectedTools,- learning_enabled: wizard.learningEnabled,- };- if (wizard.budget) config.budget = parseFloat(wizard.budget);- if (wizard.instruction.trim()) config.instruction = wizard.instruction.trim();- if (wizard.model) config.model = wizard.model;-```--Also add validation before the existing name check:--```typescript- if ((wizard.scheduleType === 'cron' || wizard.scheduleType === 'interval') && !wizard.instruction.trim()) {- toast.error('Instruction is required for scheduled agents');- return;- }-```--- [ ] **Step 4: Auto-run interval agents after creation**--In `handleLaunch`, after `toast.success(...)` and before `onLaunched()`, add:--```typescript- // Auto-run first tick for interval agents- if (wizard.scheduleType === 'interval' && created.id) {- runManagedAgent(created.id).catch(() => {});- }-```--Note: capture the return value from `createManagedAgent`:--```typescript- const created = await createManagedAgent({- name: wizard.name,- template_id: wizard.templateId || undefined,- config,- });-```--- [ ] **Step 5: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 6: Commit**--```bash-git add frontend/src/pages/AgentsPage.tsx-git commit -m "feat: instruction + model fields in agent wizard, auto-run interval agents"-```-------### Task 6: Add error toasts and polling to AgentsPage--**Files:**-- Modify: `frontend/src/pages/AgentsPage.tsx`--- [ ] **Step 1: Add error polling and post-run error check**--In the main `AgentsPage` component, find the `handleRun` function. Update it to check for errors after running:--```typescript- const handleRun = async (id: string) => {- await runManagedAgent(id).catch(() => {});- // Wait 3 seconds then check if the agent errored- setTimeout(async () => {- try {- const agent = await fetchManagedAgent(id);- if (agent.status === 'error') {- toast.error(`Agent "${agent.name}" failed`, {- description: agent.summary_memory?.replace(/^ERROR: /, '') || 'Unknown error',- });- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'error', category: 'model',- message: `Agent "${agent.name}" failed: ${agent.summary_memory || 'Unknown error'}`,- });- }- } catch {}- await refresh();- }, 3000);- await refresh();- };-```--- [ ] **Step 2: Add 30-second polling for error detection**--In the main `AgentsPage` component, add a `useEffect` that polls for agent errors:--```typescript- // Poll for agent errors every 30 seconds- const prevStatuses = useRef<Record<string, string>>({});- useEffect(() => {- const interval = setInterval(async () => {- try {- const agents = await fetchManagedAgents();- for (const agent of agents) {- const prev = prevStatuses.current[agent.id];- if (prev && prev !== 'error' && agent.status === 'error') {- toast.error(`Agent "${agent.name}" failed`, {- description: agent.summary_memory?.replace(/^ERROR: /, '') || 'Unknown error',- });- }- prevStatuses.current[agent.id] = agent.status;- }- } catch {}- }, 30000);- return () => clearInterval(interval);- }, []);-```--Make sure `useRef` is imported from React.--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Commit**--```bash-git add frontend/src/pages/AgentsPage.tsx-git commit -m "feat: error toasts for agent failures, 30s polling for error detection"-```-------## Chunk 5: Final Verification--### Task 7: Build and test everything--- [ ] **Step 1: TypeScript check**-Run: `cd frontend && npx tsc --noEmit`--- [ ] **Step 2: Frontend build**-Run: `cd frontend && npm run build`--- [ ] **Step 3: Python lint**-Run: `uv run ruff check src/ tests/`--- [ ] **Step 4: Python tests**-Run: `uv run pytest tests/server/ -v --tb=short`--- [ ] **Step 5: Cargo check**-Run: `cd desktop/src-tauri && cargo check`--- [ ] **Step 6: Push**-```bash-git push origin main-```diff --git a/docs/superpowers/plans/2026-03-14-desktop-ux-improvements.md b/docs/superpowers/plans/2026-03-14-desktop-ux-improvements.mddeleted file mode 100644index ac2b7c74..00000000--- a/docs/superpowers/plans/2026-03-14-desktop-ux-improvements.md+++ /dev/null@@ -1,930 +0,0 @@-# Desktop UX Improvements Implementation Plan--> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.--**Goal:** Improve the OpenJarvis desktop app and web browser UX with 7 changes: new app logo, cleaner system panel with device temps, theme toggle, better streaming labels, model switching feedback, and a logs page.--**Architecture:** All changes are frontend-first (React/TypeScript/Zustand). One backend change extends the existing `/v1/telemetry/energy` endpoint to include temperature fields already collected by `EnergySample`. No new backend endpoints needed — temperatures are already in the data pipeline, just not exposed via the API.--**Tech Stack:** React 19, TypeScript, Zustand, Tailwind CSS, Lucide icons, FastAPI (backend), Python telemetry modules, sips (macOS image conversion)--**Spec:** `docs/superpowers/specs/2026-03-14-desktop-ux-improvements-design.md`-------## Chunk 0: App Logo--### Task 0: Replace app icons with new arc reactor logo--**Source image:** `/Users/jonsaadfalcon/Documents/OpenJarvis_Logos/OpenJarvis_DesktopAppLogo_DarkBackground_ZoomedIn.png`--**Files:**-- Replace: `desktop/src-tauri/icons/32x32.png`-- Replace: `desktop/src-tauri/icons/128x128.png`-- Replace: `desktop/src-tauri/icons/[email protected]`-- Replace: `desktop/src-tauri/icons/256x256.png`-- Replace: `desktop/src-tauri/icons/icon.png`-- Replace: `desktop/src-tauri/icons/icon.icns`-- Replace: `desktop/src-tauri/icons/icon.ico`-- Replace: `frontend/public/favicon.ico`-- Replace: `frontend/public/apple-touch-icon.png`-- Replace: `frontend/public/pwa-192x192.png`-- Replace: `frontend/public/pwa-512x512.png`--- [ ] **Step 1: Generate all PNG sizes from source image**--```bash-SRC="/Users/jonsaadfalcon/Documents/OpenJarvis_Logos/OpenJarvis_DesktopAppLogo_DarkBackground_ZoomedIn.png"-ICONS="desktop/src-tauri/icons"-PUBLIC="frontend/public"--# Desktop icons-sips -z 32 32 "$SRC" --out "$ICONS/32x32.png"-sips -z 128 128 "$SRC" --out "$ICONS/128x128.png"-sips -z 256 256 "$SRC" --out "$ICONS/[email protected]"-sips -z 256 256 "$SRC" --out "$ICONS/256x256.png"-sips -z 1024 1024 "$SRC" --out "$ICONS/icon.png"--# Frontend icons-sips -z 180 180 "$SRC" --out "$PUBLIC/apple-touch-icon.png"-sips -z 192 192 "$SRC" --out "$PUBLIC/pwa-192x192.png"-sips -z 512 512 "$SRC" --out "$PUBLIC/pwa-512x512.png"-```--- [ ] **Step 2: Generate .icns for macOS**--```bash-mkdir -p /tmp/openjarvis-icon.iconset-sips -z 16 16 "$SRC" --out /tmp/openjarvis-icon.iconset/icon_16x16.png-sips -z 32 32 "$SRC" --out /tmp/openjarvis-icon.iconset/[email protected]-sips -z 32 32 "$SRC" --out /tmp/openjarvis-icon.iconset/icon_32x32.png-sips -z 64 64 "$SRC" --out /tmp/openjarvis-icon.iconset/[email protected]-sips -z 128 128 "$SRC" --out /tmp/openjarvis-icon.iconset/icon_128x128.png-sips -z 256 256 "$SRC" --out /tmp/openjarvis-icon.iconset/[email protected]-sips -z 256 256 "$SRC" --out /tmp/openjarvis-icon.iconset/icon_256x256.png-sips -z 512 512 "$SRC" --out /tmp/openjarvis-icon.iconset/[email protected]-sips -z 512 512 "$SRC" --out /tmp/openjarvis-icon.iconset/icon_512x512.png-sips -z 1024 1024 "$SRC" --out /tmp/openjarvis-icon.iconset/[email protected]-iconutil -c icns /tmp/openjarvis-icon.iconset -o "$ICONS/icon.icns"-rm -rf /tmp/openjarvis-icon.iconset-```--- [ ] **Step 3: Generate .ico for Windows**--```bash-# Use sips to create the sizes, then ImageMagick convert (or pip install Pillow)-python3 -c "-from PIL import Image-img = Image.open('$ICONS/icon.png')-img.save('$ICONS/icon.ico', sizes=[(16,16),(32,32),(48,48),(64,64),(128,128),(256,256)])-"-```--If Pillow is not available, install with `pip3 install Pillow` first.--- [ ] **Step 4: Generate favicon.ico for web**--```bash-python3 -c "-from PIL import Image-img = Image.open('$PUBLIC/pwa-512x512.png')-img.save('$PUBLIC/favicon.ico', sizes=[(16,16),(32,32),(48,48)])-"-```--- [ ] **Step 5: Verify icons exist and are correct sizes**--```bash-file desktop/src-tauri/icons/*.png desktop/src-tauri/icons/icon.icns desktop/src-tauri/icons/icon.ico-file frontend/public/favicon.ico frontend/public/apple-touch-icon.png frontend/public/pwa-*.png-```--- [ ] **Step 6: Commit**--```bash-git add desktop/src-tauri/icons/ frontend/public/favicon.ico frontend/public/apple-touch-icon.png frontend/public/pwa-192x192.png frontend/public/pwa-512x512.png-git commit -m "feat: replace app icons with arc reactor logo"-```-------## Chunk 1: Foundation — Types, Store, and Backend--### Task 1: Add LogEntry type and extend store--**Files:**-- Modify: `frontend/src/types/index.ts`-- Modify: `frontend/src/lib/store.ts`--- [ ] **Step 1: Add LogEntry interface to types**--In `frontend/src/types/index.ts`, add after the `ServerInfo` interface (line 120):--```typescript-// --- Log Types -----export interface LogEntry {- timestamp: number;- level: 'info' | 'warn' | 'error';- category: 'server' | 'model' | 'chat' | 'tool';- message: string;-}-```--- [ ] **Step 2: Add log and model-loading state to store**--In `frontend/src/lib/store.ts`, add to the `AppState` interface (after line 183, the `setSelectedAgentId` line):--```typescript- // Logs- logEntries: LogEntry[];- addLogEntry: (entry: LogEntry) => void;- clearLogs: () => void;-- // Model loading- modelLoading: boolean;- setModelLoading: (loading: boolean) => void;-```--Add the import at the top of `store.ts`:--```typescript-import type { LogEntry } from '../types';-```--(Add `LogEntry` to the existing import from `'../types'`.)--Add the implementations in the store body (after the agent events section, ~line 388):--```typescript- // ── Logs ────────────────────────────────────────────────────────- logEntries: [],- addLogEntry: (entry) => set((s) => ({- logEntries: [...s.logEntries.slice(-499), entry],- })),- clearLogs: () => set({ logEntries: [] }),-- // ── Model loading ───────────────────────────────────────────────- modelLoading: false,- setModelLoading: (loading) => set({ modelLoading: loading }),-```--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Commit**--```bash-git add frontend/src/types/index.ts frontend/src/lib/store.ts-git commit -m "feat: add LogEntry type, log store, and modelLoading state"-```-------### Task 2: Expose temperature in /v1/telemetry/energy endpoint--**Files:**-- Modify: `src/openjarvis/server/api_routes.py:240-271`--The `EnergySample` dataclass already has `mean_temperature_c` and `peak_temperature_c` fields (populated by NVIDIA monitors, zero for others). We just need to include them in the API response.--- [ ] **Step 1: Add temp fields to the energy endpoint response**--In `src/openjarvis/server/api_routes.py`, in the `telemetry_energy` function, update the return dict (lines 259-267) to:--```python- return {- "total_energy_j": total_energy,- "energy_per_token_j": (- total_energy / total_tokens if total_tokens > 0 else 0- ),- "avg_power_w": (- total_energy / total_latency if total_latency > 0 else 0- ),- "cpu_temp_c": None, # populated per-platform below- "gpu_temp_c": None,- }-```--Note: The current aggregator `summary()` doesn't directly expose per-sample temperature. For v1, return `None` (the frontend handles graceful degradation). A follow-up task can wire the live energy monitor's last sample temperature through.--Also update the empty fallback response (line 250) to include the new fields:--```python- return {"total_energy_j": 0, "energy_per_token_j": 0, "avg_power_w": 0, "cpu_temp_c": None, "gpu_temp_c": None}-```--- [ ] **Step 2: Run lint and tests**--Run: `uv run ruff check src/openjarvis/server/api_routes.py`-Run: `uv run pytest tests/server/ -v --tb=short`-Expected: all pass--- [ ] **Step 3: Commit**--```bash-git add src/openjarvis/server/api_routes.py-git commit -m "feat: include cpu/gpu temp fields in telemetry energy endpoint"-```-------### Task 3: Add preloadModel to api.ts--**Files:**-- Modify: `frontend/src/lib/api.ts`--- [ ] **Step 1: Add preloadModel function**--Add after the `deleteModel` function in `api.ts`:--```typescript-export async function preloadModel(modelName: string): Promise<void> {- // Trigger Ollama to load the model into memory (empty prompt, no generation).- // In Tauri, use the Rust backend; in browser, call Ollama directly via the server.- const ollamaUrl = 'http://127.0.0.1:11434';- try {- const res = await fetch(`${ollamaUrl}/api/generate`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ model: modelName, prompt: '', keep_alive: '5m' }),- signal: AbortSignal.timeout(120_000),- });- if (!res.ok) throw new Error(`Preload failed: ${res.status}`);- } catch (e: any) {- if (e.name === 'TimeoutError') throw new Error('Model load timed out (120s)');- throw e;- }-}-```--- [ ] **Step 2: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 3: Commit**--```bash-git add frontend/src/lib/api.ts-git commit -m "feat: add preloadModel API function for model warm-up"-```-------## Chunk 2: UI Changes — SystemPanel, Sidebar, Streaming Labels--### Task 4: Clean up SystemPanel (remove redundancy, rename ENERGY to DEVICE)--**Files:**-- Modify: `frontend/src/components/Chat/SystemPanel.tsx`--- [ ] **Step 1: Update fetch to use getBase()**--Replace the `fetchData` callback (lines 42-58) to use `getBase()` from api.ts:--```typescript-import { getBase } from '../../lib/api';-```--Then change line 44 from:-```typescript- const base = import.meta.env.VITE_API_URL || '';-```-to:-```typescript- const base = getBase();-```--- [ ] **Step 2: Add temp fields to EnergyData interface**--Update the `EnergyData` interface (lines 17-21):--```typescript-interface EnergyData {- total_energy_j?: number;- energy_per_token_j?: number;- avg_power_w?: number;- cpu_temp_c?: number | null;- gpu_temp_c?: number | null;-}-```--- [ ] **Step 3: Remove thermalStatus logic and "Cool" label**--Delete lines 71-76 (the `thermalStatus` const).--Replace the Energy section (lines 121-155) with:--```tsx- {/* Device */}- <section>- <h4 className="text-[11px] font-medium uppercase tracking-wide mb-2" style={{ color: 'var(--color-text-tertiary)' }}>- Device- </h4>- <div className="grid grid-cols-2 gap-2">- {energy?.cpu_temp_c != null && (- <MiniStat icon={Thermometer} label="CPU Temp" value={String(Math.round(energy.cpu_temp_c))} unit="°C" />- )}- {energy?.gpu_temp_c != null && (- <MiniStat icon={Thermometer} label="GPU Temp" value={String(Math.round(energy.gpu_temp_c))} unit="°C" />- )}- <MiniStat- icon={Zap}- label="Power"- value={(energy?.avg_power_w ?? 0).toFixed(1)}- unit="W"- />- <MiniStat- icon={Activity}- label="Energy"- value={((energy?.total_energy_j ?? 0) / 1000).toFixed(1)}- unit="kJ"- />- </div>- </section>-```--- [ ] **Step 4: Remove Server-reported section**--Delete lines 220-233 (the "Server-reported savings" block).--- [ ] **Step 5: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 6: Commit**--```bash-git add frontend/src/components/Chat/SystemPanel.tsx-git commit -m "feat: replace Energy section with Device (temps, power, energy), remove server-reported"-```-------### Task 5: Add theme toggle to sidebar header--**Files:**-- Modify: `frontend/src/components/Sidebar/Sidebar.tsx`--- [ ] **Step 1: Add imports and store access**--Add `Sun`, `Moon`, `Monitor` to the lucide-react import (line 3):--```typescript-import {- MessageSquare,- Plus,- BarChart3,- Settings,- Search,- PanelLeftClose,- PanelLeft,- Cpu,- Rocket,- Bot,- Sun,- Moon,- Monitor,-} from 'lucide-react';-```--Inside the `Sidebar` component, add after `setCommandPaletteOpen` (line 28):--```typescript- const settings = useAppStore((s) => s.settings);- const updateSettings = useAppStore((s) => s.updateSettings);-- const ThemeIcon = settings.theme === 'light' ? Sun : settings.theme === 'dark' ? Moon : Monitor;- const nextTheme = settings.theme === 'light' ? 'dark' : settings.theme === 'dark' ? 'system' : 'light';-```--- [ ] **Step 2: Add the icon button in the header**--In the header `div` (line 68), insert the theme toggle button between the collapse button and the new-chat button. Replace the header div:--```tsx- <div className="flex items-center justify-between px-3 pt-3 pb-2">- <button- onClick={toggleSidebar}- className="p-2 rounded-lg transition-colors cursor-pointer"- style={{ color: 'var(--color-text-secondary)' }}- onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-bg-tertiary)')}- onMouseLeave={(e) => (e.currentTarget.style.background = 'transparent')}- >- <PanelLeftClose size={18} />- </button>- <div className="flex items-center gap-1">- <button- onClick={() => updateSettings({ theme: nextTheme })}- className="p-2 rounded-lg transition-colors cursor-pointer"- style={{ color: 'var(--color-text-secondary)' }}- onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-bg-tertiary)')}- onMouseLeave={(e) => (e.currentTarget.style.background = 'transparent')}- title={`Theme: ${settings.theme} (click for ${nextTheme})`}- >- <ThemeIcon size={16} />- </button>- <button- onClick={handleNewChat}- className="p-2 rounded-lg transition-colors cursor-pointer"- style={{ color: 'var(--color-text-secondary)' }}- onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-bg-tertiary)')}- onMouseLeave={(e) => (e.currentTarget.style.background = 'transparent')}- title="New chat"- >- <Plus size={18} />- </button>- </div>- </div>-```--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Commit**--```bash-git add frontend/src/components/Sidebar/Sidebar.tsx-git commit -m "feat: add theme toggle icon in sidebar header"-```-------### Task 6: Update streaming status labels--**Files:**-- Modify: `frontend/src/components/Chat/InputArea.tsx`--- [ ] **Step 1: Change "Sending..." to "Connecting..."**--Find the `setStreamState` call at ~line 132:--```typescript- setStreamState({- isStreaming: true,- phase: 'Sending...',-```--Change to:--```typescript- setStreamState({- isStreaming: true,- phase: 'Connecting...',-```--- [ ] **Step 2: Change "Running {tool}..." to "Calling {tool}..."**--Find the string `Running ${data.tool}...` (in the `tool_call_start` handler):--```typescript- phase: `Running ${data.tool}...`,-```--Change to:--```typescript- phase: `Calling ${data.tool}...`,-```--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Commit**--```bash-git add frontend/src/components/Chat/InputArea.tsx-git commit -m "fix: update streaming labels to Connecting/Calling"-```-------## Chunk 3: Model Loading Indicator--### Task 7: Wire model preloading through CommandPalette and show loading in sidebar--**Files:**-- Modify: `frontend/src/components/CommandPalette.tsx`-- Modify: `frontend/src/components/Sidebar/Sidebar.tsx`-- Modify: `frontend/src/components/Chat/InputArea.tsx`--- [ ] **Step 1: Trigger preload on model selection in CommandPalette**--In `CommandPalette.tsx`, add imports:--```typescript-import { pullModel, deleteModel, fetchModels, preloadModel } from '../lib/api';-```--(`preloadModel` added to the existing import.)--Update `handleSelect` (line 68-71) to:--```typescript- const handleSelect = async (modelId: string) => {- const previousModel = selectedModel;- setSelectedModel(modelId);- setCommandPaletteOpen(false);-- // Preload the model if switching to a different one- if (modelId !== previousModel) {- const { setModelLoading, addLogEntry } = useAppStore.getState();- setModelLoading(true);- addLogEntry({ timestamp: Date.now(), level: 'info', category: 'model', message: `Switching to ${modelId}...` });- try {- await preloadModel(modelId);- addLogEntry({ timestamp: Date.now(), level: 'info', category: 'model', message: `${modelId} loaded` });- } catch (e: any) {- addLogEntry({ timestamp: Date.now(), level: 'error', category: 'model', message: `Failed to load ${modelId}: ${e.message}` });- } finally {- setModelLoading(false);- }- }- };-```--- [ ] **Step 2: Show loading state in sidebar model badge**--In `Sidebar.tsx`, add to store access:--```typescript- const modelLoading = useAppStore((s) => s.modelLoading);-```--Add `Loader2` to the lucide-react imports.--Update the model badge inner content (lines 102-111 inside the button). Replace everything between the opening `>` of the button and the closing `</button>`:--```tsx- {modelLoading ? (- <Loader2 size={14} className="animate-spin" style={{ color: 'var(--color-accent)' }} />- ) : (- <Cpu size={14} />- )}- <div className="flex-1 min-w-0">- <span className="truncate block text-left" style={{ color: 'var(--color-text)' }}>- {selectedModel || serverInfo?.model || 'Select model'}- </span>- {modelLoading && (- <span className="text-[10px] block" style={{ color: 'var(--color-accent)' }}>- Loading model...- </span>- )}- </div>- {!modelLoading && (- <kbd- className="text-[10px] px-1.5 py-0.5 rounded font-mono"- style={{ background: 'var(--color-bg-tertiary)', color: 'var(--color-text-tertiary)' }}- >- ⌘K- </kbd>- )}-```--- [ ] **Step 3: Disable input during model loading**--In `InputArea.tsx`, add:--```typescript- const modelLoading = useAppStore((s) => s.modelLoading);-```--Find the textarea's `disabled={streamState.isStreaming}` and change to:--```typescript- disabled={streamState.isStreaming || modelLoading}-```--Find the send button's `disabled={!input.trim()}` and change to:--```typescript- disabled={!input.trim() || modelLoading}-```--- [ ] **Step 4: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 5: Commit**--```bash-git add frontend/src/components/CommandPalette.tsx frontend/src/components/Sidebar/Sidebar.tsx frontend/src/components/Chat/InputArea.tsx-git commit -m "feat: model switching shows loading spinner, disables input until ready"-```-------## Chunk 4: Logs Page and Log Emission--### Task 8: Create LogsPage component--**Files:**-- Create: `frontend/src/pages/LogsPage.tsx`--- [ ] **Step 1: Create the LogsPage**--```typescript-import { useRef, useEffect } from 'react';-import { ScrollText, Copy, Trash2 } from 'lucide-react';-import { useAppStore } from '../lib/store';--const LEVEL_COLORS: Record<string, string> = {- info: 'var(--color-text)',- warn: 'var(--color-warning)',- error: 'var(--color-error)',-};--function formatTime(ts: number): string {- const d = new Date(ts);- return d.toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' });-}--export function LogsPage() {- const logEntries = useAppStore((s) => s.logEntries);- const clearLogs = useAppStore((s) => s.clearLogs);- const bottomRef = useRef<HTMLDivElement>(null);-- useEffect(() => {- bottomRef.current?.scrollIntoView({ behavior: 'smooth' });- }, [logEntries.length]);-- const handleCopy = async () => {- const text = logEntries- .map((e) => `${formatTime(e.timestamp)} [${e.level}] [${e.category}] ${e.message}`)- .join('\n');- await navigator.clipboard.writeText(text);- };-- return (- <div className="flex-1 flex flex-col overflow-hidden p-6">- <div className="max-w-4xl mx-auto w-full flex flex-col flex-1 overflow-hidden">- {/* Header */}- <div className="flex items-center gap-3 mb-4 shrink-0">- <ScrollText size={24} style={{ color: 'var(--color-accent)' }} />- <h1 className="text-xl font-semibold flex-1" style={{ color: 'var(--color-text)' }}>- Logs- </h1>- <span className="text-xs" style={{ color: 'var(--color-text-tertiary)' }}>- {logEntries.length} entries- </span>- <button- onClick={handleCopy}- className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer"- style={{ background: 'var(--color-bg-secondary)', color: 'var(--color-text-secondary)', border: '1px solid var(--color-border)' }}- >- <Copy size={12} /> Copy All- </button>- <button- onClick={clearLogs}- className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer"- style={{ background: 'var(--color-bg-secondary)', color: 'var(--color-text-secondary)', border: '1px solid var(--color-border)' }}- >- <Trash2 size={12} /> Clear- </button>- </div>-- {/* Log entries */}- <div- className="flex-1 overflow-y-auto rounded-xl p-4 font-mono text-xs leading-relaxed"- style={{ background: 'var(--color-surface)', border: '1px solid var(--color-border)' }}- >- {logEntries.length === 0 ? (- <div className="text-center py-12" style={{ color: 'var(--color-text-tertiary)' }}>- No log entries yet. Logs appear as you chat, switch models, and interact with the app.- </div>- ) : (- logEntries.map((entry, i) => (- <div key={i} className="py-0.5">- <span style={{ color: 'var(--color-text-tertiary)' }}>{formatTime(entry.timestamp)}</span>- {' '}- <span style={{ color: LEVEL_COLORS[entry.level] || 'var(--color-text)' }}>- [{entry.category}]- </span>- {' '}- <span style={{ color: LEVEL_COLORS[entry.level] || 'var(--color-text)' }}>- {entry.message}- </span>- </div>- ))- )}- <div ref={bottomRef} />- </div>- </div>- </div>- );-}-```--- [ ] **Step 2: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 3: Commit**--```bash-git add frontend/src/pages/LogsPage.tsx-git commit -m "feat: create LogsPage component"-```-------### Task 9: Add Logs route and nav item--**Files:**-- Modify: `frontend/src/App.tsx`-- Modify: `frontend/src/components/Sidebar/Sidebar.tsx`--- [ ] **Step 1: Add route in App.tsx**--Add import at top of `App.tsx`:--```typescript-import { LogsPage } from './pages/LogsPage';-```--Add route inside the `<Route element={<Layout />}>` block, after the agents route:--```tsx- <Route path="logs" element={<LogsPage />} />-```--- [ ] **Step 2: Add Logs nav item in Sidebar.tsx**--Add `ScrollText` to the lucide-react import.--In the `navItems` array (lines 35-41), add between Agents and Settings:--```typescript- { path: '/logs', icon: ScrollText, label: 'Logs' },-```--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Commit**--```bash-git add frontend/src/App.tsx frontend/src/components/Sidebar/Sidebar.tsx-git commit -m "feat: add Logs route and nav item"-```-------### Task 10: Emit log entries from chat and model operations--**Files:**-- Modify: `frontend/src/components/Chat/InputArea.tsx`-- Modify: `frontend/src/components/CommandPalette.tsx`--- [ ] **Step 1: Add log emission to InputArea streaming**--In `InputArea.tsx`, add at top of the `sendMessage` callback, after the `setStreamState` call (~line 122):--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(),- level: 'info',- category: 'chat',- message: `Request: "${content.slice(0, 80)}${content.length > 80 ? '...' : ''}" → ${selectedModel}`,- });-```--In the `inference_start` event handler (~line 149), add:--```typescript- setStreamState({ phase: 'Generating...' });- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'info', category: 'chat',- message: `Generating with ${selectedModel}...`,- });-```--In the `tool_call_start` handler (~line 152), add after the existing `setStreamState`:--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'info', category: 'tool',- message: `Calling ${data.tool}(${data.arguments || ''})`,- });-```--In the error catch (~line 191), add:--```typescript- if (err.name !== 'AbortError') {- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'error', category: 'chat',- message: `Stream error: ${err?.message || String(err)}`,- });- }-```--In the finally block, after `resetStream()`, add:--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'info', category: 'chat',- message: `Response: ${accumulatedContent.length} chars`,- });-```--- [ ] **Step 2: Add log emission to CommandPalette model operations**--In `CommandPalette.tsx`, the model switch logging was already added in Task 7. Add logging for pull and delete operations.--In `handlePull` (~line 80), add after `setPullSuccess`:--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'info', category: 'model',- message: `Downloaded ${modelId}`,- });-```--In `handlePull` catch block:--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'error', category: 'model',- message: `Download failed for ${modelId}: ${e.message}`,- });-```--In `handleDelete`, after the `deleteModel` call:--```typescript- useAppStore.getState().addLogEntry({- timestamp: Date.now(), level: 'info', category: 'model',- message: `Deleted ${modelId}`,- });-```--- [ ] **Step 3: Verify TypeScript compiles**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 4: Run full lint**--Run: `uv run ruff check src/ tests/`-Expected: all pass--- [ ] **Step 5: Commit**--```bash-git add frontend/src/components/Chat/InputArea.tsx frontend/src/components/CommandPalette.tsx-git commit -m "feat: emit log entries from chat streaming and model operations"-```-------## Chunk 5: Final Verification--### Task 11: Build and test everything--- [ ] **Step 1: Run TypeScript check**--Run: `cd frontend && npx tsc --noEmit`-Expected: no errors--- [ ] **Step 2: Run frontend build**--Run: `cd frontend && npm run build`-Expected: successful build--- [ ] **Step 3: Run Python lint**--Run: `uv run ruff check src/ tests/`-Expected: all pass--- [ ] **Step 4: Run Python tests**--Run: `uv run pytest tests/server/ -v --tb=short`-Expected: all 100+ tests pass--- [ ] **Step 5: Run Rust cargo check (for desktop)**--Run: `cd desktop/src-tauri && cargo check`-Expected: no errors (our changes are frontend + Python only, but verify no breakage)--- [ ] **Step 6: Final commit with all files verified**--If any files weren't committed in previous tasks:--```bash-git status-# add any remaining files-git commit -m "chore: final verification — all checks pass"-```diff --git a/docs/superpowers/specs/2026-03-14-agents-updates-design.md b/docs/superpowers/specs/2026-03-14-agents-updates-design.mddeleted file mode 100644index ef1dc846..00000000--- a/docs/superpowers/specs/2026-03-14-agents-updates-design.md+++ /dev/null@@ -1,186 +0,0 @@-# Agent UX, Auto-Update, and CLI Version Check — Design Spec--**Date:** 2026-03-14-**Scope:** Frontend (React), Backend (Python agents/scheduler), Desktop (Tauri/Rust), CLI (Click)-**Sub-projects:** 3 independent areas that can be implemented in any order-------## Sub-project 1: Agent UX Overhaul--### 1A. Standing Instruction Field--**Problem:** Interval/cron agents are created without knowing what to do. Users must separately add tasks after creation, which is confusing.--**Change:**-- Add an `instruction` field to the agent config. This is the agent's standing purpose — it runs every tick as the primary prompt.-- In the creation wizard (Step 2), add a textarea: "What should this agent do?" Required for cron/interval schedule types, optional for manual.-- The instruction is stored in `config.instruction` on the managed agent record (no schema migration — `config_json` is a freeform JSON blob).-- The executor injects the instruction as the first message in the agent's context on every tick: `"Standing instruction: {instruction}"`.-- The instruction is editable in the agent detail view (Overview tab).-- Tasks remain as optional one-off goals. The instruction is "who you are", tasks are "specific things to handle now."--**Config editing caution:** The PATCH API for agents does a full `config` replacement (`json.dumps(kwargs["config"])`). When editing only the instruction from the Overview tab, the frontend must read the current config, merge the instruction change, and send the full config object to avoid clobbering other config fields (schedule_type, tools, budget, etc.).--**Validation:** Frontend validates that instruction is non-empty for cron/interval agents before allowing launch. Backend `create` endpoint also rejects cron/interval agents with empty instruction (return 400).--**Files:**-- `frontend/src/pages/AgentsPage.tsx` — add instruction textarea to wizard Step 2, add instruction display/edit to Overview tab-- `src/openjarvis/agents/executor.py` — inject `config.instruction` into agent context at tick start-- `src/openjarvis/server/agent_manager_routes.py` — add validation in create endpoint--### 1B. Model Selection for Agents--**Problem:** Agents use whatever model the server was started with. Users can't choose a different model per agent.--**Change:**-- Add a `model` dropdown to the creation wizard (Step 2), defaulting to the currently selected chat model.-- Store as `config.model` on the managed agent record.-- The executor already reads `config.get("model")` at line 181 and falls back to the system default. No backend change needed for the execution path.-- The model is editable in the agent detail view (Overview tab) without recreating the agent.-- Dropdown populated from the store's `models` array (already fetched at app init from `/v1/models`).--**Files:**-- `frontend/src/pages/AgentsPage.tsx` — add model dropdown to wizard Step 2, add model display/edit to Overview tab--### 1C. Error Visibility (Toast Notifications)--**Problem:** When "Run Now" fails or a scheduled tick errors, the status badge changes to "error" but there's no popup or message explaining what went wrong.--**Change:**-- **Backend fix:** The executor currently sets `status="error"` on failure but does NOT write the error message to `summary_memory` (the `update_summary_memory` call only happens in the success path). Fix: in the executor's error handler, write the error string to `summary_memory` so the frontend can read it.-- **Frontend — post-run check:** After `runManagedAgent()`, wait 3 seconds, then re-fetch the agent. If status is `error`, show a toast via `sonner` with the agent name and the error detail from `summary_memory`. Also emit a log entry.-- **Frontend — periodic polling:** Add a 30-second polling interval in `AgentsPage` (new, does not exist currently) that fetches agent list and compares statuses. If any agent transitioned to `error` since last poll, show a toast.--**Files:**-- `frontend/src/pages/AgentsPage.tsx` — add post-run error check with toast, add 30-second polling interval-- `src/openjarvis/agents/executor.py` — write error string to `summary_memory` in the error/exception handler--### 1D. Auto-Start for Interval/Cron Agents--**Problem:** Creating an interval agent leaves it in `idle` state. The scheduler is not wired into the server, so cron/interval agents never fire automatically.--**Change — scheduler wiring (critical prerequisite):**-The `AgentScheduler` class exists but is never instantiated or started by the server. This must be fixed first:-1. In `serve.py`: instantiate `AgentScheduler` when `agent_manager` is available, start it as a background thread, and register all existing cron/interval agents.-2. Pass the scheduler to the agent manager routes (via app state or router factory) so the create endpoint can register new agents.-3. Stop the scheduler on server shutdown.-4. On server startup, scan `managed_agents` for all non-archived agents with cron/interval schedules and register them with the scheduler (bootstrap).--**Change — auto-start behavior:**-- After creating an interval agent, the frontend calls `runManagedAgent(id)` to trigger the first tick immediately. The scheduler then takes over for subsequent ticks.-- For cron agents: the scheduler registers them and they fire at the next cron match. No immediate first run.-- For manual agents: no change.-- Race condition note: the scheduler's next fire time should be calculated from when the first manual tick completes, not from creation time. The `end_tick` call should update the scheduler's next fire for that agent.--**Files:**-- `src/openjarvis/cli/serve.py` — instantiate and start AgentScheduler, stop on shutdown-- `src/openjarvis/server/agent_manager_routes.py` — accept scheduler, register agents on create, deregister on delete-- `frontend/src/pages/AgentsPage.tsx` — call `runManagedAgent(id)` after creation for interval agents-------## Sub-project 2: Desktop Auto-Update--**Problem:** Users must manually check GitHub releases and download new DMGs. The Tauri updater plugin is configured but not wired up in the frontend.--**Change:**-- On app launch (in `App.tsx`), check for updates using `@tauri-apps/plugin-updater`, guarded by `isTauri()`.-- Wrap in try/catch — silently ignore errors (no internet, endpoint unreachable, etc.).-- Download the update in the background. The UI remains fully usable during download (the async function runs without blocking the React render cycle).-- When download completes, show a toast: "Update ready — restart to apply" with a "Restart Now" button.-- Clicking "Restart Now" calls `relaunch()` from `@tauri-apps/plugin-process`.-- Only check once per launch (not on every route change). Use a ref to prevent double-checking.-- Note: the Tauri updater operates at the Rust level, not via browser fetch, so the CSP `connect-src` restriction does not apply.--**Implementation:**-```typescript-// In App.tsx useEffect, guarded by isTauri()-async function checkUpdate() {- try {- const { check } = await import('@tauri-apps/plugin-updater');- const update = await check();- if (update) {- await update.downloadAndInstall();- // Show toast with "Restart Now" button- }- } catch {- // Silent — no internet or endpoint issue- }-}-```--**Files:**-- `frontend/src/App.tsx` — add update check in a `useEffect` (Tauri-only)-------## Sub-project 3: CLI Version Check--**Problem:** CLI users don't know when a new version is available. They must manually check GitHub.--**Change:**-- Add a `check_for_updates()` function in a new `_version_check.py` module.-- Cache the result in `~/.openjarvis/version-check.json` with a timestamp. Only re-check if >24 hours since last check. Ensure `~/.openjarvis/` directory exists before writing.-- Compare the latest release tag against `openjarvis.__version__` using `packaging.version.Version` for proper semver comparison. Strip the `v` prefix from GitHub tags.-- If a newer version exists, print a yellow message to **stderr** (not stdout, to avoid polluting piped output) before the command runs:- ```- A new version of OpenJarvis is available (v0.1.0 → v0.2.0)- Update: cd ~/OpenJarvis && git pull && uv sync- ```-- Call from a Click group-level callback in `src/openjarvis/cli/__init__.py` that checks the subcommand name — only run for `chat`, `ask`, and `serve`. This avoids repeating the call in three files.-- Network failures are silently ignored (best-effort check).-- For cached results, the check adds ~0ms latency. For fresh API calls (~300ms), the latency is acceptable since `chat`, `ask`, and `serve` are all interactive commands.--**Files:**-- `src/openjarvis/cli/_version_check.py` — new file with `check_for_updates()` function-- `src/openjarvis/cli/__init__.py` — add group-level callback for version check on chat/ask/serve--**Cache format (`~/.openjarvis/version-check.json`):**-```json-{- "last_check": "2026-03-14T20:00:00Z",- "latest_version": "0.2.0",- "current_version": "0.1.0"-}-```--**GitHub API call:**-```-GET https://api.github.com/repos/open-jarvis/OpenJarvis/releases/latest-```-Returns `tag_name` (e.g. `v0.2.0`). No auth required (public repo), rate-limited to 60/hr (once-per-day caching stays well under this).-------## Non-Goals--- No WebSocket/real-time agent status updates (polling is sufficient for v1)-- No agent log streaming (use the Logs page)-- No automatic restart after update download (user clicks "Restart Now")-- No PyPI version check (project is git-based, not published to PyPI yet)-- No breaking change detection in version check (just version comparison)-- No forced updates or blocking update prompts-------## Testing--- Agent UX: existing agent manager tests cover the backend; add test for instruction injection in executor; frontend TypeScript-checked-- Desktop auto-update: manual testing (Tauri updater requires signed builds)-- CLI version check: unit test for version comparison, cache read/write, and tag parsing-- All changes: `tsc --noEmit`, `ruff check`, `pytest tests/server/`, `cargo check`-------## Summary of Changes by File--| File | Changes |-|------|---------|-| `AgentsPage.tsx` | Instruction textarea, model dropdown in wizard; instruction/model edit in detail; error toast + polling; auto-run interval agents |-| `App.tsx` | Desktop auto-update check on launch |-| `executor.py` | Inject `config.instruction` into context; write error to `summary_memory` on failure |-| `agent_manager_routes.py` | Validate instruction on create; accept scheduler; register/deregister agents |-| `serve.py` | Instantiate AgentScheduler, start/stop it, pass to routes |-| `cli/__init__.py` | Group-level callback for version check |-| `cli/_version_check.py` | New file: GitHub releases check, cache, semver comparison |diff --git a/docs/superpowers/specs/2026-03-14-desktop-ux-improvements-design.md b/docs/superpowers/specs/2026-03-14-desktop-ux-improvements-design.mddeleted file mode 100644index 2fc62d62..00000000--- a/docs/superpowers/specs/2026-03-14-desktop-ux-improvements-design.md+++ /dev/null@@ -1,155 +0,0 @@-# Desktop App UX Improvements — Design Spec--**Date:** 2026-03-14-**Scope:** Frontend (React) + minor backend (telemetry)-**Affects:** SystemPanel, Sidebar, InputArea, StreamingDots, new LogsPage, store, api, types-------## 1. System Panel — Remove Redundancy, Add Device Temps--**Problem:** The right-column system panel has a redundant "Server-reported" section that duplicates Cost Comparison data. The "Cool" thermal label is confusing without context.--**Change:**-- Remove the "Server-reported" / per-provider savings section entirely from SystemPanel.-- Rename the "ENERGY" section to "DEVICE".-- Replace the "Cool/Warm/Hot" label with actual CPU and GPU temperatures (e.g. "CPU: 62°C", "GPU: 71°C").-- Keep Power (W) and Energy (kJ) in the same section.-- Display temp rows only when values are non-null (graceful degradation).--**Data flow — per platform:**-- **NVIDIA GPUs:** Already collected via pynvml in `NvidiaEnergyMonitor` (`mean_temperature_c`, `peak_temperature_c` on `EnergySample`). Just needs to be exposed through the API endpoint.-- **macOS (Apple Silicon):** Read CPU die temperature via IOKit SMC keys through the Rust extension (PyO3 bindings already exist in `rust/crates/openjarvis-python/`). Does not require root. Return `null` if unavailable.-- **Linux (no GPU):** Read from `/sys/class/thermal/thermal_zone*/temp`. Return `null` if path doesn't exist.-- **Windows:** Return `null` for v1 (future: WMI queries).-- Backend: extend the `/v1/telemetry/energy` endpoint in `api_routes.py` to include `cpu_temp_c` and `gpu_temp_c` fields from the energy sample.-- Frontend: `SystemPanel.tsx` already polls every 3s. Refactor to use `getBase()` from `api.ts` (fixing existing inconsistency) and add a `fetchDeviceInfo()` function in `api.ts`.--**Files:**-- `frontend/src/components/Chat/SystemPanel.tsx` — remove server-reported section, rename ENERGY to DEVICE, add temp rows, remove Cool/Warm/Hot logic, use `getBase()`-- `frontend/src/lib/api.ts` — add `fetchDeviceInfo()` function-- `src/openjarvis/telemetry/` — add CPU/GPU temp collection for macOS/Linux-- `src/openjarvis/server/api_routes.py` — expose temp data in `/v1/telemetry/energy` response-------## 2. Theme Toggle — Sidebar Header--**Problem:** Theme switching is buried in Settings > Appearance. Needs one-click access.--**Change:**-- Add a sun/moon/monitor icon button in the sidebar header, between the collapse button and the new-chat button.-- Three-state cycle matching the Settings page: light → dark → system → light.-- Uses the existing `updateSettings({ theme })` store action.-- Icons: `Sun` when current theme is light (click → dark), `Moon` when dark (click → system), `Monitor` when system (click → light).--**Files:**-- `frontend/src/components/Sidebar/Sidebar.tsx` — add icon button to header-------## 3. Streaming Status Labels--**Problem:** Status text shows "Sending..." at start of generation. Tool call status says "Running {tool}..." which is vague.--**Change:**-- Initial phase: `"Sending..."` → `"Connecting..."` (accurately describes the period between HTTP request and first SSE event — the model hasn't started generating yet).-- Tool call start: `"Running ${data.tool}..."` → `"Calling ${data.tool}..."`-- All other phases unchanged (`"Agent thinking..."`, `"Generating..."` on `inference_start` are already correct).--**Files:**-- `frontend/src/components/Chat/InputArea.tsx` — update two string literals-------## 4. Model Switching — Loading Indicator--**Problem:** When switching models via Cmd+K, there's no visual feedback. The model badge updates instantly but Ollama needs time to load the new model into memory. Users may send messages before the model is ready.--**Change:**-- Add `modelLoading` boolean to the Zustand store.-- When `setSelectedModel` is called with a different model:- 1. Set `modelLoading = true`- 2. Update the model badge to show a spinner icon + "Loading model..." subtitle text- 3. Trigger Ollama to preload the model via `POST /api/generate` with `{"model": "...", "prompt": "", "keep_alive": "5m"}` (empty prompt loads the model without generating output). Use the same dual-path pattern as other API calls: Tauri invoke with HTTP fallback.- 4. On success, set `modelLoading = false`- 5. On failure after 120-second timeout, set `modelLoading = false` and show error in logs-- While `modelLoading` is true, disable the chat input (prevent sending before model is ready).-- Note: this preload mechanism is Ollama-specific. For other backends (vLLM, SGLang), skip the preload step (models are always loaded).--**Files:**-- `frontend/src/lib/store.ts` — add `modelLoading` state + `setModelLoading` action-- `frontend/src/lib/api.ts` — add `preloadModel()` function (Tauri invoke + HTTP fallback)-- `frontend/src/components/Sidebar/Sidebar.tsx` — show spinner + subtitle in model badge when loading-- `frontend/src/components/Chat/InputArea.tsx` — disable input when `modelLoading` is true-- `frontend/src/components/CommandPalette.tsx` — trigger model preloading on selection-------## 5. Logs Page--**Problem:** Error logging is opaque. When generation fails, users see "Error: Failed to get response" with no way to diagnose what happened or share logs.--**Change:**-- Add a new `LogsPage` component at route `/logs`.-- Add "Logs" nav item to sidebar bottom nav (between Agents and Settings), with `ScrollText` icon.-- Log entries are collected in a Zustand array (`logEntries`) during the session.-- Sources of log entries:- - SSE events during streaming (inference_start, tool_call_start, tool_call_end, errors)- - Model switches and preload results- - Server health check results- - Fetch errors (chat, models, savings)- - Model pull/delete operations-- Each entry: `{ timestamp: number, level: 'info' | 'warn' | 'error', category: string, message: string }`-- Add `LogEntry` interface to `frontend/src/types/index.ts`.-- Categories: `server`, `model`, `chat`, `tool`-- Color coding by **level only**: info = default text color, warn = yellow, error = red. Category shown as a bracketed prefix (e.g. `[model]`, `[chat]`).-- Actions: "Copy All" (copies log text to clipboard), "Clear" (resets array)-- Max 500 entries (FIFO via `.slice(-499)` before appending, matching the existing `addAgentEvent` pattern). Session-scoped (cleared on page reload).--**Files:**-- `frontend/src/pages/LogsPage.tsx` — new page component-- `frontend/src/types/index.ts` — add `LogEntry` interface-- `frontend/src/lib/store.ts` — add `logEntries` array, `addLogEntry` action, `clearLogs` action-- `frontend/src/components/Sidebar/Sidebar.tsx` — add Logs nav item-- `frontend/src/App.tsx` — add route for `/logs`-- `frontend/src/components/Chat/InputArea.tsx` — emit log entries for chat events-- `frontend/src/components/CommandPalette.tsx` — emit log entries for model operations-------## Non-Goals--- No log persistence across sessions (localStorage is too small for meaningful logs)-- No log filtering/search (keep it simple for v1)-- No backend log forwarding (frontend-only collection from existing event streams)-- No changes to the backend streaming protocol (already emits the events we need)-- No Ollama-level model load progress bar (Ollama doesn't expose loading progress via API)-- No Windows temperature support in v1-------## Testing--- Existing `tests/server/test_model_management.py` covers pull/delete/streaming endpoints (no changes needed)-- Frontend: TypeScript compilation (`tsc --noEmit`) validates all type changes-- Manual testing: verify all 6 changes in desktop app and web browser-- Add a pytest test for the extended `/v1/telemetry/energy` response (temp fields present, nullable)-------## Summary of Changes by File--| File | Changes |-|------|---------|-| `SystemPanel.tsx` | Remove server-reported, rename ENERGY→DEVICE, add temps, remove Cool, use `getBase()` |-| `Sidebar.tsx` | Add theme toggle icon, add Logs nav item, model loading spinner |-| `InputArea.tsx` | Update phase labels ("Connecting...", "Calling ..."), disable during model loading |-| `CommandPalette.tsx` | Trigger model preloading, emit log entries |-| `store.ts` | Add `modelLoading`, `setModelLoading`, `logEntries`, `addLogEntry`, `clearLogs` |-| `types/index.ts` | Add `LogEntry` interface |-| `App.tsx` | Add `/logs` route, import LogsPage |-| `LogsPage.tsx` | New file — timestamped log viewer with Copy All / Clear |-| `api.ts` | Add `fetchDeviceInfo()`, `preloadModel()` functions |-| `api_routes.py` | Extend `/v1/telemetry/energy` to include `cpu_temp_c`, `gpu_temp_c` |-| `telemetry/` | Add CPU/GPU temp collection (macOS IOKit, Linux sysfs, NVIDIA already done) |