# Kiro animation import standard

Status: handoff for Kiro, based on one real file. This document separates what was measured, what 365 Invite implements, and what is still only a specification.

The supplied file is `v0.3.0-midnight-masquerade.html`.

- Size: 249608 bytes.
- SHA-256: `ce120df0bba6b751b064158b9a490527a77d3c8ccd379dd5d6a63ec2ed708431`.
- Engine found in the file: 365 Invite Cinematic Invitation Engine (Kiroween 2026).
- Release version is the filename `0.3.0`, family `midnight-masquerade`. There is no separate engine semver and no schema 1.1 manifest.
- The original bytes are stored unchanged. 365 Invite does not rewrite the script.

Schema 1.0.0 is unchanged. Schema 1.1.0 is the standalone-HTML manifest 365 Invite can read. This file does not contain that manifest.

The synthetic Northlight fixture is not this file and is not a Kiro original.

## Measured on this file

Played in a sandboxed iframe (`sandbox="allow-scripts"`, no `allow-same-origin`) from a blob URL. The blob URL keeps `location.protocol` as `blob:`, so the file does not fetch `invite.json`. A second platform CSP was not required for playback. The file's own CSP stayed in force.

| Check | Result | Evidence |
| --- | --- | --- |
| Bytes and checksum | PASS | SHA-256 above. Fixture copy equals the attachment. |
| Desktop playback | PASS | State `playing`. Title `The Midnight Masquerade — an invitation`. |
| Mobile playback | PASS | 390px wide envelope scene. The file's own stage can scroll horizontally. 365 Invite does not restyle it. |
| Embedded fonts | PASS | Cormorant Garamond and Cinzel loaded from embedded WOFF2. |
| Canvas, foil, wax, motion | PASS | The opening plays. Effects are inside the file, not platform controls. |
| Replay, skip, pause | PASS | The file's `#btn-replay`, `#btn-skip`, and `#btn-play` changed state. Platform pause stays disabled. |
| English and Swedish | PASS | `#lang=en` and `#lang=sv`, and the file's own language buttons. Swedish title `Midnattsmaskeraden — en inbjudan`. |
| Reduced motion | PASS | `#motion=reduce` reaches state `done` and shows the final card. It does not blank the page. |
| Two guest names | PASS | `#guest=Alice%20Example` shows Dear Alice Example. `#guest=Bob%20Example` with Swedish shows Kära Bob Example. |
| Event title, date, venue, dress, host, logo, colors, type, wax, foil, lighting | FAIL for studio editing | Those values are the embedded defaults. `invite.json` is requested only on `http:` or `https:`. The sandbox cannot provide that file. The script is not rewritten. |
| Runtime protocol 1.1 | FAIL | This file never posts `365invite.runtime`. Parent `init` and `pause` do nothing. |
| In-file RSVP saved | FAIL, by design | The dialog builds a `mailto:` and says the reply is not stored. That is not a platform RSVP. |
| Same release on two events, saved RSVP, CSV | NOT TESTED in this browser | Founder sign-in is required. Steps are at the end. |

## What 365 Invite does with this file

Implemented:

- Detection requires both the engine name `365 Invite Cinematic Invitation Engine` and `function parseHashParams` that reads `guest` and `lang`.
- Display uses a blob URL plus a hash. Allowed keys are only `guest`, `lang` (`en` or `sv`), and `motion=reduce` when the visitor prefers reduced motion.
- The guest value is the display name, cleaned the same way the file cleans it: control characters and `<>` removed, collapsed spaces, 60 characters. The invitation token, email, session, and other guests are not placed in the hash, the path, or the query.
- No look, logo, typeface, or accent control is shown for this release. Those catalogs still exist for a file that declares them.
- The accessible card still shows the platform title, time, venue, dress, and the platform RSVP form.
- Import keeps the original HTML. The same checksum is a duplicate. A different file with the same family and version is refused and the earlier release is not overwritten. A new filename version is required.
- The supplied file can be registered from Templates. Registration does not publish it. A person still marks it previewed, approves it, and publishes it.
- Live email, public signup, and billing stay off.

