diff --git a/AGENTS.md b/AGENTS.md index 3cdaf6e..a720fd8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ **Current working guide.** This file explains how to work safely on The Kitchen Codex today. It is not a release history; use [CHANGELOG.md](CHANGELOG.md), -release notes and the [documentation index](docs/README.md) for historical +GitHub Releases and the [documentation index](docs/README.md) for historical records. ## Product identity diff --git a/CHANGELOG.md b/CHANGELOG.md index aa3cbd5..83f94f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -159,6 +159,22 @@ changes on current `main`; it is not a new release claim. - Representative images are licensed matches, not guaranteed exact depictions. - Advanced Nutrition is not included in v0.9.0. +### πŸ§ͺ Testing & Verification + +- 2791/2791 Vitest tests across 171 files; 428/428 security tests across 29 + files. +- TypeScript typecheck, production build and plugin build clean; + `git diff --check` clean. + +### ⬆️ Upgrade Notes + +- No manual migration is required. Existing recipes, nutrition and + representative-image provenance remain valid and round-trip safe. +- AI image generation requires a configured image-provider key; Licensed Search + remains free and available without one. +- Nothing is written to the vault `Assets/` folder until an explicit recipe Save, + and no image is generated automatically. + ## [0.8.0] - 2026-09-12 ### πŸ” Session-Only BYOK (Text + Image) @@ -243,6 +259,14 @@ changes on current `main`; it is not a new release claim. automatically executable. Not every discovered free model is currently usable, and there is currently no free image-generation model. +### ⬆️ Upgrade Notes + +- No manual migration is required. Existing provider/model selections remain + valid while present in the current catalog; a disappeared or invalid selection + fails closed rather than switching provider/model silently. +- To use a session key, open AI Settings, choose **Use my API key**, save the key, + then optionally run **Test Connection**. + ## [0.7.0] - 2026-09-09 ### πŸ§‘β€πŸ³ Create for Me @@ -292,6 +316,15 @@ changes on current `main`; it is not a new release claim. - TypeScript typecheck clean; browser and plugin builds clean; `git diff --check` clean; 0 blocking / 0 important findings. +### ⚠️ Known Limitations + +- Browser `AI_ENDPOINT_TOKEN` compatibility remained a documented app-wide + limitation for public-host-deployed browser previews. +- Gemini image generation could be quota/rate limited by the provider account; + availability was provider-dependent and not guaranteed. + +## [0.6.0] - 2026-09-06 + ### 🧩 AI Provider Abstraction - Introduced a provider-neutral AI abstraction (`server/ai/*`): a minimal @@ -332,6 +365,7 @@ changes on current `main`; it is not a new release claim. - 926/926 Vitest tests across 41 files; 84/84 security tests across 8 files. - TypeScript typecheck clean; production build clean; `git diff --check` clean. +- No client secret exposure; no application-level direct-Gemini consumer remains. ## [0.5.1] - 2026-09-05 @@ -370,6 +404,12 @@ changes on current `main`; it is not a new release claim. - No client secret exposure (AI_ENDPOINT_TOKEN / GEMINI_API_KEY not present in the browser bundle). +### ⚠️ Known Deployment Note + +- `AI_ENDPOINT_TOKEN` browser compatibility remained unresolved and separate from + this hotfix. Web discovery still required at least one deployed model with + Google Search grounding support. + --- ## [0.5.0] - 2026-09-05 @@ -400,7 +440,19 @@ changes on current `main`; it is not a new release claim. - **851 / 851 Vitest tests passing** across **40 test files**. - TypeScript typecheck (`tsc --noEmit`) clean; production build clean; `bun install --frozen-lockfile` clean; `git diff --check` clean. -- Release hardening: 0 BLOCKING, 0 IMPORTANT findings (see `RELEASE_NOTES_v0.5.0.md` for known non-blocking follow-ups). +- Release hardening: 0 BLOCKING, 0 IMPORTANT findings. + +### ⚠️ Known Non-Blocking Follow-Ups (historical) + +- Dedicated ranking/discovery model aliases, simpler URL dedupe, stale grabber + prefill handling, component/DOM tests for the handoff seam, and display of the + discovery source title remained follow-ups. +- The legacy `/api/kitchen/answer` utilities remained exported/tested but were no + longer used by Ask My Kitchen and were later removed in v0.6.0. +- The deterministic parser did not recognize every β€œsearch the web for …” + phrasing; AI interpretation covered it. Meal-suggestion ordering remained only + as strong as available metadata. Pairing, compare and collection-gap + intelligence remained future work. --- @@ -459,6 +511,7 @@ changes on current `main`; it is not a new release claim. - Recipe Detail Quick Metrics calories now scale correctly when servings change. - Header calories and RecipeNutritionCard now share the same persisted-nutrition serving-scaling path. - Nutrition serving denominators continue to respect `nutrition.servings`, preventing double-scaling. +- Changing servings performs no nutrition re-estimation, Gemini/server request, or Markdown write; stored nutrition is not mutated. ### πŸ§ͺ Testing & Verification diff --git a/README.md b/README.md index 2563c84..ddaa9a9 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,7 @@ final product and release authority. ## License -[MIT](LICENSE). Historical release notes and phase records retain their original -identities. Provider and ChatGPT-plan usage remain subject to their own terms and +[MIT](LICENSE). Historical release records and phase documents retain their +original identities in `CHANGELOG.md`, GitHub Releases and the documentation +archive. Provider and ChatGPT-plan usage remain subject to their own terms and licensing gates. diff --git a/RELEASE_NOTES_v0.3.0.md b/RELEASE_NOTES_v0.3.0.md deleted file mode 100644 index 5cfff79..0000000 --- a/RELEASE_NOTES_v0.3.0.md +++ /dev/null @@ -1,106 +0,0 @@ -# Release Notes β€” The Kitchen Codex v0.3.0 - -**Release Date:** September 2, 2026 -**Tag / Version:** `v0.3.0` -**License:** MIT - ---- - -## 🌟 Overview - -The Kitchen Codex `v0.3.0` β€” **Trustworthy Data & Recipe Relationships** β€” turns -nutrition into a deterministic, auditable, local-first capability and adds a -derived ingredient relationship layer. It introduces a curated food reference, -deterministic whole-recipe nutrition estimation with provenance/confidence -metadata and a bounded cache, plus an ingredient relationship index that powers -"Similar Recipes" and "Recipes Using This Ingredient" β€” all computed locally -with no network or AI. - -This is a **foundation and data-quality** release. Semantic search, embeddings, -full knowledge-graph, USDA API integration, Ask My Kitchen, smart meal planning -and smart shopping aggregation remain future milestones. - ---- - -## πŸš€ Key Highlights & Changes - -### 1. 🧬 Nutrition Intelligence (Trustworthy Data Layer) - -- **Provenance & confidence**: every nutrition block now records a provenance - `source` and an application-assigned `confidence`, so deterministic, AI, and - offline-heuristic results are never conflated as nutrition truth. -- **Deterministic measurement normalization** (`src/utils/measurements.ts`): - exact mass / volume / count / unknown classification with only - mathematically valid conversions. No invented ingredient densities. -- **Curated local food reference** (`src/data/foodReference.ts`): an explicit, - deeply-frozen, representative-per-100g reference for a curated set of foods, - where densities and count weights each carry a confidence and note. Unknown - foods remain unknown rather than being guessed. -- **Deterministic food-aware nutrition estimation**: a pure engine computes - whole-recipe nutrition from the curated reference when coverage is fully - resolvable β€” it is selected only when *every* measurable ingredient resolves. - Otherwise the existing AI β†’ offline cascade runs untouched (zero-fabrication - preserved). -- **Deterministic nutrition cache**: a bounded, in-memory LRU cache memoizes an - eligible deterministic whole-recipe result keyed only on nutrition-relevant - inputs (never the requested serving count). A cache hit is a performance - optimization only β€” non-authoritative, preserves `source = database` and - confidence, never caches a partial/heuristic result, and is immutable. -- **Serving invariance**: the requested serving display count never changes the - cached deterministic total; per-serving arithmetic stays in the existing - `nutritionForServings` contract. - -### 2. πŸ”— Recipe Relationships - -- **Ingredient relationship index** (`src/utils/recipeRelationships.ts`): a pure, - deterministic derived-data layer exposing ingredient β†’ recipes, recipe β†’ - ingredient profile, shared ingredients, and a transparent Jaccard similarity - score. No AI, embeddings, or TF-IDF β€” an auditable foundation. -- **Recipes Using This Ingredient**: tap any ingredient on a recipe to see the - other recipes that use the exact same ingredient identity. -- **Similar Recipes**: a compact panel ranks recipes by shared-ingredient - similarity (score descending, deterministic tie-break), excluding the current - recipe and zero-overlap results. -- **Conservative, exact identity**: no substring/fuzzy matching, so `egg` never - matches `eggplant`, `butter` β‰  `peanut butter`, `cream` β‰  `cream cheese`, - `garlic` β‰  `garlic powder`, `chicken breast` β‰  `chicken thigh`, `all-purpose - flour` β‰  `almond flour`. -- **Wikilink target authority**: an ingredient link's identity derives from its - target (`[[Chicken Breast|chicken]]` β‰  `[[Chicken Thigh|chicken]]`), while - alias/display text is preserved for display only. -- **No auto-generated ingredient wikilinks**: relationship derivation never - creates, edits, or rewrites wikilinks, aliases, ingredient text, or Markdown. - All relationship queries are local (no network / no AI). - ---- - -## πŸ§ͺ Verification & Test Results - -- **Vitest Suite**: 415 / 415 tests passing across 27 test files (`100% green`). -- **TypeScript Typecheck**: `tsc --noEmit` passed with 0 errors. -- **Production Build**: `vite build` + `esbuild` clean into `dist/server.cjs`. -- Relationship layer and UI verified: index lifecycle, similar-recipe selection, - ingredient lookup (including the egg/eggplant false-positive and wikilink - target-authority cases), immutability, and local/no-AI behavior. - ---- - -## ⚠️ Known Limitations - -- The **offline culinary heuristic** fallback still emits estimated numbers with - `source = offline_heuristic` and `confidence = low`; it is clearly labelled and - is never cached as a deterministic result. Deterministic (`database`) output is - produced only when every measurable ingredient is fully resolvable. -- Descriptor/size and singular/plural ingredient variants are intentionally kept - distinct (e.g. `large eggs` vs `eggs`, `egg` vs `eggs`) to favour safety over - recall. No plural stemming or adjective collapsing. -- No semantic search, embeddings, full knowledge-graph, USDA database API - integration, browser E2E suite, Ask My Kitchen, smart meal planning, or smart - shopping aggregation yet β€” those remain future milestones. - ---- - -## πŸ“¦ Release - -`v0.3.0` is a data-layer + relationships release. `v0.2.7` (and all earlier -releases) remain unchanged. diff --git a/RELEASE_NOTES_v0.3.1.md b/RELEASE_NOTES_v0.3.1.md deleted file mode 100644 index 76890f6..0000000 --- a/RELEASE_NOTES_v0.3.1.md +++ /dev/null @@ -1,29 +0,0 @@ -# The Kitchen Codex v0.3.1 β€” Serving-Calorie Display Fix - -## Fix - -The Recipe Detail Quick Metrics bar now updates calories when the selected serving count changes. - -Previously, the Servings value updated but the Calories value could continue displaying the stored/base value. - -The header now uses the same deterministic serving-scaling path as the Nutrition Card. - -## Behavior - -- No nutrition re-estimation when servings change -- No Gemini request -- No server request -- No Markdown write -- No stored nutrition mutation -- Existing nutrition serving denominator semantics preserved - -## Verification - -- 424/424 tests across 27 files -- TypeScript clean -- Production build clean -- GitHub Actions green - -## Scope - -This is a focused patch release with no new product features. diff --git a/RELEASE_NOTES_v0.4.0.md b/RELEASE_NOTES_v0.4.0.md deleted file mode 100644 index 032c90e..0000000 --- a/RELEASE_NOTES_v0.4.0.md +++ /dev/null @@ -1,52 +0,0 @@ -# The Kitchen Codex v0.4.0 β€” Ask My Kitchen - -## Highlights - -- Ask My Kitchen β€” natural-language kitchen questions answered from the recipes already in your Obsidian vault -- Grounded Vault Search β€” deterministic, vault-only retrieval -- Natural-Language Query Interpretation β€” question β†’ structured `KitchenQuery` -- Trusted Similar-Recipe Context β€” "what is similar to this?" from a recipe detail -- Privacy-First Evidence Flow β€” only compact retrieved evidence leaves the client - -## What shipped - -Ask My Kitchen makes your own recipe vault directly answerable. - -### Deterministic local retrieval - -A question is interpreted into a structured `KitchenQuery`, then a deterministic engine (`searchKitchenRecipes`) decides exactly which recipes match. The model never chooses recipes, never widens filters, and never invents results. - -### Grounded conversational answers - -A compact evidence set (retrieved recipes + deterministic Step 1 reasons) feeds a grounded answer layer that explains the results without inventing recipes, metadata, times, or ratings. - -### Natural-language interpretation - -A thin interpretation boundary maps questions like "What can I make with chicken and rice?", "Which recipes use black beans?", and "what desserts take under 30 minutes?" into structured query constraints, with a conservative deterministic fallback when AI is unavailable. - -### Privacy-first evidence flow - -Only the compact retrieved evidence for matching recipes is sent to the server. The full vault, raw Markdown, notes, frontmatter, and unrelated recipes never leave the client. No full-vault data is transmitted. Interpretation sends only the question, and answering sends only the compact retrieved evidence for matching recipes. - -### Trusted similar-recipe context - -Opened from a Recipe Detail, Ask My Kitchen can answer "what is similar to this?" using the trusted current recipe identity β€” no model-invented identity is ever used. - -## Behavior - -- Vault-only: Ask My Kitchen never searches the web or discovers external recipes -- Read-only: no recipe edits, Markdown writes, or mutations of any kind -- No recipe fabrication: retrieved membership is authoritative -- Deterministic fallback and grounded no-match behavior when nothing matches -- AI does not own the final visible answer prose (deterministic, evidence-backed in v0.4.0) - -## Verification - -- 593/593 tests across 33 files -- TypeScript clean -- Production build clean -- GitHub Actions green on commit d0799b5 - -## Scope - -A focused, privacy-preserving feature release. No breaking vault-format changes; security, SSRF, rate-limiting, and header invariants preserved. Web recipe discovery (Find New Recipes) remains a separate, future capability and is intentionally not part of Ask My Kitchen. diff --git a/RELEASE_NOTES_v0.4.1.md b/RELEASE_NOTES_v0.4.1.md deleted file mode 100644 index fb0d4dd..0000000 --- a/RELEASE_NOTES_v0.4.1.md +++ /dev/null @@ -1,86 +0,0 @@ -# The Kitchen Codex v0.4.1 β€” Ask My Kitchen Reliability & Culinary Relevance - -## Highlights - -- Ask My Kitchen interpretation reliability β€” fewer conversational false positives, honest failure signalling -- Culinary Similar Recipes β€” dish-family-first relevance instead of raw ingredient-overlap ranking -- Safe failure semantics β€” ambiguous questions fail safely instead of silently broadening -- Distinct 422 vs 503 β€” question-understanding failures are separated from AI service failures -- One deterministic similarity authority shared by Similar Recipes and Ask My Kitchen - -This is a focused hardening release on top of v0.4.0's Ask My Kitchen. It is NOT -the v0.5.0 intelligence/discovery release: Ask My Kitchen remains vault-only, -read-only, and grounded β€” no web discovery, no online recipe search, and no new -import behavior in this version. - -## Ask My Kitchen Reliability - -The deterministic fallback interpreter is now far more conservative about what -counts as an ingredient request: - -- Possession leads ("I have chicken and rice") and use/contain leads ("recipes - using eggs", "what recipes contain garlic?") keep working exactly as before. -- Reference phrases ("recipes like this", "anything similar") never become - bogus ingredient filters. -- Generic non-food nouns ("I have time for dinner", "I have an idea for - dinner") and meta-object nouns ("contains instructions/notes/steps/photos") - are no longer mistaken for ingredients. -- Dangling conjunctions are stripped ("contains tomatoes and takes 30 minutes" - β†’ tomatoes + 30 minutes, never "tomatoes and"). -- Compound intent is preserved: "What chicken recipes can I make in under 30 - minutes?" keeps BOTH the chicken ingredient filter and the 30-minute bound; - "beef recipes under 1 hour" now correctly parses hours (60 minutes), and - "half an hour" parses as 30 minutes. -- Unsupported dish-family subjects ("salad recipes under 30 minutes", "soup - recipes under 30 minutes") fail safely instead of silently degrading to a - time-only query that would match every recipe in the vault. - -## Culinary Similarity Improvements - -The Similar Recipes panel and Ask My Kitchen's "similar to this" retrieval are -now powered by a single deterministic culinary-relevance authority: - -- Dish family first: salads recommend salads; tacos favor tacos, burritos, - enchiladas, quesadillas, and fajitas. -- Known-family mismatch gate: a known salad never recommends a known pasta - merely because both share chicken, parmesan, cuisine, or course. -- Related dish families (Tex-Mex, soup/stew/chili, bread/pizza, - burger/sandwich, cake/cookie/pie/dessert) still recommend one another. -- Ingredient overlap is now a bonus signal, capped well below any genuine - culinary relationship, and generic pantry ingredients (garlic powder, olive - oil, kosher salt, …) plus generic tags (easy, quick, dinner, …) can never - establish similarity on their own. -- Results are explained with human-readable culinary reasons ("Same type Β· - Taco") instead of raw overlap numbers. - -## Safety & Trust - -- Read-only: no recipe edits, Markdown writes, or mutations of any kind. -- Vault-only: no web search, no external recipe discovery in this release. -- No recipe fabrication: deterministic retrieval remains the sole authority on - recipe membership; the model never chooses recipes or widens filters. -- Trusted similar-recipe context: the model can never inject a - `similarToRecipeId` β€” it is seeded only from the trusted current-recipe - identity. -- Interpretation requests send only the question text; answering sends only - compact retrieved evidence. The full vault, raw Markdown, notes, and - frontmatter never leave the client. -- Fixed, user-appropriate error messages; no raw provider/server error bodies, - model IDs, or key/config details are ever surfaced. -- Security invariants unchanged: SSRF guard, AI key containment, endpoint - auth, rate limiting, security headers. - -## Verification - -- 675/675 Vitest tests across 34 files -- TypeScript typecheck (`tsc --noEmit`) clean -- Production build clean -- Deterministic fallback-only mode verified with no Gemini key configured - -## What's Next - -The next major objective is **v0.5.0 β€” Ask My Kitchen Intelligence + -Discovery**: a richer AI-driven intent model, recommendations that go beyond -filters, and clearly-labeled, explicit web discovery with a trusted Grab -Recipe handoff. That work is designed, not shipped β€” this release contains -none of it. diff --git a/RELEASE_NOTES_v0.5.0.md b/RELEASE_NOTES_v0.5.0.md deleted file mode 100644 index 53b8a54..0000000 --- a/RELEASE_NOTES_v0.5.0.md +++ /dev/null @@ -1,92 +0,0 @@ -# The Kitchen Codex v0.5.0 β€” Ask My Kitchen Intelligence & Web Discovery - -## Highlights - -- Ask My Kitchen now understands richer natural-language cooking intent -- Grounded, preference-aware recommendations over the recipes already in your vault -- Explicit web discovery with provider-grounded URLs only (never invented) -- Strict **FROM MY VAULT** / **FROM THE WEB** separation -- Vault-first optional web escalation β€” offer-only, user click required -- Selected web result β†’ existing Web Recipe Grabber β†’ preview β†’ explicit save - -This is the intelligence + discovery release. It is NOT autonomous browsing, NOT -automatic import, and NOT AI-owned vault membership. Deterministic local code -remains the single authority on which recipes exist and match; the AI interprets, -ranks trusted evidence, and reasons β€” never fabricates. - -## Smarter Ask My Kitchen - -Ask My Kitchen now builds on a structured semantic intent model instead of a bare -filter query: - -- Intent types: find recipes, meal suggestion, similar recipe, ingredient use, - browse category, or explicit web discovery. -- Hard filters (ingredients, courses, cuisines, difficulty, time, rating, - favorites) stay authoritative and deterministic. -- Soft preferences (effort, mood, style, meal context, dietary, novelty, - avoid repetition) influence ranking and explanation only β€” they never silently - become hard filters. - -## Grounded Vault Recommendations - -- A deterministic builder produces a bounded, compact evidence set for eligible - vault recipes (capped before any AI call). -- A transparent scorer ranks with grounded reasons ("Easy difficulty", - "Under 30 minutes", "Dinner recipe", "Different recipe family from the current - dish"). Unsupported semantics get no fabricated weight. -- Optional AI ranking only *re-orders* that same trusted candidate evidence; if - the AI is unavailable or returns malformed output, Ask My Kitchen falls back to - the deterministic ranking and still answers. Ranking is advisory, never authority. - -## Web Discovery - -- Discovery runs only when you explicitly ask for the web, or when a - vault-first request has weak local results and you tap "Search the web". -- Result URLs come only from real search grounding metadata β€” the model is never - allowed to invent a URL. -- Discovered URLs are not fetched by Ask My Kitchen; they are display/handoff - values only. - -## Grab Recipe Handoff - -- Select a web result and send it to the existing Web Recipe Grabber. -- The handoff carries only the source URL (and a display-only title) β€” no recipe - content, no local IDs, no vault metadata. -- The hardened importer re-validates the URL (SSRF, private/metadata-IP, redirect, - and content-type protections), extracts, shows a preview, and only then do you - explicitly confirm a save. - -## Trust, Privacy & Security - -- The AI never decides which recipes exist in the vault; deterministic code owns - local membership. -- The AI never invents recipe IDs, never adds candidates, and never claims vault - membership. -- Ranking and discovery never receive the full vault, raw Markdown, notes, or - frontmatter β€” only compact evidence (ranking) or a discovery-safe query (web). -- No auto-import, no silent web escalation, no direct save from Ask My Kitchen. -- Imports always require preview + explicit user confirmation. - -## Reliability / Testing - -- 851/851 Vitest tests across 40 files -- TypeScript typecheck (`tsc --noEmit`) clean -- Production build clean; `bun install --frozen-lockfile` clean -- Release hardening: 0 BLOCKING, 0 IMPORTANT findings - -## Known Non-Blocking Follow-Ups - -- Dedicated ranking/discovery model aliases would improve naming (they currently - reuse the shared nutrition model config). -- Web URL dedupe normalization is basic. -- A stale grabber prefill URL can seed a later standalone Web Recipe Grabber open. -- Component/DOM tests for the handoff seam are not yet present. -- The discovery `sourceTitle` is carried in the handoff but not yet displayed. -- Legacy `/api/kitchen/answer` utilities remain exported/tested but are no longer - used by the Ask My Kitchen surface (cleanup candidate). -- The conservative deterministic parser does not recognize every - "search the web for …" phrasing; the AI interpreter covers it. -- Meal-suggestion ordering is only as strong as the metadata available. - -Pairing and compare remain unsupported runtime intents, and collection-gap -intelligence remains future work. diff --git a/RELEASE_NOTES_v0.5.1.md b/RELEASE_NOTES_v0.5.1.md deleted file mode 100644 index f52ac79..0000000 --- a/RELEASE_NOTES_v0.5.1.md +++ /dev/null @@ -1,39 +0,0 @@ -# The Kitchen Codex v0.5.1 β€” Kitchen AI Reliability Hotfix - -## Fixed - -Ask My Kitchen no longer hard-fails when the primary Gemini model is unavailable: - -- **Interpreter** falls back to another model, then to deterministic parsing, so a - provider failure no longer surfaces as "AI interpreter unavailable" for questions - the deterministic parser can safely handle. -- **Ranking** falls back safely to deterministic candidate ranking when every AI - ranking attempt fails β€” the local request is never failed. -- **Web discovery** tries a fallback grounded model before reporting unavailable, - and only ever accepts provider-grounded URLs (no ungrounded/parsed-from-prose - URLs). -- Provider failures now produce concise, redacted **server-side diagnostics** so - operators can tell why a model attempt failed. - -## Trust & Security - -- No ungrounded web URLs accepted (grounding-only guarantee preserved). -- No AI-defined vault membership; deterministic code stays authoritative. -- No auth weakening; no secrets exposed to the client (verified in the built bundle). -- Existing Grab Recipe importer and SSRF/private-IP/redirect/content-type - protections are unchanged. - -## Known Deployment Note - -- **AI_ENDPOINT_TOKEN browser compatibility remains unresolved** and is a separate - deployment/config item. Web discovery also still requires at least one deployed - model with Google Search grounding support. - -## Verification - -- 877/877 tests across 41 files -- TypeScript typecheck (`tsc --noEmit`) clean -- Production build clean; `bun install --frozen-lockfile` clean; `git diff --check` - clean -- No client secret exposure (AI_ENDPOINT_TOKEN / GEMINI_API_KEY not present in the - browser bundle) diff --git a/RELEASE_NOTES_v0.6.0.md b/RELEASE_NOTES_v0.6.0.md deleted file mode 100644 index b84f607..0000000 --- a/RELEASE_NOTES_v0.6.0.md +++ /dev/null @@ -1,93 +0,0 @@ -# The Kitchen Codex v0.6.0 β€” AI Provider Abstraction - -## AI Provider Abstraction - -v0.6.0 introduces a provider-neutral AI layer across every live AI consumer. The -server now talks to AI through a small, capability-oriented abstraction -(`server/ai/*`) instead of calling the Gemini SDK directly from feature code. - -- **Provider abstraction**: a minimal `AiProvider` contract (id, name, - capabilities, availability, `generate`, `generateStructured`, and optional - `searchWeb`) backed by a tiny registry (`getDefaultAiProvider()`). -- **All live AI consumers migrated**: kitchen intent interpretation, candidate - ranking, web discovery, metadata recovery, nutrition estimation, and Grab - Recipe all route through the provider abstraction with explicit models. -- **Gemini SDK isolated to infrastructure**: `server/geminiClient.ts` (shared key - client) and `server/ai/geminiProvider.ts` (the Gemini adapter) are the only - places that touch the Gemini SDK. No application-level direct-Gemini consumer - remains. -- **Capability-oriented foundation**: the abstraction declares capabilities - (structured output, web search, reasoning, recipe generation) so a future - non-Gemini provider can be added without reworking feature code. -- **Schema fidelity**: the adapter maps a provider-neutral JSON-schema-lite to the - Gemini schema, including `description` hints and an `integer` type, preserving - structured-output fidelity (e.g. Grab Recipe `servings`/`stepNumber` integers). - -## Ask My Kitchen - -The existing "MY VAULT" trust model is preserved exactly. - -- **Interpretation** is provider-backed (`kitchenInterpret`) but always wrapped by - the deterministic KitchenIntent sanitizer; AI only understands intent. -- **Ranking** re-ranks only the trusted, deterministic candidate evidence - (`kitchenRank`); AI failure degrades to deterministic ranking. -- **Web discovery** remains explicit and provider-grounded (`kitchenDiscover`); - discovered URLs come only from real search grounding and stay separate from the - vault, flowing into the existing Grab Recipe import path. -- **Deterministic code stays authoritative** for vault membership, recipe - existence, trusted IDs, navigation, and writes. - -## Grab Recipe - -- Migrated through the provider abstraction while preserving the extraction - authority order: JSON-LD β†’ AI β†’ fallback JSON-LD β†’ heuristic. -- **INTEGER schema fidelity** preserved (`servings`, `stepNumber`) via the new - `integer` node in the provider schema. -- **SSRF / DNS / redirect protections unchanged**; one importer, no new fetch - path, and the preview β†’ explicit-save boundary is intact. - -## Vault Intelligence / Metadata Recovery - -- Provider-based enhancement while preserving the deterministic recovery rules, - the zero-fabrication/merge allowlist, and the algorithmic fallback chain - (primary β†’ fallback β†’ algorithmic). - -## Nutrition - -- Provider-based AI fallback with deterministic-first behavior preserved. -- **Non-finite numeric hardening**: AI-estimated values are now coerced through a - finite-safe helper so `Infinity`/`"Infinity"`/`NaN` become `0` rather than - propagating, while all finite values round and clamp exactly as before. -- **Provenance remains application-assigned** (`database` / `ai_estimate` / - `offline_heuristic` and confidence are set by application logic, never the model). - -## Security & Trust - -- **No direct Gemini application consumers** β€” SDK coupling is infrastructure-only. -- **Provider diagnostics are redacted**: every AI consumer now logs failed model - attempts through the shared `logModelAttempt`/`extractProviderError` helper - (bounded, secret-redacted) rather than raw `err.message`. -- **No raw provider errors reach clients** β€” endpoint handlers return fixed, - non-technical messages; server logging was cleaned without changing API output. -- **No SSRF / security weakening**; source-policy, trusted-recipe-ID, candidate - allowlist, vault-membership, and web/local separation invariants are unchanged. -- **Preview / save boundaries preserved**; no auto-writes, no auto-import. - -## Legacy Cleanup - -- **Removed the dead legacy answer path**: `server/kitchenAnswer.ts` (the old - server adapter), the orphaned `POST /api/kitchen/answer` route, its rate - limiter, and its dedicated security tests were deleted. -- Removed the dead `buildAnswerRequest` / `isAnswerResponse` UI helpers and their - isolated tests. -- Retained the shared deterministic `src/utils/kitchenAnswer.ts` types/utilities; - `buildGroundedKitchenAnswer` remains the live client-side answer builder. - -## Testing & Verification - -- 926/926 Vitest tests across 41 files -- 84/84 security tests across 8 files -- TypeScript typecheck (`tsc --noEmit`) clean -- Production build clean; `bun install --frozen-lockfile` clean; `git diff --check` - clean -- No client secret exposure; no application-level direct-Gemini consumer remains diff --git a/RELEASE_NOTES_v0.7.0.md b/RELEASE_NOTES_v0.7.0.md deleted file mode 100644 index 8993e4b..0000000 --- a/RELEASE_NOTES_v0.7.0.md +++ /dev/null @@ -1,66 +0,0 @@ -# The Kitchen Codex v0.7.0 β€” Create for Me & Vault Intelligence Image Recovery - -## Highlights - -- **Create for Me**: a guided recipe-creation assistant that keeps Obsidian - Markdown canonical β€” save-lock keys are normalized, recipe content changes - and vault-session changes are detected as conflicts, and the guarded Save can - never silently commit behind a stale session or closed window. -- **Vault Intelligence Image Recovery**: recipes with missing or broken images - are detected locally (syntax-only, read-only β€” no remote probing), and you - can explicitly generate an image, preview it before it touches the vault, - then Save, Regenerate, or Cancel. -- **Canonical vault-integrity hardening**: collision-safe local `Assets/` - writes, generated-image provenance metadata, and no silent replacement of - valid images. -- **Provider/error resilience groundwork**: a real `ImageProvider` abstraction - (Gemini first) with an exact, user-facing failure taxonomy. - -## Image Recovery - -- Missing/broken-image detection surfaced through Vault Intelligence. -- **Explicit Generate Image** β€” generation only ever starts from a user action. -- **AI preview before save** β€” you see the generated image before anything is - written to the vault. -- **Save / Regenerate / Cancel** controls in the recovery UI. -- Collision-safe vault writes: `Assets/Title.png`, then `Assets/Title (n).png`. -- Generated-image provenance recorded in the frontmatter. -- Recipe-change / vault-change conflict protection before committing. -- **No silent replacement of valid images**; broken images are only replaced by - an explicit Save. -- **No automatic image generation** on save, scan, render, or resolve paths. - -## Provider Behavior - -- Gemini image generation with a bounded, distinct outcome per case: quota, - rate-limit, timeout, unavailable, blocked prompt/safety, no-image, or auth β€” - each with its own HTTP code and message (no generic collapse). -- **Image generation availability depends on the provider/model quota.** - Generation is best-effort; a quota/rate-limit response reflects the provider - account, not an application bug. - -## Security & Integrity - -- Pre-decode base64 memory guard: oversized/oversized-encoded payloads are - rejected before any allocation. -- Transient preview tokens for generated-image previews. -- Server-side keys only β€” no prompt, key, or base64 content leaks to logs or - clients. -- SSRF guard and security/trust behavior preserved; canonical Markdown remains - the source of truth. -- New security wiring tests cover the image generate/preview routes and their - rate limiters. - -## Testing - -- **1583 automated tests** across 103 files at v0.7.0 completion. -- **98 security tests** across 8 files. -- Browser build, plugin build, typecheck, and `git diff --check` all clean. -- 0 blocking / 0 important findings at release. - -## Known Limitations - -- Browser `AI_ENDPOINT_TOKEN` compatibility remains a documented app-wide - limitation (public-host-deployed browser previews rely on the same gap). -- Gemini image generation can be quota/rate limited by the provider - account/project; availability is provider-dependent and not guaranteed. \ No newline at end of file diff --git a/RELEASE_NOTES_v0.8.0.md b/RELEASE_NOTES_v0.8.0.md deleted file mode 100644 index e6f205b..0000000 --- a/RELEASE_NOTES_v0.8.0.md +++ /dev/null @@ -1,139 +0,0 @@ -# The Kitchen Codex v0.8.0 β€” BYOK & Dynamic OpenRouter Catalog - -## Highlights - -- **Session-only BYOK for Text AI and Image AI**: enter a provider API key that - lives only in server process memory, expires automatically, is revocable, and - is never written to the browser, vault, or settings. -- **Exact credential isolation**: `openrouter` β‰  `openrouter-image` and - `gemini` β‰  `gemini-image`. A key is never aliased, migrated, or silently - substituted across providers. -- **Simplified two-card AI Settings**: Text AI and Image AI each get a compact - card (provider, model, credential source, session key, stable footer), with - Advanced / Server Diagnostics collapsed by default. -- **Dynamic OpenRouter model discovery** with **Free / Budget / Paid / - Variable** pricing awareness and a searchable, free-first model picker. -- **Cost-aware FREE β†’ PAID protection** and **stale-pricing fail-closed** - safeguards that prevent silent spend. -- **Ask My Kitchen generic ingredient matching** improvements. -- **OpenRouter image generation** live-smoke verified (image preview remains - explicit-save only). - -## Session-Only BYOK - -- **Text AI** and **Image AI** both support a session-only API key. -- The key is stored **only in server process memory**: it is lost on restart, - expires automatically (absolute + idle TTL), and can be revoked at any time. -- The key is **never** persisted to `localStorage`, IndexedDB, the settings - store, plugin `data.json`, the Obsidian vault, or Markdown; it is **never** - re-displayed (no masked key, prefix, or hash). -- Saving a key performs **no provider call**. Connection validation is a - separate, explicit **Test Connection** action. -- Session keys are scoped to **exact execution-provider IDs**. The same literal - key may be entered for `openrouter` and `openrouter-image`, but the backend - keeps those session identities separate. - -## Simplified AI Settings UX - -- Two compact cards replace the previous technical wall: - - **Text AI** β€” provider, model, credential source, session key. - - **Image AI** β€” provider, model, credential source, session key. -- Friendly, non-secret display names for providers and models; truthful - credential-source labels ("Using server API key" / "Using your temporary API - key"). -- **Advanced / Server Diagnostics** remains available and is collapsed by - default. -- The card footer (notice + "Reset to server default") is stable and always - visible. - -## Dynamic OpenRouter Catalog - -- **Server-owned discovery**: the OpenRouter catalog is fetched server-side - from the fixed public endpoint (no API key required, no browser fetch), with - a bounded timeout, bounded response size, no redirects, and schema - validation. -- **Cached**: a short-lived in-memory cache (no vault/disk persistence); the - app stays usable if discovery temporarily fails (last-known data, or a safe - curated fallback). -- **Cost classification**: **Free / Budget / Paid / Variable**, derived from - normalized per-token pricing. Free is proven by zero cost across every - applicable pricing component β€” never inferred from a model name. -- **Searchable picker**: filter by display name or model id, with Free / Budget - / All-compatible grouping, free-first ordering, and compact capability - badges. -- **Broader model visibility**: discovered models are listed with truthful - pricing; only server-verified models are executable. - -## Cost-Aware Spend Protection - -- **FREE β†’ PAID protection**: if a model you acknowledged as FREE is reported - by the current trusted catalog as non-free, execution is blocked with a - bounded `MODEL_PRICING_CHANGED` error. Kitchen Codex prevents the possible - charge and asks you to review and re-select. There is **no** automatic model - or provider switch, and **no** silent charge. -- **Stale-pricing fail-closed**: if FREE pricing can no longer be verified - (stale cache or a failed refresh), execution is blocked with - `MODEL_PRICING_UNVERIFIED` until the catalog refreshes and you re-select. -- **Conservative pricing**: any non-zero, negative, malformed, `NaN`/`Infinity`, - object/override, or unknown price-bearing field prevents a FREE - classification. -- **Zero spend on block**: pricing-blocked text requests make **zero** provider - calls and surface the reason on every text AI route. - -## Safe Server-Owned Validation - -- Only **server-verified strict-structured** text models and - **transport-allowlisted** image models are executable. -- **Arbitrary client-supplied model IDs fail closed** β€” the browser never - supplies authoritative pricing or capability metadata. -- External catalog metadata is **bounded** (model count, id/name length, - parameter and modality list caps); duplicate/conflicting model ids are - rejected deterministically. -- Provider precedence (server-managed pin > valid user selection > - server-default) is unchanged, and credentials never fall back across - providers. - -## Ask My Kitchen - -- **Generic ingredient matching**: a generic query such as "chicken" now matches - its normalized variants ("chicken breast", "rotisserie chicken") while - remaining whole-token safe ("chickpea" does not match). -- Exact canonical ingredient identity is unchanged for every other consumer; - the relaxation is query-side and Ask My Kitchen only. - -## Image Generation - -- **OpenRouter image generation** is live-smoke verified through the explicit, - session-key-aware image path. -- **Image preview remains explicit-save only**: no automatic image generation - on any save, scan, render, or resolve surface. -- Image Test Connection is credential validation only (it never generates an - image). - -## Known Limitations - -- **Dynamic OpenRouter models that are discovered but not yet verified for the - Kitchen Codex strict structured-output runtime are shown informationally but - are not executable.** Not every discovered free model is currently usable. -- **Dynamic image-output models are discovery-only** unless explicitly verified - for the current image transport. -- **No free image-generation model is advertised.** Free image-provider support - is planned separately. -- The live catalog is point-in-time; availability, pricing, and the free/paid - classification can change upstream at any time. - -## Verification - -- 2220 / 2220 Vitest tests across 135 files. -- 269 / 269 security tests across 18 files. -- Typecheck, production build, and plugin build clean. -- `git diff --check` clean. - -## Upgrade Notes - -- No manual migration is required. Existing saved provider/model selections - remain valid when still present in the current catalog; a selection that has - disappeared or become invalid fails closed (never a silent switch to another - provider/model). -- To use a session key, open AI Settings, choose **Use my API key**, save the - key, then optionally run **Test Connection**. diff --git a/RELEASE_NOTES_v0.9.0.md b/RELEASE_NOTES_v0.9.0.md deleted file mode 100644 index 79624cd..0000000 --- a/RELEASE_NOTES_v0.9.0.md +++ /dev/null @@ -1,131 +0,0 @@ -# The Kitchen Codex v0.9.0 β€” Explicit AI Recipe Images & Verified-Free Generation - -## Highlights - -- **Verified-free recipe generation**: separate structured-text and - recipe-generation capability verification, so a model must be verified for the - recipe task itself β€” not merely for text. Current verified-free OpenRouter - recipe models can generate editable drafts. -- **Single-attempt, terminal generation**: verified dynamic generation makes one - attempt and stops β€” no silent paid/provider fallback, no model fallback, and - no retries. -- **Fail-closed credentials and capability**: credentials and capability - authorization fail closed on replacement, revocation, expiry, source - mismatch, or catalog changes; generated recipes remain unsaved drafts until an - explicit Save. -- **Nutrition safety repair**: removed fabricated algorithmic nutrition - authority and disabled automatic application/saving of untrusted machine - nutrition, while keeping existing manual and legacy nutrition readable, - editable, scalable, and round-trip safe. -- **Licensed representative recipe images**: explicit Openverse / Wikimedia - Commons search under a closed reusable-license allowlist, with preserved - attribution and app-local protected thumbnails. -- **Explicit AI recipe image generation**: deliberate, never automatic, with - truthful pricing disclosure, one-confirmation-per-generation, and a transient - preview until `Use This Image` and recipe Save. -- **Live acceptance**: a biscuit image was generated with OpenRouter Image using - `google/gemini-2.5-flash-image` at a disclosed cost of approximately $0.03, - accepted explicitly, saved into the vault `Assets/` folder, and reloaded after - reopening β€” with no automatic generation. - -## Verified-Free Recipe Generation - -- **Separate verification**: structured-text capability and recipe-generation - capability are verified independently. A model that passes text verification - is not automatically trusted to author recipes. -- **Editable drafts**: current verified-free OpenRouter recipe models can - generate recipe drafts that remain fully editable before any save. -- **Single attempt, terminal**: verified dynamic generation is one attempt and - terminal. There is no silent paid fallback, no provider fallback, and no - model fallback. -- **Fail-closed authorization**: credentials and capability authorization fail - closed on replacement, revocation, expiry, source mismatch, or catalog - changes. -- **Explicit save only**: generated recipes are unsaved drafts until the user - explicitly saves them. - -## Nutrition Safety Repair - -- **No fabricated authority**: the previous fabricated algorithmic nutrition - authority has been removed. -- **No automatic untrusted writes**: automatic application and saving of - untrusted machine nutrition is disabled. -- **Legacy safety preserved**: existing manual and legacy nutrition remains - readable, editable, scalable, and round-trip safe. -- **Deferred**: Advanced Nutrition and a trusted future nutrition engine remain - deferred and are not part of v0.9.0. - -## Licensed Representative Recipe Images - -- **Explicit search**: Openverse / Wikimedia Commons search runs only on an - explicit action. -- **Closed license allowlist**: only CC0, Public Domain, CC BY, and CC BY-SA - results are eligible. -- **Attribution and provenance preserved** for every selected image. -- **App-local protected thumbnails**: no browser hotlinking; thumbnails load - only through the authenticated app-local binary transport. -- **Representative, not exact**: a representative image may resemble the recipe - but is not guaranteed to depict the exact dish. -- **Deferred Asset creation**: nothing is written to `Assets/` until an - explicit recipe Save. - -## Explicit AI Recipe Image Generation - -- **Free default**: Licensed Search remains the free default. -- **Never automatic**: AI generation is deliberate and never runs as a side - effect of save, scan, render, or resolve. -- **Truthful disclosure**: the exact provider/model and truthful pricing - classification are shown before generation. -- **Confirmation each time**: paid or variable generation requires confirmation - for every generation. -- **One call**: one confirmation permits exactly one provider call, with no - retries and no provider/model fallback. -- **Transient preview**: the preview remains transient until `Use This Image` - and recipe Save. -- **Safe persistence**: collision-safe Asset creation, transaction-owned - rollback, provenance separation, capacity reservations, and requester-bound - previews. -- **Authenticated transport**: browser and Obsidian binary preview transport use - authenticated app-local requests. - -## Live Acceptance - -- OpenRouter Image generated a correct biscuit image using - `google/gemini-2.5-flash-image`. -- The disclosed cost was approximately $0.03. -- The image required explicit acceptance (`Use This Image`) and an explicit - recipe Save. -- It persisted into the vault `Assets/` folder and loaded after reopening the - recipe. -- No automatic generation occurred. - -## Known Limitations - -- **Pricing**: AI image pricing may be paid or variable and depends on the - selected provider account. AI image generation is **not** claimed to be free. -- **Key required for AI generation**: a configured image-provider API key is - required for AI generation; licensed search does not require one. -- **Protected deployments**: `AI_ENDPOINT_TOKEN`-protected browser/plugin - deployments do not yet have a repository-owned secure Unlock/bootstrap token - source and therefore remain unsupported/fail-closed. -- **Collision scope**: Browser File System Access collision protection covers - concurrent transactions within the active application realm; it does not claim - universal cross-tab/process atomicity. -- **Representative images**: licensed matches, not guaranteed exact depictions. -- **Advanced Nutrition** is not included in v0.9.0. - -## Verification - -- 2791 / 2791 Vitest tests across 171 files. -- 428 / 428 security tests across 29 files. -- Typecheck, production build, and plugin build clean. -- `git diff --check` clean. - -## Upgrade Notes - -- No manual migration is required. Existing recipes, nutrition, and - representative-image provenance remain valid and round-trip safe. -- AI image generation requires a configured image provider key; Licensed Search - stays free and available without one. -- Nothing is written to the vault `Assets/` folder until an explicit recipe - Save, and no image is ever generated automatically. diff --git a/docs/README.md b/docs/README.md index 1512ae4..6104335 100644 --- a/docs/README.md +++ b/docs/README.md @@ -59,7 +59,8 @@ checklists: - [SINC-2 USDA branded foods](SINC-2-USDA-Branded-Foods.md) - [SINC-3 SHISO nutrition completion](SINC-3-SHISO-Nutrition-Completion.md) - [SINC-4 supplemental nutrients](SINC-4-Supplemental-Nutrients.md) -- Root `RELEASE_NOTES_v*.md` files β€” historical release records. +- Root historical release notes were consolidated into `CHANGELOG.md`; GitHub + Releases and Git tags preserve version-specific public history. - [Archived pre-GH-1 agent guide](archive/AGENTS-2026-11-30.md) β€” obsolete instructions, preserved for archaeology only. diff --git a/docs/archive/README.md b/docs/archive/README.md index 0942f79..80a4f72 100644 --- a/docs/archive/README.md +++ b/docs/archive/README.md @@ -6,7 +6,10 @@ links to it explicitly. - `AGENTS-2026-11-30.md` β€” retired AI-agent guide from before SEC-1 and GH-1. It contains stale test counts, pre-SEC-1 security guidance, and historical - milestone descriptions. It is preserved for archaeology only. + milestone descriptions. It is preserved for archaeology only. Its references + to root `RELEASE_NOTES_v*.md` files are historical; those files were + consolidated into `CHANGELOG.md` in GH-2, with public version history retained + in GitHub Releases and tags. For current guidance use: