@happyvertical/smrt-images
Image galleries, uploads, editing, categorization, metadata extraction, and semantic search.
What it gives you
Image galleries, uploads, editing, categorization, metadata extraction, and semantic search.
This package is one focused part of the s-m-r-t stack. Its decorated models participate in the same manifest, tenancy, persistence, and generated-interface conventions as the rest of the framework.
AI metadata and derivation retain provenance
ImageCategorizer categorizes curated metadata into tags, a description, confidence, and subjects; image bytes are not sent. generateAltText uses the prompt registry, a PII-safe allowlist, and tenant overrides. ImageEditor creates new Image records that link to their source through sourceAssetId. ImageDeriver records source provenance through AssetAssociation links when asked. UpstreamManager preserves external-provider provenance, while ImageMetadataExtractor reads dimensions, format, and EXIF.
Local adjustments without a GPU
Brightness, contrast, color, black-and-white, rotate, flip, region crop, and resize run locally through sharp. imageAdjustVariants offers two to four versions of one operation. encodeImageAdjustments and decodeImageAdjustments make a short URL-safe spec for preview routes, and decode refuses anything it did not write. applyImageAdjustments renders, and ImageEditor.adjust saves one result as a derivative.
Collection helpers filter loaded records
ImageCollection can select aspect ratio, landscape, portrait, square, high-resolution, or missing-alt-text images. These helpers filter in memory, so they belong after a bounded database query rather than as a substitute for a large server-side search.
Package UI
Components in this package
Import these public components directly. When the package also exports playground entries, the next tab renders its real components with package-owned example data.
Package previews
Try the working views
These previews are owned by the package and use its public components. Mock mode is intended for safe browsing; live mode appears only where the package supports it.
Generated interface
REST
The exact route set comes from each model's @smrt({ api }) policy
and the application manifest—not from a second controller definition.
GET /api/images
GET /api/images/:id
POST /api/images
PATCH /api/images/:idWhat stays consistent
- Tenant scope and operation permissions run before model access.
- OpenAPI and generated clients use the same manifest fields.
- Packages can expose read-only or custom action sets.
Generated interface
MCP
AI tools are generated from the methods you explicitly include. Their inputs are validated against the same model metadata used by REST and CLI.
images_list({ where, limit, orderBy })
images_get({ id })
images_create({ data })
images_update({ id, data })Agent-safe by construction
- Tool availability can be narrower than the HTTP API.
- Principal execution intersects RBAC, agent ceilings, and persona tools.
- Descriptions and schemas are emitted from source metadata.
Browser-native agent interface
WebMCP
The generated web definitions carry the same tool names, descriptions, and JSON Schema
inputs as MCP. smrt-web registers them with document.modelContext.
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
import { registerWebMcpTools } from '@happyvertical/smrt-web';
// Omitting an exposure policy registers read-only tools only.
const dispose = registerWebMcpTools(webMcpToolDefinitions);The page keeps its security boundary
- Tools execute through generated REST fetchers as the signed-in page user.
- Authentication, tenant gates, permissions, and field policy stay server-side.
- Feature detection makes registration a safe no-op outside supported browsers.
Generated interface
CLI
The app CLI turns manifest resources into predictable operator commands while keeping package-specific actions close to their models.
smrt images list --limit 25 --order-by created_at:desc
smrt images get <id>
smrt images create --from-file ./record.jsonMade for automation
- Machine-readable output and file-based input.
- The same include/exclude policy as other surfaces.
- Migration, introspection, dispatch, and knowledge commands stay in smrt-cli.