Add Projects, Milestones, RAG auto-inject, push notifications, PWA, tag normalisation

## Projects & Milestones (Phases A + G)
- New models: Project, Milestone (Project → Milestone → Task hierarchy)
- notes table: project_id + milestone_id FKs; parent_id FK constraint activated
- Migrations: 0017 (projects), 0018 (push_subscriptions), 0019 (events), 0020 (milestones)
- Services: projects.py, milestones.py (CRUD + progress tracking)
- Routes: /api/projects + /api/projects/<id>/milestones
- LLM tools: create/list/get/update project; create/list milestone; project + milestone + parent_task params on note/task tools
- Frontend: ProjectListView (stacked milestone bars), ProjectView (milestone-grouped kanban), ProjectSelector, MilestoneSelector, NoteEditorView + TaskEditorView updated

## RAG Auto-injection (Phase B)
- Notes ≥0.60 cosine similarity auto-injected into system prompt (max 3, 800 chars each)
- excluded_note_ids param; ChatView "Auto-included" sidebar section

## Summarisation improvements (Phase C)
- Threshold 20→30, keep-recent 6→8, max_tokens 200→400
- Two-pass summarisation for histories >50 messages

## Browser push notifications (Phase E)
- PushSubscription model + migration; pywebpush dependency
- /api/push routes; VAPID config; fire-and-forget on generation complete
- Frontend: sw.js, push store, Settings toggle

## PWA manifest (Phase F)
- manifest.json, Apple meta tags, service worker registration in main.ts

## Tag normalisation
- All tags lowercased + deduplicated at backend (create_note/update_note) and frontend (TagInput sanitize)
- Note/Task types gain project_id + milestone_id fields; store signatures updated

## CalDAV
- Radicale embedded server reverted; back to user-configured external CalDAV

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 20:52:21 -05:00
parent 3d7be5888e
commit 012eb1d46b
52 changed files with 4319 additions and 62 deletions
+1
View File
@@ -73,6 +73,7 @@ router.afterEach(() => {
<div class="nav-links" :class="{ open: mobileMenuOpen }">
<router-link to="/notes" class="nav-link">Notes</router-link>
<router-link to="/projects" class="nav-link">Projects</router-link>
<router-link to="/tasks" class="nav-link">Tasks</router-link>
<router-link to="/chat" class="nav-link">Chat</router-link>
<router-link to="/settings" class="nav-link">Settings</router-link>
@@ -0,0 +1,86 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { apiGet } from "@/api/client";
interface Milestone {
id: number;
title: string;
status: string;
}
const props = defineProps<{
projectId: number | null;
modelValue: number | null;
}>();
const emit = defineEmits<{
(e: "update:modelValue", val: number | null): void;
}>();
const milestones = ref<Milestone[]>([]);
const loading = ref(false);
watch(
() => props.projectId,
async (pid) => {
milestones.value = [];
if (!pid) {
emit("update:modelValue", null);
return;
}
loading.value = true;
try {
const data = await apiGet<{ milestones: Milestone[] }>(
`/api/projects/${pid}/milestones`
);
milestones.value = data.milestones.filter((m) => m.status === "active");
} catch {
milestones.value = [];
} finally {
loading.value = false;
}
},
{ immediate: true }
);
function onChange(e: Event) {
const val = (e.target as HTMLSelectElement).value;
emit("update:modelValue", val ? Number(val) : null);
}
</script>
<template>
<select
class="milestone-select"
:value="modelValue ?? ''"
:disabled="!projectId || loading"
@change="onChange"
>
<option value="">{{ projectId ? "No milestone" : "(Select project first)" }}</option>
<option v-for="m in milestones" :key="m.id" :value="m.id">
{{ m.title }}
</option>
</select>
</template>
<style scoped>
.milestone-select {
padding: 0.4rem 0.6rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
background: var(--color-bg);
color: var(--color-text);
font-size: 0.875rem;
font-family: inherit;
box-sizing: border-box;
width: 100%;
}
.milestone-select:focus {
outline: none;
border-color: var(--color-primary);
}
.milestone-select:disabled {
opacity: 0.5;
cursor: default;
}
</style>
@@ -0,0 +1,67 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { apiGet } from "@/api/client";
interface Project {
id: number;
title: string;
status: string;
}
defineProps<{
modelValue: number | null;
}>();
const emit = defineEmits<{
(e: "update:modelValue", value: number | null): void;
}>();
const projects = ref<Project[]>([]);
let cacheExpiry = 0;
async function loadProjects() {
const now = Date.now();
if (projects.value.length > 0 && now < cacheExpiry) return;
try {
const data = await apiGet<{ projects: Project[] }>("/api/projects?status=active");
projects.value = data.projects;
cacheExpiry = now + 60_000; // 60 second cache
} catch {
// Silently fail — selector will just be empty
}
}
onMounted(loadProjects);
function onChange(e: Event) {
const value = (e.target as HTMLSelectElement).value;
emit("update:modelValue", value ? Number(value) : null);
}
</script>
<template>
<select class="project-selector" :value="modelValue ?? ''" @change="onChange">
<option value="">No project</option>
<option v-for="project in projects" :key="project.id" :value="project.id">
{{ project.title }}
</option>
</select>
</template>
<style scoped>
.project-selector {
padding: 0.4rem 0.5rem;
border: 1px solid var(--color-input-border);
border-radius: var(--radius-sm);
background: var(--color-bg-card);
color: var(--color-text);
font-size: 0.9rem;
font-family: inherit;
width: 100%;
box-sizing: border-box;
}
.project-selector:focus {
outline: none;
border-color: var(--color-primary);
}
</style>
+1 -1
View File
@@ -18,7 +18,7 @@ const inputRef = ref<HTMLInputElement | null>(null);
let fetchDebounce: ReturnType<typeof setTimeout> | null = null;
function sanitize(raw: string): string {
return raw.trim().replace(/\s+/g, "-").replace(/^#+/, "");
return raw.trim().toLowerCase().replace(/\s+/g, "-").replace(/^#+/, "");
}
function addTag(raw: string) {