Skip to content

feat(shiso): Vault Image Intelligence & Generation - #80

Merged
kryptek2000 merged 2 commits into
mainfrom
feat/shiso-r2-vault-image-intelligence
Nov 29, 2026
Merged

kryptek2000 merged 2 commits into
mainfrom
feat/shiso-r2-vault-image-intelligence

Conversation

@kryptek2000

Copy link
Copy Markdown
Owner

Summary

SHISO R2 connects the assistant to The Kitchen Codex's existing Vault image authority instead of guessing image presence or claiming image generation is unsupported.

  • R2-A: bounded, read-only Vault image inventory with missing, broken, valid, and unknown status.
  • R2-B: image generation through the existing RecipeImageRecoveryController, provider selection, quote/confirmation, and canonical save path.
  • R2-C: authenticated preview inside SHISO with explicit Confirm / Save / Regenerate / Cancel controls.

No second image engine, provider route, Vault writer, or image tool was introduced.


R2-A — Vault Image Inventory

New closed tool inventory_vault_images:

{"tool":"inventory_vault_images","status":"missing","limit":20,"offset":0}
  • Reads the live application-owned Vault snapshot and existing assessRecipeImageHealth.
  • missing, broken (broken local/invalid remote), valid (valid local), and unknown (remote-present or unverifiable).
  • Unavailable image health is unknown, never missing.
  • Accurate counts, bounded results (50/call), pagination, scan truncation, cancellation, and Vault-session change handling.
  • Returns recipe IDs, titles, status, and safe reason only — no paths or raw Vault content.
  • Prompt now explicitly forbids answering structured image-inventory questions via search_vault_recipes with “no image”.

Acceptance: a disposable on-disk Vault with two missing images and other valid/broken images returns exactly the two missing recipes.


R2-B — Image Generation

Tool generate_recipe_image calls the existing RecipeImageRecoveryController with the selected canonical recipe.

It preserves:

  • the user's existing image provider selection;
  • OpenRouter image integration and session-only credential lifecycle;
  • server-owned quote/cost classes;
  • paid/variable confirmation tokens;
  • no silent provider fallback;
  • one provider call per confirmed quote;
  • fresh quote/confirmation on regeneration;
  • existing bounded provider errors.

The tool never saves, never exposes preview tokens/paths, and never invents recipe details. Generation uses the canonical recipe title, ingredients, cuisine, course, description, and Markdown hash; unsaved SHISO working-copy edits are not used.

A compact image panel shows the authenticated preview with:

  • Confirm generation for paid/variable quotes;
  • Save Image, Regenerate, Cancel for previews;
  • Done after save.

Preview is never automatically saved. Save uses the existing canonical image-save path and the R1 immediate-refresh correction to update the current recipe and Vault card.


Application-boundary image authorization

The model prompt is not the authorization boundary.

src/core/shiso/imageGenerationAuthorization.ts classifies the exact user-authored message before the turn. ShisoModal creates a per-turn grant only when:

  • the message explicitly requests an image;
  • a canonical selected recipe exists;
  • the grant is bound to that recipe identity and turn.

generate_recipe_image checks this grant before calling the controller. The model cannot create, widen, or replay it. A second tool call in the same turn is rejected after the first consumes the grant.

Verified:

  • inventory question + model-initiated generation attempt → zero quote/generate calls, zero saves, no preview panel;
  • informational request → no generation authorization;
  • explicit selected-recipe request → permitted through existing quote flow;
  • paid/variable → explicit confirmation required before any provider call;
  • preview → no automatic save;
  • provider unavailable → meaningful message, no generation;
  • Vault-change save conflict → preview retained, no success callback;
  • cancellation → preview cleared, no save.

Verification

Check Result
Focused unit/security/native suite (27 files) 370/370 PASS
Real-App on-disk integration 13/13 PASS
Image inventory tests 10/10 PASS
Image authorization classifier tests 14/14 PASS
Rendered SHISO preview/approval tests 6/6 PASS
TypeScript tsc --noEmit PASS
Production build PASS
git diff --check PASS

A combined 2-worker run exposed two pre-existing 1-second Vault-connect timeouts in the large real-App file; that file passes 13/13 when run alone, and the 27-file focused suite passes 370/370. No R2 assertion failed.

The rendered preview test uses jsdom and deterministic PNG bytes. No paid provider calls were made. No visual screenshot was captured in this scope.


Scope

15 files: 11 modified, 4 new.

No personal Vault or credential changes, no paid inference, no additional image engine, no bulk generation, and no Advanced Nutrition/metadata-recovery changes.

Not merged.

@kryptek2000
kryptek2000 merged commit da969f1 into main Nov 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant