Skip to content

Status, 11 November 2026: proposed by Yevhen Kariakin (Jira STOR-127; the module's side is STOR-128). Not accepted by the founder, Dmitriy Zhuk, or by Artem Belikov, who owns the module. Four choices below were already made by Yevhen Kariakin on 11 November 2026 and are marked as such; the rest is the proposal. Update, 16 November 2026: the API side (not the module's) is implemented on the branch feat/STOR-127-images-api (STOR-127): the two MCP tools, the attachment note and check, the copy and its deletion by the queue, the download route with its tokens, pim-v1, the read-back and the receipt, and the approval card. It is not merged, and it is proven only with an in-memory store at the driver port and against the real OpenCart module's refusal; no module implements images (STOR-128), so the whole path is unproven against a store. Before that update: proposed is not implemented, and nothing here has run against a store. The contract text is the images block of contracts/module/operations.json (status proposed); it is not in the main blocks and not in the standalone schema, so a module cannot declare it yet.

Update, 20 November 2026 (Jira STOR-128, module side): the contract was promoted into the main blocks of contracts/module/operations.json (as to_implement; protocol.yaml gained Image and the optional limits imageMediaTypes and maxImageBytes) by Yevhen Kariakin so that the modules could be built. This is NOT an acceptance: the founder, Dmitriy Zhuk, and Artem Belikov have still not accepted the decision, and the questions below stay open except where answers_found in the contract's images block says what the implementation showed. The OpenCart 3 and OpenCart 4 modules (version 1.5.0) now implement the reads, the three writes, the download and its checks and the module's folder; the conformance scenarios image.* (23, in contracts/conformance/images.ts) pass on the reference module and on the six local test shops (OpenCart 3.0.3.5, 3.0.5.1 and the four OpenCart 4 shops), and the API's end-to-end test (api/test/changeImages.e2e-spec.ts) runs the whole chain, proposal to receipt, against the real module of the OpenCart 3 test shop. Nothing has run against a real store. Because the API's driver did not map image and images from a module's answer, that mapping was added in the same change.

009 — Product and category images ​

Let the owner attach a photo in the chat with the Admin Agent and ask for it on a product or a category: the agent proposes the change, the owner sees the new image next to the current one and approves, the API gives the module a link to the file, the module downloads it, checks it, saves it in the shop and assigns it, and the API reads back and gives a receipt. It keeps the shape of decision 004 and 008: the module does what it is told, one conditional write at a time; approval, the ledger and the receipt stay in the Store Deputy API.

Context ​

The contract has no image field at all: reads return none and apply writes none. Decision 008 deferred images to STOR-127. Meanwhile an employee can already attach a picture in the chat (STOR-111, 3 MiB a file), and Store Deputy passes it to Agentfy without keeping the bytes (the working log DECISIONS.md, 6 November 2026).

What an owner meets: "put this photo on the kettle" and "make this the Kettles banner" have no answer; neither has "remove the second photo" or "swap the first two".

