refactor: Phase 10 — Ollama service, image cache, config, frontend orphans

Final cleanup phase of the MCP-first pivot.

docker-compose:
  - docker-compose.yml: drop ollama service + OLLAMA_URL/MODEL env vars +
    IMAGE_CACHE / VAPID env comments
  - docker-compose.prod.yml: drop ollama service + Ollama env + GPU
    reservation
  - docker-compose.quickstart.yml: drop ollama service + Ollama env +
    GPU-reservation comment; quickstart instructions now point at the
    MCP Access tab instead of model-pull

Config:
  - Drop OLLAMA_URL, OLLAMA_MODEL, OLLAMA_BACKGROUND_MODEL,
    OLLAMA_KEEP_ALIVE_*, OLLAMA_NUM_CTX, EMBEDDING_MODEL (fastembed
    is hard-coded inside services/embeddings.py)
  - Drop IMAGE_CACHE_DIR, IMAGE_MAX_BYTES (image cache subsystem
    deleted)
  - Drop VAPID_PRIVATE_KEY, VAPID_PUBLIC_KEY, VAPID_CLAIMS_SUB (push
    deleted in phase 8)
  - Drop VOICE_ENABLED, STT_BACKEND, STT_MODEL, TTS_BACKEND (voice
    deleted in phase 8)
  - Drop Config.validate() rules for those keys

Image cache deletion:
  - services/images.py, routes/images.py, models/image_cache.py
  - models/__init__.py: drop ImageCache import
  - app.py: drop images_bp registration
  - alembic/versions/0054_drop_image_cache.py: DROP TABLE image_cache

Frontend client.ts orphan exports stripped:
  - getVoiceStatus, getVoiceList, getVoiceLibrary, installVoice,
    uninstallVoice, transcribeAudio, synthesiseSpeech,
    VoiceStatusResult / VoiceEntry / VoiceLibraryEntry types
  - getJournalConfig, saveJournalConfig, getJournalToday/Day/Days,
    triggerJournalPrep, runJournalCurator, listPendingActions,
    approvePendingAction, rejectPendingAction, listJournalMoments,
    updateJournalMoment, deleteJournalMoment, geocodeAddress
  - JournalConfig / JournalLocation / JournalConversation /
    JournalMessage / JournalDayPayload / JournalMoment /
    CuratorRunResult / PendingCuratorAction types
  - consolidateProfile, clearProfileObservations, listProfileObservations
  - ProfileObservationEntry, learned_summary/observations_* fields on
    UserProfile
  - consolidateTask (cascading update to TaskEditorView)
  - getFableMcpInfo, getNewsItems, GetNewsItemsParams, NewsItem import

TaskEditorView:
  - Drop the auto-summary banner + Re-consolidate button
  - Drop isBodyAutoMaintained gate (editor is always user-controlled now)
  - Drop reconsolidate function + reconsolidating ref

SettingsView:
  - profile ref no longer initialises learned_summary /
    observations_count / observations_updated_at (those fields are
    gone from UserProfile type)