Not implemented, because this file cannot accept it safely:

- Rewriting the bundle so a studio field replaces a hardcoded string.
- Loading `invite.json` by relaxing the sandbox or the CSP.
- Treating `mailto:` or an animation click as a stored RSVP.
- Parent pause for this file. Use the pause button inside the animation.

## Changes Kiro needs to make

Do this in a new filename version, for example `v0.4.0-midnight-masquerade.html`. Do not replace `v0.3.0`.

1. Sandbox-safe configuration. `fetch('invite.json')` does not run under the blob sandbox, and a sandboxed `http` frame fails that fetch from an opaque origin. Ship one of these, in order of preference:
   - Read the same event fields from the URL hash, with the same sanitizing style as `guest`. Suggested keys, all optional: `title`, `tagline`, `date`, `venue`, `address`, `dress`, `host`. Keep them short and plain text.
   - Or listen for `365invite.runtime` 1.1 `init` and `apply` (below). Do not require `allow-same-origin`.
   - Do not require a sibling `invite.json` unless it is already embedded and used without a network fetch.
2. Put a schema 1.1.0 manifest in the file so the studio knows which fields are real. Declare a binding only if the animation applies it.
3. RSVP. Keep the visual button if you want. On confirm, `postMessage` `rsvp-request` with `status` of `yes`, `no`, or `maybe`. Do not use `mailto:` as the recorded reply. The parent ignores any invitation id inside the message. The guest confirms on the platform form.
4. Optional: answer `pause` with `paused`. Until you do, the platform pause control stays disabled. Your own pause button can remain.
5. Logos and look. Declare `logoPlacements` and `look` keys only for values `init` actually applies. The platform will not invent wax, foil, or paper controls for a file that does not declare them.
6. Keep fonts, images, and CSS embedded. Do not ask for a weaker CSP. The file's current hashed script policy is fine.
7. Keep English and Swedish, replay, skip, and reduced motion. `#motion=reduce` should keep showing the final card.

`v0.3.0` can stay a playable name-and-language release. It should not be described as a fully editable template.

## Hash contract this file already implements

`parseHashParams` reads the location hash:

- `guest`: string, sanitized, max 60. Overrides the embedded "Honoured Guest" / "gäst". The card prints `Dear {guest}` or `Kära {guest}`.
- `lang`: exactly two letters. `en` and `sv` are the catalogs in this file.
- `motion`: `reduce`, `reduced`, or `full`.
- `speed`: number from 0.1 to 16. 365 Invite does not send `speed`. It was not used as an editor.

Language chosen inside the file is stored in `localStorage` key `365invite.lang` inside the opaque frame. That storage is not the parent site's storage.

`window.inviteDebug` exists. It is for tests. It is not a configuration API.

Embedded defaults, used whenever the hash does not override them, include title The Midnight Masquerade / Midnattsmaskeraden, Ravenhall Manor, 30 October 2027, dress code, and host The Order of the Silver Moon. Host email in the file is `rsvp@example.com`. The mailto is not delivered by 365 Invite.

## Manifest 365 Invite can read

This file does not include it. Add it for the next release. It is data. It is not executed.

```html
<script type="application/vnd.365invite.manifest+json" id="365-invite-manifest">
{ "kind": "templateManifest", "schemaVersion": "1.1.0", "renderMode": "standalone-html" }
</script>
```

Normative schema: `schemas/template-manifest-1.1.0.schema.json`.

Example: `examples/template-manifest-1.1.0.example.json`.

Schema 1.0.0 still requires `engine.entrypoint` ending in `.js`. This importer does not fetch or run that entrypoint.

An embedded `<script type="application/json" id="invite-json">` is noted and not applied by rewriting script.

## Editable fields

| mapsTo | How v0.3.0 works | How a later file should work |
| --- | --- | --- |
| recipient.displayName | PASS via `#guest=` | Keep the hash, or send it on `init` |
| recipient.firstName, lastName, greeting | Not separate. The file builds Dear/Kära itself | Declare them only if you render them |
| event.title, message, venue, when | Embedded defaults only. Requires Kiro Adapter | Hash or `init` |
| event.accentColor, event.logoUrl | Not applied. Requires Kiro Adapter | Declare look or logo placement and apply the data URL |
| Paper, wax, foil, light, particles, typeface | Inside the file as `MIDNIGHT_LOOK`. Not editable | Declare catalog keys and apply `config.look` |

