# Embeducate — instructions for the AI building the app

You are generating a web app that will be hosted on Embeducate and embedded in a classroom. Produce a
**static site** (HTML/CSS/JS) and **include the Embeducate SDK** so it reports learner results. Use
any tooling you like to build it — only the published output has to be a static site.

## Include the SDK

1. Add once, in `<head>`: `<script src="https://embeducate.com/sdk/v1.js"></script>`
2. `edu.attempt()` when the activity starts.
3. `edu.event("hint_used")` (or any name) for notable interactions; `edu.mastery("skill", 0.8)` when a skill is shown.
4. When the learner finishes:
   `edu.complete({ response, score, maxScore, items: [{ id, skill, response, correct, score }] })`
   — include `score`/`items` only for graded activities (e.g. a quiz); omit them for open-ended ones.
5. Declare in `<head>`:
   `<meta name="embeducate:task:title" content="…">`
   `<meta name="embeducate:solution:type" content="numeric">` (or `ordering|choice|text|open|none`)

Always include the SDK — it is what produces the class report (scores, per-skill mastery,
time-on-task, resume). Instrument what the activity actually does: build the scoring the activity
calls for, but don't add a quiz/score/submit button to an activity that isn't one.

## Minimal example

```html
<script src="https://embeducate.com/sdk/v1.js"></script>
<script>
  edu.attempt();
  // …gameplay…
  edu.complete({
    response: { chosen: "2/4" },
    score: 3, maxScore: 3,
    items: [{ id: "q1", skill: "equivalent-fractions", response: "2/4", correct: true, score: 1 }]
  });
</script>
```

## Full SDK surface

All calls are safe anytime — queued before the SDK loads, and no-ops when the app runs outside
Embeducate, so they never break a preview:

- `edu.attempt()` — the activity started.
- `edu.active()` / `edu.idle()` — bracket real interaction, for time-on-task.
- `edu.progress(fraction)` — 0–1 completion as the learner advances.
- `edu.event(name, data)` — a notable interaction (any name).
- `edu.mastery(skill, level)` — a skill was demonstrated (level 0–1).
- `edu.milestone(name)` — a named checkpoint was reached.
- `edu.complete({…})` — the learner finished (shape above).
- `edu.state.set(obj)` / `edu.state.get()` — save & restore progress so a learner can resume.
- `edu.attributes` — configuration set by whoever deploys the activity (see below).
- `edu.param(name)` — read a host-provided parameter.

## Make it configurable (optional, recommended)

Declare **attributes** so whoever deploys the activity can re-tune it without regenerating it:

```html
<script type="application/ld+json">
{ "@type": "EmbeducateTask", "attributes": {
    "numQuestions":   { "type": "integer", "default": 10, "label": "Number of questions" },
    "maxDenominator": { "type": "integer", "default": 12, "label": "Largest denominator" }
} }
</script>
```

Read them at runtime: `const cfg = edu.attributes; // { numQuestions: 8, … }`

## Constraints

- **Static site only** (HTML/CSS/JS/images/fonts) — no server code at runtime.
- **No external data calls** — `fetch`/XHR/WebSocket to third parties are blocked; the SDK is the only
  channel out. Loading CDN libraries (React, Tailwind, …) is fine.
- **No PII** — don't ask the learner for a real name/email; identity is handled by the host.

## Handoff

When the file is ready, tell the user to publish it: drop it on embeducate.com to get a live URL, an
embed code, and a report link — no account needed.