The difficulty is the bytes. A signed request body is at most 262144 bytes (the module's maxBodyBytes) and an image may be 3 MiB; the shop's disk is written by the module; and the file is untrusted input from a chat.

Chosen by Yevhen Kariakin on 11 November 2026 ​

These four are inputs of this proposal, not open.

  1. Transport: the module pulls. The signed apply request carries, per image, a short-lived download link on the Store Deputy API with the file's SHA-256, byte size and media type. The module downloads only from the Store Deputy origin it is connected to, and checks size, type by content and SHA-256 before saving. The request stays small.
  2. Store Deputy keeps a copy for the proposal. At proposal time the API fetches the attachment's bytes from Agentfy and keeps them until the change is executed or the proposal expires (24 hours), plus a few days for the receipt, then deletes them. This is an explicit, narrow exception to the STOR-111 decision that Store Deputy keeps no bytes of chat files. The proposal's action hash binds the image by its SHA-256.
  3. Scope of the first version: set or replace a product's main image; add an additional product image; remove an additional product image; reorder the additional images; set or replace a category's image.
  4. The module never deletes an image file from the shop's disk. Replacing or removing changes assignments only; the file stays, because other products, themes or banners may use it.

Decision ​

  1. Images are fields of apply, not a new verb. product.apply gains image (the main image) and images (the additional ones); category.apply gains image. They keep the item { id, expected, set } and compare-and-set on what is stored. Why not a dedicated operation: the guarantee wanted is exactly "nobody changed the images meanwhile", which expected gives; the additional images are one ordered list, so add, remove and reorder are one write of the whole list (as specials in decision 008) and need no operation per action.

  2. What a read returns. product.get and category.get take include: ["images"] (covered by product.read and category.read, like texts; not on list or query). An image is { path, url }:

    • path is the stable value: the file's path relative to the shop's image folder, forward slashes (OpenCart keeps catalog/demo/kettle.jpg this way). expected and set compare paths and nothing else.
    • url is an absolute address for display, built by the module from the default storefront's URL in store.describe plus the image folder and the path, or null.
    • Product.image is an image or null; Product.images is an array in display order (the order is the array; sort_order values are the module's business); Category.image is an image or null. A path appears at most once in images.
    • An image has no id: the path identifies it, and two entries of one path are refused. Why: an OpenCart row id is the platform's detail (as for specials), and one picture twice in a gallery is not a case worth an identity.
  3. What a write sends. expected: { image: { path } | null } and set: { image: <source> | null }; for the list, expected: { images: [{ path }, …] } and set: { images: [<source>, …] }, the whole new list in order. A <source> is one of:

    • { path }: an image already in the shop (it keeps an existing image in the list, or reuses a file for the main image). The module checks that the path resolves to a file inside the image folder with an allowed type; otherwise rejected / unknown_reference.
    • { upload: { url, sha256, size, mediaType } }: a new file to download.

    A path of the current list that the new list omits is removed from the product; its file stays. Adding is the list plus an upload; reordering is the same paths in another order; the API never sends a list the owner did not see (the card shows it).

  4. Capabilities product.write.image, product.write.images, category.write.image, each conditional: atomic | emulated like the others. Three, not one: a platform may keep a main image and no gallery (and the category image is another resource); a module offers what its platform has.

  5. The download. The link is {api_url}/module/images/<token>:

    • Origin. The module's api_url is one of the build values written into its package at build time and read only from there, "never merged with the module's settings" (protocol); it is the origin the module already exchanges its Connect code with, and it already downloads its own release from {api_url}/module/opencart3/download the same way (checksum from the release answer, no redirects; module update). So no new address is stored. A link whose origin is not that origin is invalid_params (the API never sends one). HTTPS with the certificate verified; plain HTTP only in a development build; no redirects followed.
    • Authentication is the token in the path: at least 32 random bytes, only its hash stored by the API, bound to one connection, one image and one change item. No secret leaves the module.
    • Lifetime (proposed, not measured): 10 minutes, at most 3 downloads (the module may retry a failed download). Links are made when the change is sent to the module, not when it is proposed: a proposal lives 24 hours. A resend of the item gets new links.
    • What the module checks, before it writes anything: stops reading at size + 1 bytes; the byte count equals size; the SHA-256 equals sha256 (constant-time); the content is jpeg, png, gif or webp by its first bytes and a successful read of its header (not by extension or by the mediaType the API sent, which it must also match); the header's dimensions are within the cap. Time-outs on connect and on the whole read.
    • Answers. rejected (nothing saved or assigned): image_checksum_mismatch, image_type_invalid, image_too_large (bytes above the limit, or dimensions above the cap), unknown_reference, invalid_item. failed and retryable, nothing assigned: image_download_failed (network error, time-out, a status other than 200, a redirect, an expired or used-up link, a body longer than size). These are proposed additions to ApplyReason; there is no new error code, because a module answer of invalid_params, limit_exceeded and the rest of the catalogue keep their meaning.
  6. Where and how the module saves.

    • Folder image/catalog/storedeputy/. File name: the first 32 hexadecimal digits of the SHA-256, plus an extension taken from the detected type (jpg, png, gif, webp). The name is made by the module from verified content; nothing from the request (no file name, no path, no extension) reaches the file system, so there is no path traversal to close. A file already there with equal size and hash is reused; one with another content under that name is failed / database_error.
    • Allowed types: jpeg, png, gif, webp; never svg, never an executable extension. webp is offered only where the platform makes thumbnails of it (see the open questions); the module declares what it offers in two optional manifest limits, imageMediaTypes and maxImageBytes (default 3 MiB, the chat's limit), which would be added to Limits in protocol.yaml on acceptance.
    • Dimensions: header dimensions are read before anything is decoded or resized; the proposed cap is 25 megapixels and 10000 pixels a side. OpenCart makes thumbnails by decoding the whole picture in memory, so this is the guard against a small file that expands to gigabytes.
    • The module adds an empty index.html to the folder and, where the web server reads it, an .htaccess that turns script handlers off (best effort).
    • No file is ever deleted by the module. Removing, replacing and a lost compare-and-set leave files where they are.
  7. Order of work in the module. Compare expected with the current paths first and answer conflict without downloading anything; download and verify every upload; save the files; write the assignment conditionally; read back. A conflict at the last step leaves a saved file: its name is its hash, it is harmless and it is never deleted.

  8. Idempotency and retries. apply has no idempotency key (decision 008: every apply carries expected), and this does not need one:

    • A retry before the write sends the same item with new links; the content-addressed name means a second download makes no second file.
    • A retry after a success finds the paths changed, so the module answers conflict; the API reads the record and, because it knows the SHA-256 and the type and so the path the module chooses, recognises its own result and records applied, as it does after a time-out for any write.
    • So a retried apply never creates two files or two additional images. A path twice in the list is refused anyway.
  9. The proposal's copy in the API. The bytes the API fetched from Agentfy at proposal time are kept until the change is executed or the proposal expires, then 7 days (proposed) for the receipt, then deleted by the job queue; after that the receipt shows the image from the shop's own url. The copy is only readable by the team that owns the proposal and by the download link. Where it lives (a table, or a private volume) is the API's implementation choice; the requirements are tenant isolation and deletion by the queue.

  10. The action hash. A new tag, pim-v1 (like ptx-v1 for texts), covers the target, the action, the expected paths, the image's SHA-256, size and media type, and for a reorder the new order. An approved change cannot be applied to another image, and a swapped upload fails the hash.

  11. The agent names the file. The model today receives an image as a picture with its file name but without an attachment id. Proposal: Store Deputy adds a short note to the text it relays to Agentfy for a message that has attachments, listing each id and name ("Attached: ID, kettle.jpg, image/jpeg"). The MCP tool takes attachment_id; the API checks the id is on a message of this conversation in its own message records (it stores the attachment ids with the message) and that the conversation is the caller's. The call context is verified only in log mode by default, so the tool must not rely on it for this: it refuses when the conversation cannot be established, whatever the mode. Agentfy needs no change; exposing the ids to the model by itself (in toTurnAttachment) is an optional improvement that would make the note unnecessary.

  12. MCP tools (draft, not in contracts/mcp/tools.yaml).

    • product_image_change_propose { product_id, action, attachment_id?, path?, order?, position? } with action one of set_main and add (need attachment_id; add takes an optional 1-based position, default last), remove (needs path, from the product's current read) and reorder (needs order, every current additional path in the new order).
    • category_image_change_propose { category_id, action, attachment_id? } with action of set (needs attachment_id) or remove.
    • Both read the current images first (the expected values), refuse a module without the capability plainly, and need catalog.write. Draft entry (shape, not final): { name, scope: catalog.write, needs: [product.write.image, product.write.images], arguments: {…as above}, returns: change proposal }.
  13. The approval card. The new image next to the current one (the current from the shop's url, the new from the API's copy, served only to the signed-in team); for a reorder, the order before and after; for a removal, the image that leaves and a line that the file stays in the shop. The owner approves the change, not a file name.

  14. Permissions. Image changes sit under the existing catalog.write: they edit an existing record as a price does, and every change needs a manual approval. Whether a permission of their own is wanted is an open question.

Removing the main image and the category image ​

Proposed: allowed (set: { image: null }, file untouched), under the same capability and approval. Why: "take the photo off" is a normal request, it is reversible (the file stays, a later change can put the same path back) and it changes nothing the owner cannot see on the card. The cost is a product or a category without a picture on the storefront; the card says so. If the founder prefers, the first version can leave it to the admin panel: it is one line in the tool. Flagged below.

Security ​

RiskHow it is closed
The shop's disk is written by an untrusted file.The name is made by the module from the verified content, in one folder, with an extension from the detected type; no executable extension is possible; svg is not allowed; the folder gets an index.html and, best effort, an .htaccess that turns script handlers off. The module does not re-encode: that would change the hash.
SSRF through the link.The module downloads only from the api_url baked into its package; any other origin is invalid_params. No redirects, TLS verified, HTTPS outside a development build. A request body cannot choose the host.
Content-type spoofing.The type is decided by the first bytes and a successful header read, and must equal the mediaType the API sent; the extension and any header are ignored.
Decompression bombs and huge dimensions.A byte limit of 3 MiB (stop reading at size + 1), a dimension cap read from the header before any decode (25 megapixels, 10000 px a side, proposed). The API applies the same cap at proposal time so the owner learns it in the chat.
Path traversal.No path from the request becomes a file name. A { path } source is resolved and must stay inside the image folder, be a file, and have an allowed type, else unknown_reference.
A stolen or replayed link.Token of at least 32 random bytes, only its hash stored, bound to one connection and one image, 10 minutes and 3 downloads (proposed); a link says nothing the SHA-256 does not, and the downloaded file must still match the signed request. It travels only inside the signed request to the module, over HTTPS; the module must not log it.
Another team's attachment.The API checks the id against its own record of this conversation, and the proposal needs the team's approval; the download token is bound to one connection.
Private data in a photo (EXIF location).Not closed by the module. Open: the API could strip metadata before it keeps the copy (open question).

What changes where ​

PlaceChange
contracts/module/operations.jsonThe proposed images block in this change (status proposed). On acceptance: include: ["images"], the fields, capabilities and reasons move into the main blocks as to_implement; protocol.yaml gains the optional Limits fields and Image in the neutral Product and Category.
Module, OpenCart 3 and 4 (STOR-128, Artem Belikov)The reads, the three writes, the download and its checks, the folder. Nothing is written until the decision is accepted.
API (STOR-127, Yevhen Kariakin)The two tools, the attachment note and check, the copy and its deletion, the download route and tokens, pim-v1, the receipt.
AppThe approval card with before and after.
AgentfyNothing required. Optional: the model sees attachment ids.

Alternatives considered ​

  • The API pushes the bytes in the request. Simplest for the module, but a request is limited to 262144 bytes and base64 inflates by a third; raising the limit for one operation would remove the guard for every other.
  • The module downloads from Agentfy. The module would then need a second origin and a second credential. Only the Store Deputy origin it is connected to is trusted.
  • A dedicated image.upload operation, then assign by path. Two calls, a file with no owner between them, and a place for orphans; folding it into apply keeps one conditional write.
  • Per-image ids and image.add, image.remove operations. Ids are the platform's rows; the whole-list compare-and-set is the guarantee, as with specials.
  • Random file names. A retry would make a second file; the content-addressed name is idempotent and needs no table in the module.
  • Re-encoding in the module. It would strip hidden payloads and metadata, but the saved bytes would no longer equal the signed SHA-256 and the receipt could not prove what was saved. If metadata is the worry, the API can do it before it hashes.

Consequences ​

  • The agent can set, add, remove and reorder product images and set a category image behind a capability, a permission and an approval. A shop whose module declares none keeps today's behaviour.
  • Store Deputy keeps image bytes for a bounded time, which it did not before. The retention number is a proposal.
  • The shop's disk gains a folder the module owns and files it never removes; an owner who wants them gone does it in the shop.
  • Every image the module saves is a file Store Deputy chose to write to a shop server, which is why the checks run in the module and not only in the API.
  • Nothing is proven. No part of this has run against a store, and the OpenCart facts are unverified.

Scope ​

In: the read of images; image, images on product and image on category; the download; the module's checks; the API's copy and tools; the card. Out: attributes and options, deleting files, resizing or cropping, alt texts, product videos, images of a manufacturer, a customer group or the shop's logo, image reads on list and query, the API and module code.

Open questions ​

QuestionOwner
A path under image/ as the stable value with a module-built absolute url. The OpenCart 3 and 4 facts used here (product.image, product_image with sort_order, category.image, thumbnails in image/cache) are from memory and not verified.Artem Belikov
webp: OpenCart 3.0.x's image library resizes only the formats it has a function for, and the proposer remembers no webp path there (unverified). Offer webp only on OpenCart 4, or on a shop that makes thumbnails of it? The default list proposed is jpeg, png, gif.Artem Belikov
Removing the main image or the category image: allowed (proposed) or left to the admin panel in v1.Yevhen Kariakin, Dmitriy Zhuk
Strip metadata (EXIF location) and check dimensions in the API before the copy is kept, or store the bytes as sent.Yevhen Kariakin
index.html and .htaccess in the module's folder; and the name of the folder.Artem Belikov
Is timeBudgetMs (10 seconds) enough for one download and a save on a slow shop, or a separate limit is needed. v1 sends one item with an upload per request.Artem Belikov
Image changes under catalog.write, or a permission of their own.Dmitriy Zhuk
7 days of copy for the receipt and 10 minutes with 3 downloads for a link are starting values, not measured. Where the bytes live in the API.Yevhen Kariakin
Whether the dimension cap (25 megapixels, 10000 px a side) is right for what owners photograph.Yevhen Kariakin, Artem Belikov