Placeholder form, if you choose tokens instead of the hash:

`{{recipient.greeting}}` `{{recipient.firstName}}` `{{recipient.lastName}}` `{{recipient.displayName}}` `{{event.title}}` `{{event.message}}` `{{event.venue}}` `{{event.when}}` `{{event.accentColor}}` `{{event.logoUrl}}`

`transport: "placeholder"` means that exact token is in the HTML outside the script you do not want rewritten. The platform replaces the token at display time and escapes text.

`transport: "protocol"` means the animation listens for the messages below. Declaring it without listening does not make the control work. 365 Invite hides look controls unless the manifest lists them, and this cinematic file lists none.

Accent is `#RRGGBB` only. Logo is a PNG, JPEG, or WebP data URL. SVG is refused.

## Runtime messages

Schema: `schemas/runtime-message-1.1.0.schema.json`.

Parent to animation, `postMessage` to the frame, target `*`, because the sandboxed frame is origin `null`:

```json
{
  "protocol": "365invite.runtime",
  "version": "1.1.0",
  "channel": "<created by the parent>",
  "type": "init",
  "config": {
    "locale": "en-US",
    "reducedMotion": false,
    "recipient": { "firstName": "Alice", "lastName": "Example", "displayName": "Alice Example", "greeting": "Dear Alice" },
    "event": { "title": "", "subtitle": "", "message": "", "venue": "", "when": "", "accentColor": "#1C1712", "logoUrl": "", "organizerName": "", "dressCode": "" },
    "look": {},
    "logoPlacement": ""
  }
}
```

Parent types: `init`, `apply`, `setLocale`, `replay`, `pause`, `destroy`.

The parent sends `init` on load only when the manifest declares `init` and `apply`. This cinematic file does not, so no message is sent.

Animation to parent. Accepted only when `event.source` is that iframe, `event.origin` is `"null"`, and protocol, version, and channel match:

- `ready`
- `complete`
- `error`
- `paused`
- `rsvp-request` with `status` `yes`, `no`, or `maybe`

`rsvp-request` only pre-selects the platform form. The guest must press Save. The server checks the real invitation token. The animation never receives that token.

Do not claim full protocol compatibility for a file that only plays. v0.3.0 plays. It does not speak this protocol.

## RSVP

365 Invite stores the reply through its own form and API. Duplicate saves with the same idempotency key do not add a second history row. A wrong or missing token is rejected. GET of the invitation does not write a reply.

The mailto dialog inside v0.3.0 may not open from the sandbox, because the frame cannot navigate the parent. That is acceptable. Do not weaken the sandbox to make mailto work.

## Sandbox and CSP

- iframe `sandbox="allow-scripts"`.
- No `allow-same-origin`, no `allow-top-navigation`, no `allow-popups`.
- `referrerPolicy="no-referrer"`.
- The cinematic file is loaded from a blob URL created in the parent. The document bytes are the stored original.
- Placeholder templates still use `srcdoc` plus a display CSP (`connect-src 'none'`). That wrapper is not used for this cinematic file, so its hashed script policy is left as authored.
- External scripts, remote frames, remote stylesheets, and `javascript:` URLs are refused at import. `latest.html` is refused.
- Inline script, inline CSS, SVG, data-URI images, data-URI WOFF2, canvas, and 3D transforms are kept. They were observed to render in this file.

## Versioning

- Filename `vX.Y.Z-animation-name.html`. Never `latest.html`.
- Template id for this release: `tpl_midnight_masquerade_0_3_0`.
- The same SHA-256 imports as a duplicate.
- Same family and version with a different SHA-256 is a conflict. The new file is not stored. The approved file is not overwritten. Use the next version in the filename.
- An event stores the template id and a revision. A later release does not change an event created with v0.3.0.
- One published template can be used by more than one event. Duplicating an event does not copy guests or replies. HTML is not copied per guest.