Surviving frontend composables/components flagged for likely future
cleanup but not deleted in this commit (no compile errors, just
unreferenced after Phase 7-8):
  - useAssist, useFloatingAssist, useTagSuggestions, useVad,
    useListenMode, useOnnxPreloader (composables)
  - WorkspaceNoteEditor, WorkspaceTaskPanel, WeatherCard, InlineAssistPanel
    (components)
  - api/client.ts still references /api/notes/assist/* and
    /api/notes/suggest-tags via useAssist + useTagSuggestions — those
    endpoints 404 now but no caller hits them; dead at runtime, harmless.

Compose stack collapses to two services: `app` + `db`. No Ollama, no
voice models, no fable-mcp wheel build. First-boot install reduces to:
  docker compose up -d
  → visit web UI → register → Settings → MCP Access → copy snippet
  → claude mcp add … → done.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 19:10:25 -04:00
parent b3fca3ced4
commit 4806c34a3c
14 changed files with 42 additions and 764 deletions
-318
View File
@@ -299,188 +299,6 @@ export function apiSSEStream(
return { close: () => controller.abort(), done };
}
// ---------------------------------------------------------------------------
// Journal
// ---------------------------------------------------------------------------
export interface JournalLocation {
label: string;
address: string;
lat?: number;
lon?: number;
}
export interface JournalConfig {
prep_enabled: boolean;
prep_hour: number;
prep_minute: number;
day_rollover_hour: number;
morning_end_hour?: number;
midday_end_hour?: number;
closeout_enabled?: boolean;
// Ambient-context fields (carried forward from the briefing config schema)
locations?: { home?: JournalLocation; work?: JournalLocation };
temp_unit?: 'C' | 'F';
use_caldav_event_locations?: boolean;
enabled?: boolean;
[key: string]: unknown;
}
export interface JournalConversation {
id: number;
title: string;
model: string;
conversation_type: string;
day_date: string | null;
rag_project_id: number | null;
message_count: number;
created_at: string;
updated_at: string;
}
export interface JournalMessage {
id: number;
conversation_id: number;
role: 'user' | 'assistant' | 'system';
content: string;
status: string;
context_note_id: number | null;
tool_calls: unknown[] | null;
metadata: Record<string, unknown> | null;
created_at: string;
}
export interface JournalDayPayload {
day_date: string;
conversation: JournalConversation | null;
messages: JournalMessage[];
}
export interface JournalMoment {
id: number;
user_id: number;
conversation_id: number | null;
source_message_id: number | null;
day_date: string;
occurred_at: string;
recorded_at: string;
content: string;
raw_excerpt: string | null;
tags: string[];
pinned: boolean;
people: { id: number; title: string }[];
places: { id: number; title: string }[];
task_ids: number[];
note_ids: number[];
score?: number;
}
export async function getJournalConfig(): Promise<JournalConfig> {
return apiGet<JournalConfig>('/api/journal/config');
}
export async function saveJournalConfig(config: JournalConfig): Promise<void> {
await apiPut('/api/journal/config', config);
}
export async function getJournalToday(): Promise<JournalDayPayload> {
return apiGet<JournalDayPayload>('/api/journal/today');
}
export async function getJournalDay(isoDate: string): Promise<JournalDayPayload> {
return apiGet<JournalDayPayload>(`/api/journal/day/${isoDate}`);
}
export async function getJournalDays(): Promise<string[]> {
const data = await apiGet<{ days: string[] }>('/api/journal/days');
return data.days;
}
export async function triggerJournalPrep(date?: string): Promise<{ ok: boolean; message_id: number }> {
return apiPost('/api/journal/trigger-prep', date ? { date } : {});
}
export interface CuratorRunResult {
conv_id: number;
user_id: number;
model: string;
messages_examined: number;
tool_calls: Array<{
name: string;
arguments: Record<string, unknown>;
status: 'success' | 'error' | 'pending';
error: string | null;
}>;
tools_attempted: number;
tools_succeeded: number;
summary: string;
duration_ms: number;
error: string | null;
}
export async function runJournalCurator(convId: number): Promise<CuratorRunResult> {
return apiPost<CuratorRunResult>(`/api/journal/curator/run/${convId}`, {});
}
// Curator-proposed mutations awaiting user review (Needs Review panel).
// See routes/journal.py pending_actions endpoints.
export interface PendingCuratorAction {
id: number;
user_id: number;
conv_id: number | null;
action_type: string; // e.g. "update_note", "delete_note", "update_milestone"
target_type: string | null; // "task" | "note" | "milestone" | "project" | "profile"
target_id: number | null;
target_label: string | null; // human-readable title for the card header
payload: Record<string, unknown>; // the curator's proposed args
current_snapshot: Record<string, unknown>; // target state at proposal time
status: 'pending' | 'approved' | 'rejected';
created_at: string;
reviewed_at: string | null;
}
export async function listPendingActions(): Promise<{ pending: PendingCuratorAction[]; count: number }> {
return apiGet<{ pending: PendingCuratorAction[]; count: number }>('/api/journal/pending');
}
export async function approvePendingAction(actionId: number): Promise<Record<string, unknown>> {
return apiPost<Record<string, unknown>>(`/api/journal/pending/${actionId}/approve`, {});
}
export async function rejectPendingAction(actionId: number): Promise<Record<string, unknown>> {
return apiPost<Record<string, unknown>>(`/api/journal/pending/${actionId}/reject`, {});
}
export async function listJournalMoments(params: Record<string, string | number | boolean> = {}): Promise<JournalMoment[]> {
const qs = new URLSearchParams();
for (const [k, v] of Object.entries(params)) qs.set(k, String(v));
const data = await apiGet<{ moments: JournalMoment[] }>(`/api/journal/moments?${qs}`);
return data.moments;
}
export async function updateJournalMoment(id: number, patch: Partial<JournalMoment>): Promise<JournalMoment> {
return apiPatch<JournalMoment>(`/api/journal/moments/${id}`, patch);
}
export async function deleteJournalMoment(id: number): Promise<void> {
await apiDelete(`/api/journal/moments/${id}`);
}
export async function geocodeAddress(address: string): Promise<{ lat: number; lon: number; display_name: string } | null> {
try {
const r = await apiPost<{ lat: number; lon: number; label: string }>('/api/journal/weather/geocode', { query: address });
return { lat: r.lat, lon: r.lon, display_name: r.label };
} catch {
return null;
}
}
export async function getFableMcpInfo(): Promise<{ available: boolean; filename: string | null }> {
return apiGet('/api/fable-mcp/info');
}
export async function apiStreamPost(
path: string,
body: unknown,
@@ -640,117 +458,6 @@ export const createApiKey = (name: string, scope: 'read' | 'write') =>
export const revokeApiKey = (id: number) => apiDelete(`/api/api-keys/${id}`)
// ─── News ─────────────────────────────────────────────────────────────────────
import type { NewsItem } from '@/types/news'
export interface GetNewsItemsParams {
days?: number
limit?: number
offset?: number
feed_id?: number | null
}
export function getNewsItems(params: GetNewsItemsParams = {}) {
const p = new URLSearchParams()
if (params.days != null) p.set('days', String(params.days))
if (params.limit != null) p.set('limit', String(params.limit))
if (params.offset != null) p.set('offset', String(params.offset))
if (params.feed_id != null) p.set('feed_id', String(params.feed_id))
return apiGet<{ items: NewsItem[]; offset: number; limit: number }>(
`/api/briefing/news?${p}`
)
}
// ─── Voice ────────────────────────────────────────────────────────────────────
export interface VoiceStatusResult {
enabled: boolean
stt: boolean
tts: boolean
stt_model?: string
tts_backend?: string
}
export interface VoiceEntry {
id: string
label: string
language?: string
quality?: string
sample_rate?: number
}
export interface VoiceLibraryEntry {
id: string
name: string
language_code: string
language_name: string
country: string
quality: string
num_speakers: number
size_bytes: number
installed: boolean
installed_source: 'user' | 'bundled' | null
}
export const getVoiceStatus = () => apiGet<VoiceStatusResult>('/api/voice/status')
export const getVoiceList = () =>
apiGet<{ voices: VoiceEntry[] }>('/api/voice/voices').then(r => r.voices)
export const getVoiceLibrary = (refresh = false) =>
apiGet<{ voices: VoiceLibraryEntry[]; count: number }>(
refresh ? '/api/voice/voices/library?refresh=1' : '/api/voice/voices/library'
)
export const installVoice = (voiceId: string) =>
apiPost<{ id: string; size_bytes: number; skipped: boolean }>(
'/api/voice/voices/install',
{ voice_id: voiceId }
)
export const uninstallVoice = (voiceId: string) =>
apiDelete(`/api/voice/voices/${encodeURIComponent(voiceId)}`)
export async function transcribeAudio(blob: Blob, context?: string): Promise<{ transcript: string; duration_ms: number }> {
const form = new FormData()
form.append('audio', blob, 'audio.webm')
if (context) form.append('context', context)
const res = await fetch('/api/voice/transcribe', { method: 'POST', body: form })
if (!res.ok) {
const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` }))
throw new ApiError(res.status, err)
}
return res.json()
}
export async function synthesiseSpeech(
text: string,
voice?: string,
speed?: number,
): Promise<Blob> {
// Only send voice/speed when explicitly provided — omitting them lets the
// server auto-load the user's saved voice settings.
// Voice blending was removed with the kokoro → piper migration (piper has
// no blend equivalent); callers that previously passed `voiceBlend` should
// pass the first voice's id as `voice` instead.
const body: Record<string, unknown> = { text }
if (voice !== undefined || speed !== undefined) {
body.voice = voice ?? 'en_US-amy-medium'
body.speed = speed ?? 1.0
}
const res = await fetch('/api/voice/synthesise', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
if (!res.ok) {
const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` }))
throw new ApiError(res.status, err)
}
return res.blob()
}
// ── User Profile ─────────────────────────────────────────────────────────────
export interface UserProfile {
@@ -762,36 +469,11 @@ export interface UserProfile {
tone: 'casual' | 'professional' | 'technical'
interests: string[]
work_schedule: { days?: string[]; start?: string; end?: string }
learned_summary: string
observations_count: number
observations_updated_at: string | null
}
export const getProfile = () => apiGet<UserProfile>('/api/profile')
export const updateProfile = (data: Partial<UserProfile>) =>
apiPut<UserProfile>('/api/profile', data)
export const consolidateProfile = () =>
apiPost<{ status: string; learned_summary: string }>('/api/profile/consolidate', {})
export const clearProfileObservations = () => apiDelete('/api/profile/observations')
export interface ProfileObservationEntry {
date: string
bullets: string
}
export const listProfileObservations = () =>
apiGet<{ observations: ProfileObservationEntry[] }>('/api/profile/observations')
// ── Tasks ────────────────────────────────────────────────────────────────────
import type { Note as Task } from '../types/note'
/** Manually trigger a consolidation pass for a task. Returns the freshly-
* updated task with new body + consolidated_at. Bypasses the user's
* auto_consolidate_tasks setting. */
export const consolidateTask = (id: number) =>
apiPost<Task>(`/api/tasks/${id}/consolidate`, {})
// ── Note Versions (pinning) ──────────────────────────────────────────────────
+1 -2
View File
@@ -333,8 +333,7 @@ const WORK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
const profile = ref<UserProfile>({
display_name: '', job_title: '', industry: '',
expertise_level: 'intermediate', response_style: 'balanced', tone: 'casual',
interests: [], work_schedule: {}, learned_summary: '',
observations_count: 0, observations_updated_at: null,
interests: [], work_schedule: {},
})
const profileSaving = ref(false)
const profileSaved = ref(false)
+7 -46
View File
@@ -109,29 +109,10 @@ async function toggleSubTask(sub: SubTask) {
}
const showPreview = ref(false);
const sidebarOpen = ref(true);
const reconsolidating = ref(false);
// Body is machine-maintained once a consolidation pass has run. The editor
// is gated to read-only in that state; the user can re-consolidate or rely
// on log_work entries flowing into the next auto pass.
const isBodyAutoMaintained = computed(() => consolidatedAt.value !== null);
async function reconsolidate() {
if (!taskId.value || reconsolidating.value) return;
reconsolidating.value = true;
try {
const { consolidateTask } = await import("@/api/client");
const updated = await consolidateTask(taskId.value);
body.value = updated.body;
consolidatedAt.value = updated.consolidated_at ?? null;
savedBody = body.value;
toast.show("Task summary refreshed");
} catch {
toast.show("Failed to re-consolidate", "error");
} finally {
reconsolidating.value = false;
}
}
// reconsolidate / isBodyAutoMaintained removed in Phase 8 — the curator
// that auto-maintained task bodies is gone, so the body editor is now
// always user-controlled.
const editorRef = ref<InstanceType<typeof TiptapEditor> | null>(null);
const titleRef = ref<HTMLInputElement | null>(null);
const tiptapEditor = computed<Editor | null>(() => {
@@ -485,33 +466,16 @@ useEditorGuards(dirty, save);
<!-- Main column -->
<div class="task-main" @keydown.ctrl.e.prevent="tiptapEditor?.commands.focus()">
<!-- Auto-summary banner when consolidation has run on this task. -->
<div v-if="isBodyAutoMaintained" class="auto-summary-banner-editor">
<span class="auto-summary-icon" aria-hidden="true"></span>
Auto-summarized from work logs.
<button
type="button"
class="btn-reconsolidate"
:disabled="reconsolidating"
@click="reconsolidate"
>
{{ reconsolidating ? "Re-consolidating…" : "Re-consolidate" }}
</button>
</div>
<!-- Write / Preview tabs + toolbar sit above the editor.
Write tab hidden when body is machine-maintained use Re-consolidate
or edit work logs instead. -->
<!-- Write / Preview tabs + toolbar sit above the editor. -->
<div class="body-tabs-row">
<div class="editor-tabs">
<button
v-if="!isBodyAutoMaintained"
:class="['tab', { active: !showPreview }]"
@click="showPreview = false"
>Write</button>
<button :class="['tab', { active: showPreview || isBodyAutoMaintained }]" @click="showPreview = true">Preview</button>
<button :class="['tab', { active: showPreview }]" @click="showPreview = true">Preview</button>
</div>
<MarkdownToolbar v-show="!showPreview && !isBodyAutoMaintained && assist.state.value === 'idle'" :editor="tiptapEditor" />
<MarkdownToolbar v-show="!showPreview && assist.state.value === 'idle'" :editor="tiptapEditor" />
</div>
<!-- Streaming preview -->
@@ -525,11 +489,8 @@ useEditorGuards(dirty, save);
<DiffView :diff="assist.diff.value" class="main-diff" />
</template>
<!-- Normal: editor or preview. When body is machine-maintained,
always render the preview (read-only) never the editor. -->
<template v-else>
<div
v-if="!isBodyAutoMaintained"
v-show="!showPreview"
class="body-editor-wrap"
>
@@ -543,7 +504,7 @@ useEditorGuards(dirty, save);
/>
</div>
<div
v-show="showPreview || isBodyAutoMaintained"
v-show="showPreview"
class="preview-pane prose"
v-html="renderedPreview"
/>