## Logos

PNG, JPEG, or WebP only. The browser resizes before upload. Magic bytes are checked. The asset belongs to the founder. This file declares no placement, so a logo stays on the accessible card.

## Platform data

`event-config` schema 1.0.0 remains the canonical event: schedule, venue, localized title and message, accent, logo asset id, RSVP rules.

Look and logo placement are studio extras. They are not added to schema 1.0.0. For v0.3.0 they are empty.

## Minimum manifest example

This is not a Kiro delivery and it is not the Midnight Masquerade file.

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Specification example</title>
<script type="application/vnd.365invite.manifest+json" id="365-invite-manifest">
{
  "kind": "templateManifest",
  "schemaVersion": "1.1.0",
  "renderMode": "standalone-html",
  "template": { "family": "spec-example", "version": "0.1.0", "name": { "en-US": "Spec example", "sv-SE": "Specifikationsexempel" } },
  "protocol": { "name": "365invite.runtime", "version": "1.1.0", "capabilities": ["init", "apply", "pause", "ready", "rsvp-request"] },
  "supportedLocales": ["en-US", "sv-SE"],
  "bindings": [
    { "mapsTo": "recipient.displayName", "transport": "protocol" },
    { "mapsTo": "event.title", "transport": "protocol" }
  ],
  "look": ["foil"],
  "logoPlacements": ["cover"]
}
</script>
</head>
<body>
<p id="greeting">Specification example. Not a Kiro original.</p>
<h1 id="title"></h1>
<button type="button" id="yes">Yes</button>
<script>
let channel = "";
window.addEventListener("message", (event) => {
  const msg = event.data || {};
  if (msg.protocol !== "365invite.runtime" || msg.version !== "1.1.0") return;
  if (!channel) channel = msg.channel;
  if (msg.channel !== channel) return;
  if (msg.type === "init" || msg.type === "apply") {
    document.getElementById("greeting").textContent = msg.config.recipient.displayName;
    document.getElementById("title").textContent = msg.config.event.title;
    parent.postMessage({ protocol: "365invite.runtime", version: "1.1.0", channel, type: "ready" }, "*");
  }
  if (msg.type === "pause") {
    parent.postMessage({ protocol: "365invite.runtime", version: "1.1.0", channel, type: "paused" }, "*");
  }
});
document.getElementById("yes").addEventListener("click", () => {
  if (!channel) return;
  parent.postMessage({ protocol: "365invite.runtime", version: "1.1.0", channel, type: "rsvp-request", status: "yes" }, "*");
});
</script>
</body>
</html>
```

## Offline

The file must keep working with no network. v0.3.0 does: fonts and pictures are embedded, and the blob sandbox does not fetch `invite.json`. Do not add a CDN in the next version.

## Founder steps still required

This browser session cannot sign in as the founder. After you are signed in:

1. Open Templates.
2. Choose Register supplied Midnight Masquerade. The id should be `tpl_midnight_masquerade_0_3_0`. A second click must say the checksum already matches.
3. Sandbox preview. Alice Example in English, Bob Example in Swedish. Names appear inside the animation. The card title will not match the animation title. That is expected for v0.3.0.
4. I previewed this, then Approve, then Publish release.
5. Create an event on that release. Name it 365 Invite Integration Test. Put any studio title you want. It will show on the card only.
6. Add Alice Example, `alice.example@example.com`, English. Add Bob Example, `bob.example@example.com`, Swedish. Open each link once. Alice's animation says Alice. Bob's says Bob. Reloading must not create an RSVP.
7. On Alice's page, choose Yes and Save reply. On Bob's page, choose No and Save reply. The animation's own RSVP button must not be the thing you rely on.
8. Reload both pages and the event Replies tab. Counts match. Export CSV and check the two rows.
9. Save the same reply again. History should not grow a duplicate for the same save. A made-up link is rejected.
10. Duplicate empty. The copy has the same template id, your edited card text, and no guests. Change the copy. The first event stays as it was.
11. Do not turn on live send.

Download this document from the contact page, from Settings, or at `/kiro-animation-import-standard.md`.
