# ulams documentation The guides of https://ulams-dev.github.io/ulams/ as one Markdown document, 193 pages. --- # ulams documentation > Guides for course authors, administrators, developers and operators of ulams, the open, AI-native, headless LMS. Canonical page: https://ulams-dev.github.io/ulams/ ## Find your guide - [Content creators](https://ulams-dev.github.io/ulams/creators/index.md): Build courses, lessons and topics: video, H5P, SCORM, cmi5, LiaScript, quizzes, certificates. - [Learners](https://ulams-dev.github.io/ulams/learners/index.md): What learners see: the course catalogue, the player, progress, certificates and the account page. - [Administrators](https://ulams-dev.github.io/ulams/admin/index.md): The admin panel screen by screen: users, roles, settings, payments, templates, reports. - [Developers](https://ulams-dev.github.io/ulams/developers/index.md): Architecture, the API packages, tenancy, authentication, the reference frontend and testing. - [Extending ulams](https://ulams-dev.github.io/ulams/extending/index.md): Write a package, a topic type, a catalogue component or an integration. - [Operators](https://ulams-dev.github.io/ulams/operators/index.md): Self-host ulams: images, environment, tenants, TLS, backups, upgrades and high availability. ## Also here **Reference** Generated from the code on every build: [packages](https://ulams-dev.github.io/ulams/reference/packages/index.md), [permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md), [settings](https://ulams-dev.github.io/ulams/reference/settings/index.md), [environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md), [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md) and the [UI catalogue](https://ulams-dev.github.io/ulams/reference/ui-catalogue/index.md). **Decisions and roadmap** Every [architecture decision](https://ulams-dev.github.io/ulams/decisions/index.md) and the [roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md), rendered straight from `docs/` in the repository. --- # The admin panel > How to sign in to the ulams admin panel, what the dashboard shows, where each menu group leads and why some items are hidden. Canonical page: https://ulams-dev.github.io/ulams/admin/ The admin panel (`admin/` in the repository) is a React application built on Umi and Ant Design Pro. It has no data of its own: every screen calls the ulams REST API, and what you can see and do depends on the permissions of your account. Each tenant has its own admin panel host. In local development it is `{slug}.admin.localhost`, for example `http://coffee.admin.localhost`, and the panel derives the tenant API host from it (`http://coffee.localhost`). Accounts, roles, settings and content belong to one tenant; an account in one tenant cannot sign in to another. See [Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md) and [Tenancy](https://ulams-dev.github.io/ulams/developers/tenancy/index.md). ## Signing in *Screenshot: The admin panel sign-in form with email and password fields* The sign-in screen is at `/user/login`. Enter your email and password; **Remember me** is sent with the request. After a successful sign-in the panel stores the API token in the browser, loads your user, the tenant settings, the list of installed packages and the panel translations, and opens the page you were trying to reach (or the dashboard). Any account can sign in, but the panel only shows screens the account has permissions for. An account without the `access dashboard` permission (the default `student` role) sees no menu at all. The look of the sign-in screen comes from the `global` settings `logoLogin`, `showLoginBackgroundImage`, `loginHeaderBackgroundColor`, `loginHeaderFontColor` and `loginFormBackgroundColor` (see [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md)). > **Note:** On a tenant in demo mode the panel signs you in as the demo administrator automatically and > skips this screen. See [Demo mode](https://ulams-dev.github.io/ulams/admin/demo-mode/index.md). ### Forgotten password *Screenshot: The reset password form* 1. On the sign-in screen click **Forgot password**, enter your email and send the form. The API (`POST /api/auth/password/forgot`) emails a reset link that points back to the panel's `/user/reset-password` page. 2. The link carries `token` and `email` in the query string. Enter a new password on `/user/reset-password`; the panel sends it with the token to `POST /api/auth/password/reset` and returns you to the sign-in screen. The email is built from the template for the `ResetPassword` event (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)). ### Signing out and your profile The avatar menu in the top-right corner leads to [My profile](https://ulams-dev.github.io/ulams/admin/my-profile/index.md) and signs you out. Next to it are the notification bell (see [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md)) and the language switcher, which changes the panel language and the `X-locale` header sent to the API. ## The dashboard *Screenshot: The dashboard with course and sales widgets* `/welcome` is the start page. It needs only the `access dashboard` permission. It is a grid of widgets that you can drag, resize, remove and add back with the **Add** widget: - tutorial, your courses, hall of fame (best selling and best rated courses), ratings, current users, customers and sales, - pie charts of the report metrics: money spent per course, course popularity, time spent per course and tutor popularity. The layout is saved in your browser (`localStorage`), not on the server, so it is per browser and not shared with other administrators. The metrics come from the reports package; see [Reports and analytics](https://ulams-dev.github.io/ulams/admin/reports-and-analytics/index.md). When the `global.frontURL` setting is set, the dashboard shows a **Go to platform** button that opens the learner site with your token appended (`#/login?token=…`, the format of the legacy React learner app). ## Menu structure The left menu is generated from [`admin/config/routes.ts`](https://github.com/ulams-dev/ulams/blob/main/admin/config/routes.ts). Each top-level group and where it is documented: | Menu group | Screens | Documented in | |---|---|---| | Courses | Course list and editor, H5P content, LiaScript, SCORM packages, access requests, quiz reports | [Content creators](https://ulams-dev.github.io/ulams/creators/index.md) | | Courses | Categories | [Categories and tags](https://ulams-dev.github.io/ulams/admin/categories-and-tags/index.md) | | Courses | Webinars | [Webinars](https://ulams-dev.github.io/ulams/admin/webinars/index.md) | | Courses | H5P libraries | [H5P libraries](https://ulams-dev.github.io/ulams/admin/h5p-libraries/index.md) | | Integrations | LTI | [LTI 1.3 integrations](https://ulams-dev.github.io/ulams/admin/lti/index.md) | | Sales | Orders, payments, vouchers, products | [Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md) | | Users | List, user fields | [Users](https://ulams-dev.github.io/ulams/admin/users/index.md) | | Users | Roles and permissions | [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md) | | Users | User groups | [User groups](https://ulams-dev.github.io/ulams/admin/user-groups/index.md) | | Users | Notifications (push) | [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md) | | Teacher, Competency challenges | Subjects, challenges | [Teacher and competency challenges](https://ulams-dev.github.io/ulams/admin/teacher-and-competencies/index.md) | | Analytics | Notifications, reports, logs | [Reports and analytics](https://ulams-dev.github.io/ulams/admin/reports-and-analytics/index.md) | | Configuration | Files | [Files](https://ulams-dev.github.io/ulams/admin/files/index.md) | | Configuration | Settings | [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) | | Configuration | Templates (email, PDF, SMS) | [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md) | | Configuration | Translations, panel translations | [Translations](https://ulams-dev.github.io/ulams/admin/translations/index.md) | | Other activities | Consultations, consultation requests | [Consultations](https://ulams-dev.github.io/ulams/admin/consultations/index.md) | | Other activities | Stationary events | [Stationary events](https://ulams-dev.github.io/ulams/admin/stationary-events/index.md) | | Other activities | Questionnaires | [Questionnaires](https://ulams-dev.github.io/ulams/admin/questionnaires/index.md) | | Other activities | Pages | [Pages](https://ulams-dev.github.io/ulams/admin/pages/index.md) | | Other activities | Tasks | [Tasks](https://ulams-dev.github.io/ulams/admin/tasks/index.md) | | Other activities | Dictionary | [Dictionaries](https://ulams-dev.github.io/ulams/admin/dictionaries/index.md) | My profile (`/my-profile`) is not in the menu; open it from the avatar menu. Tenants are managed from the command line, not from the panel ([Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md)). ## Why a menu item is hidden Every route in `routes.ts` has an `access` key, a named rule defined in [`admin/src/access.ts`](https://github.com/ulams-dev/ulams/blob/main/admin/src/access.ts). A route whose rule is false is removed from the menu, and opening its URL directly shows the 403 page. A rule combines up to three checks: 1. **Permissions.** Almost every rule requires `access dashboard` plus at least one of the listed permissions. For example the Users group appears with any of `user_list`, `permission_role_list` or `user-group_list`, and the Configuration group with any of `file_list`, `settings_list`, `template_read` or `translation_list`. The permissions come from your roles; see [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md). 2. **Installed packages.** Some screens also need an API package to be installed, read from `GET /api/core/packages` (for example Translations needs `ulams/translations`, Dictionary needs `ulams/dictionaries`, H5P needs `ulams/h5p`). The Teacher and Competency challenges screens depend on packages that are not part of this repository. 3. **Settings.** An administrator can hide items for everyone with boolean `global` settings named after the route: `hideInMenu-CoursesCategories`, `hideInMenu-OtherDictionary`, `hideInMenu-ConfigurationTranslations` and so on. Some features have their own switch: `disable-ECommerce` hides Sales, `disable-Certificates` hides the PDF templates tab. If such a setting holds an array of role names instead of a boolean, the item is hidden only for users whose every role is in the array. See [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md). > **Caution:** These rules only hide screens. The API checks permissions again on every request through its > policies, so hiding a menu item is not access control by itself, and granting a permission > without the matching menu rule still lets the account call the API. ## Pages in this section - [Users](https://ulams-dev.github.io/ulams/admin/users/index.md): User list, accounts, CSV import and export, extra user fields. - [User groups](https://ulams-dev.github.io/ulams/admin/user-groups/index.md): Nested groups, registration groups and members. - [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md): Roles, the permission matrix and how it maps to the menu. - [My profile](https://ulams-dev.github.io/ulams/admin/my-profile/index.md): Your own name, avatar, password and user settings. - [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md): Global settings, custom settings, package configuration, theme and accent. - [Categories and tags](https://ulams-dev.github.io/ulams/admin/categories-and-tags/index.md): The category tree and free-form tags. - [Pages](https://ulams-dev.github.io/ulams/admin/pages/index.md): Static pages such as terms of service. - [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md): Email, PDF and SMS templates bound to events. - [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md): Event notifications and bulk push messages. - [Translations](https://ulams-dev.github.io/ulams/admin/translations/index.md): API and admin panel translation overrides. - [Dictionaries](https://ulams-dev.github.io/ulams/admin/dictionaries/index.md): Glossaries of words with descriptions and CSV import. - [Files](https://ulams-dev.github.io/ulams/admin/files/index.md): The file library and upload folders. - [Other integrations](https://ulams-dev.github.io/ulams/admin/other-integrations/index.md): MailerLite and Mattermost, configured through settings. The other pages of this section cover [sales](https://ulams-dev.github.io/ulams/admin/sales/index.md), [webinars](https://ulams-dev.github.io/ulams/admin/webinars/index.md), [consultations](https://ulams-dev.github.io/ulams/admin/consultations/index.md), [stationary events](https://ulams-dev.github.io/ulams/admin/stationary-events/index.md), [tasks](https://ulams-dev.github.io/ulams/admin/tasks/index.md), [questionnaires](https://ulams-dev.github.io/ulams/admin/questionnaires/index.md), [reports and analytics](https://ulams-dev.github.io/ulams/admin/reports-and-analytics/index.md), [H5P libraries](https://ulams-dev.github.io/ulams/admin/h5p-libraries/index.md), [LTI](https://ulams-dev.github.io/ulams/admin/lti/index.md), [teacher and competency screens](https://ulams-dev.github.io/ulams/admin/teacher-and-competencies/index.md), [tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md) and [demo mode](https://ulams-dev.github.io/ulams/admin/demo-mode/index.md). --- # API tokens > Create, list and revoke scoped API tokens for the ulams CLI, agents and CI, and read what each token did in the agent audit log. Canonical page: https://ulams-dev.github.io/ulams/admin/api-tokens/ API tokens let the `ulams` CLI, AI agents, CI jobs and integrations call the API without a password. Each token belongs to one user, carries **scopes** that narrow what it may do, expires, and can be revoked at any time. A token never gives more than its owner's own roles allow: a student's token with the `*` scope is still a student's token. The **Users > API tokens** screen (`/users/tokens`, permission `token_manage`, given to the admin role) lists the tokens of every user of the tenant: | Column | Meaning | |---|---| | Name, user | What the owner called it, and whose it is | | Kind | `cli`, `agent`, `ci` or `integration`, plus the agent's name when it gave one | | Scopes | `:read` or `:write` (write includes read), or `*` | | Created via | `admin` (this screen or the API), `cli` or `device` (browser sign-in of the CLI) | | Expires | The expiry date | | Last used | Updated at most once a minute, with the last IP in the audit view | | Status | active, expired or revoked | ## Create a token Choose **New**, name it after where it will live ("ulams-cli on Anna's laptop", "GitHub Actions"), pick scopes (the presets `@author`, `@ci`, `@read-only`, `@learner`, `@admin` expand to a list) and an expiry (1 to 365 days; default 90). The token is created for **your own account** and shown once. Copy it into a secret manager: it starts with `ulams_pat_` so that secret scanners can recognise it, and it cannot be shown again, only revoked. > **Caution:** Give agents the narrowest scopes that work. `@read-only` cannot change anything; `@author` can > edit courses and use the AI Course Builder but cannot touch users, settings, orders or tokens. ## Revoke a token **Revoke** stops the token immediately. Anyone can revoke their own tokens through the API (`DELETE /api/auth/tokens/{id}`); admins can revoke any token here. ## Audit log **Audit** shows what a token did: every request that changed something, and every read of the users and reports areas (personal data), with time, method, path, status, client (`cli`, `mcp`), IP and idempotency key. Request and response bodies are never stored. The whole tenant's log is available at `GET /api/admin/agent-audit` (filters `token_id`, `user_id`, `from`, `to`). Rows are deleted after 365 days (`AUTH_AGENT_AUDIT_DAYS`). Learners and other users manage their own tokens from [My tokens on the account page](https://ulams-dev.github.io/ulams/learners/account/index.md#my-tokens) of the reference frontend, without the admin panel. For the scope list, the API and the CLI flow see [Scoped API tokens](https://ulams-dev.github.io/ulams/developers/scoped-tokens/index.md). --- # Connect a BI tool > Read a saved report from Excel, Power BI or Tableau through a read-only OData feed with a token limited to that one report, and from Looker Studio, Metabase or Superset with the CSV and JSON lines recipes. Canonical page: https://ulams-dev.github.io/ulams/admin/bi-connectors/ A [saved report](https://ulams-dev.github.io/ulams/admin/report-builder/index.md) can be offered to a BI tool as a **read-only OData v4 feed**. The tool asks the platform, with a credential that can read that one report and nothing else, and the platform runs the report the way it runs every report: with the permissions of the token's user, small groups withheld, every read logged. The tenant database is never opened to the network. > **Caution:** The feed and the steps below were built to the OData v4 standard and tested against that standard in the platform's own > tests (protocol, paging, authentication, limits). They were **not** run in Excel, Power BI Desktop or Tableau in the > automated checks, which cannot start those programs. Check one report in your tool before you rely on it, and tell us what > differs. ## Set it up 1. **Save the report** in Analytics > Report builder (or through the API) and note its id (26 characters). 2. **Turn its feed on.** Only an administrator who manages reports (`reporting_manage`) can: `PUT /api/admin/reporting/saved/{id}` with `{"feed_enabled": true}`. The answer gives the feed address, for example `https://academy.example.com/api/reporting/odata/`, and the name of the entity set, `Report_`. 3. **Create a token for the tool**, limited to this report, with the `reports:read` scope: ```bash ulams tokens create --name "Power BI, overdue by course" --scopes reports:read --kind integration \\ --resource-ids '[""]' --expires-in-days 365 --json ``` The secret (`ulams_pat_…`) is shown once. A token limited to a report can read that report's feed and run that report through the API (`GET /api/admin/reporting/saved/{id}/run?format=csv|jsonl|xlsx`); every other endpoint answers `403` with the error `resource_limited`. A credential that leaks from a dashboard therefore reads one report, not the platform. Revoke it in Settings > Access tokens (or `ulams tokens revoke`) at any time. The token belongs to the user who created it, so the report runs with **that user's** permissions and scope: if that person loses access to the dataset, the feed stops answering `403`. Create tokens for the person whose view the dashboard should show. ## Excel (Windows and Mac) 1. Data > Get Data > From Other Sources > **From OData Feed** (on older versions: Data > From Other Sources > From OData Feed). 2. URL: the feed address, `https://academy.example.com/api/reporting/odata/`. 3. When asked for credentials choose **Basic**: User name anything (it is ignored), **Password the token** (`ulams_pat_…`). Excel sends the password as the credential; the platform accepts it as the token. 4. Pick the table `Report_` in the Navigator and Load (or Transform Data to rename columns). Data > Refresh All reads the report again. ## Power BI Desktop 1. Home > Get data > **OData feed**; URL as above; choose OData version 4 if the dialog asks (the feed is v4 only). 2. Credentials: **Basic**, user name anything, password the token. Set the privacy level of the source as your organisation requires. 3. Select the `Report_` table. The metadata document declares that `$filter`, `$orderby` and `$expand` are not supported, so Power BI does not send them; filter in the saved report instead. 4. In the Power BI service, set the same Basic credentials for the dataset and a refresh schedule. The feed answers at most 60 requests a minute per token and 5 000 rows a page; Power BI follows the paging links by itself. ## Tableau Connect > More > **OData** (Tableau Desktop), server URL as above, authentication **Username and Password**: any user name and the token as the password. Tableau builds an extract or a live connection on `Report_`. ## What the feed does and does not do | | | |---|---| | Read only | `GET` only. Nothing in the feed can change data. | | Query options | `$select`, `$top`, `$skip`, `$count=true` and `$format=json`. `$filter`, `$orderby`, `$apply`, `$expand`, `$search` answer **501** with an OData error: the saved report already is the filter, the grouping and the order. A tool that ignored your filter and showed wrong numbers would be worse than an error. | | Rows | Typed columns (text, whole number, decimal, true/false, date, date and time) and a `RowNumber` key. A grouped report has a `Withheld` column. | | Small groups | Groups of fewer learners than the threshold (10 by default) arrive as one row with `Withheld = true` and empty figures, exactly as in the admin screen. | | Paging | 5 000 rows a page with `@odata.nextLink`. A report is capped at 1 000 000 rows. | | Rate | 60 requests a minute per token (`429` after that). | | Audit | Every request with a token is in the token's audit log; every read of rows is also an export of channel `feed` in the compliance export log, with the report and the user. | ## Looker Studio, Metabase and Superset These three have no OData connector. They read the **CSV or JSON lines** of the same saved report, which any HTTP client can fetch with the same limited token: ```bash curl -H "Authorization: Bearer ulams_pat_…" \\ "https://academy.example.com/api/admin/reporting/saved//run?format=csv" -o report.csv ``` These are recipes written from the tools' documentation. They are not run in the platform's checks. **Looker Studio.** Looker Studio cannot send an authorisation header to a URL, so put a Google Sheet in between. In the sheet, Extensions > Apps Script, store the token under Project Settings > Script properties as `ULAMS_TOKEN`, and run this on a time trigger: ```javascript function refresh() { const response = UrlFetchApp.fetch('https://academy.example.com/api/admin/reporting/saved//run?format=csv', { headers: { Authorization: 'Bearer ' + PropertiesService.getScriptProperties().getProperty('ULAMS_TOKEN') }, }); const rows = Utilities.parseCsv(response.getContentText().replace(/^\\uFEFF/, '')); const sheet = SpreadsheetApp.getActive().getSheetByName('report'); sheet.clear(); sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows); } ``` Then add the Google Sheets connector in Looker Studio and choose the `report` tab. The sheet is a copy of the report on a Google account: share it as you would the report itself. **Metabase.** Load the CSV into a table that Metabase reads, on a schedule (cron, a CI job), for example into PostgreSQL: ```bash curl -fsS -H "Authorization: Bearer $ULAMS_TOKEN" "$REPORT_URL" \\ | psql "$REPORTING_DB" -c "\\copy overdue_by_course FROM STDIN WITH (FORMAT csv, HEADER true, ENCODING 'UTF8')" ``` Create the table first with the report's columns (the `ulams reporting datasets` and the saved report's definition list them), and truncate it in the same job. Add that database to Metabase as a data source. **Superset.** Use the same load into a reporting database and add it as a database in Superset. Where DuckDB is already part of your Superset, `read_csv` on the URL works if your DuckDB version can send an `Authorization` header with the request; check its HTTP secrets documentation, since that feature differs between versions. For all three, an XLSX or CSV file e-mailed on a [schedule](https://ulams-dev.github.io/ulams/admin/report-builder/index.md#schedule-a-saved-report) is the zero-setup alternative. ## What is not offered, and why - **A database login for BI tools** (read-only Postgres views). It would open every tenant database to the network, bypass the small-group protection and the scope of each viewer, and tie your reports to our internal tables. - **Parquet.** It needs a new library for little gain over the feed and the CSV recipes; it can follow if a customer needs it. --- # Categories and tags > Build the category tree used to classify courses, events and users, and understand how free-form tags are added and suggested. Canonical page: https://ulams-dev.github.io/ulams/admin/categories-and-tags/ Two ways to classify content exist side by side: - **Categories** are a managed tree. An administrator creates them on one screen, and other forms only pick from the tree. Package [categories](https://ulams-dev.github.io/ulams/reference/packages/categories/index.md). - **Tags** are free text typed directly on a course, webinar or product. There is no screen to manage them. Package [tags](https://ulams-dev.github.io/ulams/reference/packages/tags/index.md). ## Categories **Courses → Categories** (`/courses/categories`) needs the `category_list` permission and is hidden when the `hideInMenu-CoursesCategories` setting is on. Creating, editing and deleting need `category_create`, `category_update` and `category_delete`. *Screenshot: The category list with filters and the Show tree button* The table shows ID, name, the full name with its parents, the slug, **Active** and the parent category, with filters by name and status. **Show tree** displays the whole hierarchy. ### Creating a category 1. Click **New**. 2. Enter the **Name**. The **Slug** is generated by the API from the name and cannot be edited. 3. Optionally add a **Description** and an **Order** (the sort position among siblings). 4. Turn on **Active**. Inactive categories are kept but frontends do not offer them. 5. Pick a **Parent category** to make it a subcategory, or leave it empty for a top-level category. 6. Click **OK**. 7. To add an **icon**, edit the category again: the upload only works for a saved category. The file goes to the `categories/{id}` folder of the [file library](https://ulams-dev.github.io/ulams/admin/files/index.md). A category cannot be deleted while it has subcategories or is used by a course; the API returns an error. ### Where categories are used - Courses, webinars, consultations and stationary events select categories in their forms ([Content creators](https://ulams-dev.github.io/ulams/creators/index.md), [Webinars](https://ulams-dev.github.io/ulams/admin/webinars/index.md)). - A user's **Categories** tab stores the user's interests, for example a tutor's field ([Users](https://ulams-dev.github.io/ulams/admin/users/index.md#categories-categories)). - Dictionary words can be assigned to categories ([Dictionaries](https://ulams-dev.github.io/ulams/admin/dictionaries/index.md)). - The public endpoints `GET /api/categories` and `GET /api/categories/tree` let frontends build filters. ## Tags Course, webinar and product forms have a **Tags** field. Type a word or phrase and press **Enter** to add it; the field suggests tags already used anywhere on the platform (`GET /api/tags/unique`). Tags are saved with the item, so a tag exists for as long as some item uses it. The public endpoints `GET /api/tags` and `GET /api/tags/unique` let frontends list items by tag. The admin endpoints under `/api/admin/tags` require a signed-in user: listing needs `tags_list`, creating `tags_create` and deleting `tags_delete` (admins and tutors have all three). Installs that predate `tags_list` get it by re-running `TagsPermissionSeeder`. --- # Certificates > Issue certificates that expire, let anyone verify one from its QR code, and revoke a certificate that is no longer valid. Canonical page: https://ulams-dev.github.io/ulams/admin/certificates/ A learner who finishes a course receives a PDF certificate (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md) for how the design is edited). Every certificate carries a random certificate ID and a QR code that opens a public **verification page**, so an employer or auditor can check a printed copy. ## Verification page `/certificates/verify/` on the academy's learner site shows, without any login: - the status, written out as text: **valid**, **expired** or **revoked**; - the course, the holder's name, the issue date, the expiry date and the issuing academy. Nothing else about the learner is shown. An unknown ID answers "No certificate found". The page is not indexed by search engines and is not cached. The API behind it, `GET /api/certificates/verify/{certificateId}`, is public and throttled (60 requests a minute per client by default). The default certificate template encodes `@VarCertificateVerifyUrl` as its QR code. The URL is built from the academy's learner site (the **Front URL** in the global settings) and falls back to the API host when that is not set. `PDF_CERTIFICATE_VERIFY_URL` overrides the pattern (`{FRONTEND_URL}`, `{APP_URL}` and `{id}`). ## Expiry A certificate can expire. Without any other setting, certificates never expire. Set `PDF_CERTIFICATE_VALIDITY_DAYS` (for example `365`) to give every new certificate that many days of validity. The expiry date is stored on the certificate when it is issued and is available to templates as `@VarCertificateExpiresAt` (empty when the certificate does not expire). The compliance module ([Phase 6 plan](https://github.com/ulams-dev/ulams/blob/main/docs/plans/phase-6-compliance.md)) adds a validity per course; see [Compliance](https://ulams-dev.github.io/ulams/admin/compliance/index.md). ## Revoking a certificate An administrator with the `fabricjs_pdf_revoke` permission revokes a certificate with a reason (`POST /api/admin/pdfs/{id}/revoke`). A revoked certificate is not deleted: verification keeps answering, now with the status **revoked**, so a printed copy always shows its true state. Revoking twice keeps the first reason. > **Note:** `PDF_CERTIFICATE_VERIFY_NAME` controls the holder name on the verification page: `full` (default), > `initials` or `none`. ## API fields Certificates in `GET /api/pdfs` and `GET /api/pdfs/{id}` carry `status`, `expires_at`, `revoked_at` and `course_version` (the course's last update at the time of issue). --- # Compliance and required training > Make a course mandatory with a due date, let certificates expire and renew themselves, and have overdue training escalated to a manager. Canonical page: https://ulams-dev.github.io/ulams/admin/compliance/ The compliance module turns a course into **required training**: a person is assigned the course with a due date, is reminded, and, when they are late, their manager is told. Certificates can expire and the course is offered again before they do. Everything is available through the API (`/api/admin/compliance`, permission `compliance_manage`); there is no admin screen yet. > **Note:** This page describes the API. The certificate side (verification page, revocation) is in [Certificates](https://ulams-dev.github.io/ulams/admin/certificates/index.md). ## Course settings `PUT /api/admin/compliance/courses/{course}/settings`: | Field | Meaning | |---|---| | `mandatory` | Marks the course as required training. | | `validity_days` | How long a new certificate stays valid. Empty: it never expires. | | `recertify_before_days` | Start recertification this many days before the certificate expires. Default 30; `0` turns it off. | | `default_due_days` | Due date for assignments created without one. | | `reminder_days` | Days before a due date or expiry on which a reminder is sent. Default 30, 7, 1. | | `escalation_days` | Days after the due date on which the manager is told. Default 1, 7. | Only courses with saved settings are recertified. Certificates already issued keep the expiry they were issued with. ## Assigning training `POST /api/admin/compliance/assignments` with `course_id`, `user_ids` and an optional `due_at`: - The person gets access to the course and the due date becomes their course deadline, so the existing deadline reminder and their course list stay in step. - Assigning again does not create a second assignment; a new, earlier due date is used. - A person who already holds a valid certificate for the course is marked completed at once. - If their certificate expired, their progress in the course is cleared so they can take it again. - The assignment closes when the person finishes the course and is linked to the certificate that was issued. - `DELETE /api/admin/compliance/assignments/{id}` cancels an open assignment. Learners read their own list at `GET /api/compliance/my-assignments`. A manager reads their direct reports at `GET /api/compliance/team/assignments`. ## Managers Escalations go to the manager linked to the person: `PUT /api/admin/compliance/managers/{user}` with `{"manager_id": 12}` (or `null` to clear). Until an HRIS import exists, links are kept here. Without a manager an escalation waits and is sent after one is linked. ## What is sent and when `php artisan compliance:process` runs every day at 06:00 (scheduler) and does, in this order: 1. Opens a recertification assignment, due on the expiry date, for each certificate inside its recertification window. 2. Sends **certificate expiring** reminders, **certificate expired** notices (up to 7 days after expiry). 3. Sends **training due soon**, **training overdue** and, to the manager, **training escalated**. Each notice is recorded once, so running the command again, or late, never repeats one. If several reminder days have passed, only the most urgent is sent. The e-mails are editable under **Configuration → Templates** like any other e-mail template. Finishing a required course sends one more notice, **training completed**, to the learner, with a link to their training record (the certificate's verification page once it is linked to the assignment). When the course is marked mandatory and the learner has a manager, the manager gets **training completed (manager)** as well. Both are sent once per assignment. A course that was already covered by a valid certificate when it was assigned is completed without a notice, because nothing was finished. ### Language and the learning-path sentence Every notice picks its template by language: the language of the course, then the academy's default language, then English, then a template without a language. The path notices (enrolled, completed) have no course, so they use the academy's default language. The default texts are written in English and Polish (other languages show the English text until they are translated); a template you have edited is never replaced. Notices about a course that is a step of the learner's learning path carry the path. The variables are `@VarPathTitle`, `@VarStepNumber`, `@VarStepCount`, `@VarNextStep` (the next course still to do, empty on the last step) and `@VarPathContext`, a ready sentence in the language of the course ("Step 2 of 4 of the learning path "Onboarding" is now open." on the e-mail of an unlocked step, "This course is step 2 of 4 of the learning path ..." on the others). Outside a path they are empty. They are available in the assigned, due soon, overdue, escalated and completed e-mails; the default texts of a new academy already contain `@VarPathContext`. Templates that were saved earlier keep their text: add `@VarPathContext` to them where you want it. The same events are available to other systems as [webhooks](https://ulams-dev.github.io/ulams/developers/outgoing-webhooks/index.md): `training.assigned`, `training.completed`, `training.overdue`, `path.completed` and `certificate.revoked`. ## Learning paths A learning path is an ordered set of courses with prerequisites: `POST /api/admin/compliance/paths` with a title and `steps` (`course_id` and the `prerequisites`, course ids of the same path). A path cannot list a course twice, name a prerequisite outside the path or contain a cycle. Enrolling people (`POST /api/admin/compliance/paths/{id}/enrollments`, with an optional `due_at`) assigns the courses that can be started. Each time a learner finishes a course, the courses it unlocks are assigned, with the same due date, so the usual reminders, overdue notices and manager escalation apply to every step. When the last course is finished the path is complete. Learners see their paths and each step as `done`, `available` or `locked` at `GET /api/compliance/my-paths`. A learner is enrolled in a path once; courses they have already finished (with a valid certificate) are not assigned again. ## Enrolment rules A rule enrols everyone whose attributes match into a path, due in N days: `POST /api/admin/compliance/rules` with `name`, `path_id`, `due_days` and `conditions`, for example department equals Finance: ```json {"name": "Finance onboarding", "path_id": 3, "due_days": 30, "conditions": [{"attribute": "department", "operator": "equals", "value": ["Finance"]}]} ``` | Attribute | What it reads | |---|---| | `group` | The names of the user's groups. | | a user column or custom field | e.g. `email`, or a field you added in Configuration (department, role, location). | Operators: `equals`, `not_equals`, `in`, `contains`, `starts_with`, `ends_with`, `exists`. Comparisons ignore case and every condition of a rule must hold. Rules are checked whenever a user is created or changed and once a day (which also catches new group members). `POST /api/admin/compliance/rules/{id}/evaluate` shows who a rule would enrol (`dry_run`, the default) or enrols them now. ## Competencies and skill profiles `/api/admin/compliance/competencies` holds the competency framework: a tree of areas and skills (`name`, optional `code`, `parent_id`). Administrators change it; authors can read it. Courses are tagged with competencies: - An author (or administrator) tags a course directly: `PUT /api/admin/compliance/courses/{course}/competencies/{competency}`. - `POST .../competencies/suggest` asks the AI which competencies the course teaches. It returns **suggestions**, each with a one-line reason and the lessons that teach it. Nothing is tagged until the author confirms a suggestion with the same `PUT`; `DELETE` rejects it. Suggestions never count towards anyone's skills. Each call is logged with model, tokens and cost like every other AI call, and the course text is treated as data, never as instructions. A learner's **skill profile** (`GET /api/compliance/my-skills`) lists the confirmed competencies of the courses they have done, with the courses that prove them, when they were earned and when they lapse (an expired or revoked certificate removes the skill). Administrators read anyone's profile at `/api/admin/compliance/users/{user}/skills`. Enrolment rules can use it: the attribute `competency` with `not_equals` and a competency name enrols everyone who lacks that skill. ## Reports and audit export `GET /api/admin/compliance/report?dataset=...` (permission `compliance_report`) returns a paginated table; the same URL under `/report/export` downloads every matching row as CSV (or JSON lines with `format=jsonl`). | Dataset | Answers | |---|---| | `assignments` | Who had to do which course, by when, whether they did (and when), days overdue, escalation level, and the certificate with its status, expiry and course version. | | `certificates` | Every certificate: holder, issue and expiry date, valid, expired or revoked, revocation reason, course version. | | `audit` | The tamper-evident Living Course audit entries (course versions, who changed what), when Living Course is installed. | Filters: `course_id`, `user_id`, `status` (assignments: assigned, overdue, completed, cancelled; certificates: valid, expired, revoked), `from` and `to` (assigned or issued dates). Every export is recorded with who ran it, the dataset, the filters and the number of rows. In CSV, text that a spreadsheet could read as a formula is prefixed with an apostrophe. ## Dashboard `GET /api/admin/compliance/dashboard` (permission `compliance_report`, optional `course_id`) returns the numbers a dashboard needs: open, overdue and completed assignments, the completion rate and average days to complete, certificates that are valid, expiring within 30 or 90 days, expired or revoked, and the same per course with the most overdue course first. Struggle and recovery rates from Learner Insights are not included yet. ## Scheduled reports and BI tools `POST /api/admin/compliance/schedules` sets up a report that is e-mailed as an attachment every day, week or month at 06:00: `name`, `dataset`, `frequency`, optional `format` (`csv` or `jsonl`) and `filters`, and `recipient_ids`. Recipients are users of this academy, never free-text addresses. A failing schedule is skipped and tried again at its next time. A schedule can also send a **saved report** of the [report builder](https://ulams-dev.github.io/ulams/admin/report-builder/index.md#schedule-a-saved-report): give `saved_report_id` instead of `dataset`. BI tools can read the same data through the API: create a scoped access token with the `reports:read` scope and call `/api/admin/compliance/report` (paginated JSON) or `/report/export` (CSV or JSON lines). The report and the schedules are in the `reports` token area, the rest of the compliance API is under `certificates`. The datasets behind the report are listed by the [report builder](https://ulams-dev.github.io/ulams/admin/report-builder/index.md). --- # Consultations > Sell one-to-one consultations with proposed terms, approve or move booked terms, and handle free consultation access requests. Canonical page: https://ulams-dev.github.io/ulams/admin/consultations/ A consultation is a one-to-one (or small group) session with a tutor. The author defines the consultation, its duration and the terms they propose. A learner who has access to it (usually by buying its product) reports a term; a tutor approves or rejects it; at the approved time both join a Jitsi room. Two packages are involved: | Package | Role | |---|---| | `consultations` | Consultations, proposed terms, booked terms, the approve/reject/change flow, reminders | | `consultation-access` | Requests for **free** access: a learner asks for a consultation with proposed dates, an administrator approves one date or rejects the request | ## Who uses it - **Administrators** create consultations and review consultation requests. - **Tutors** (author or teachers of a consultation) approve, reject, move and finish terms. With the default roles they have only the `-own` permissions, so the admin menu entry, which needs `consultation_list`, is hidden for them; they work through the API or a front. - **Learners** buy consultations, report terms and send consultation requests. ## Screens ### Consultation list `/other/consultations` (Other activities → Consultations). Columns: ID, name, status, product, duration, active from, active to and category; filters by date range, name and category. A second tab, **Fields** (`/other/consultations/fields`), manages extra model fields for consultations. *Screenshot: Consultation list in the admin panel* ### Consultation form `/other/consultations/:consultation/:tab` (`new` to create). Tabs: | Tab | Content | |---|---| | Attributes | Name, duration, status (`draft`, `published`, `archived`), active from and to, author, teachers, maximum students per session (`max_session_students`), the "AI Recording Analysis" switch, description, proposed terms, and any extra fields | | Product | Price and sale settings (see [Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md)) | | Media | Cover image | | Categories | Categories | | Branding | Logotype shown in the Jitsi room | | User submission | Assign users by e-mail, including people without an account yet | | Calendar | Booked terms on a calendar; a term can be moved to another date | *Screenshot: Consultation form with the Calendar tab* ### Consultation requests `/other/consultation-access` (Other activities → Consultation Requests). One row per request: description, user, consultation, the proposed dates, meeting link, created date and status (`pending` or `approved`). - **Approve** a proposed date. Choose the meeting type: - *Custom*: paste a meeting link; - *Jitsi*: the admin panel generates a public `https://meet.jit.si/` link; - *Pencil Spaces* (only when the package is installed): no link is sent, and the API queues `CreatePencilSpaceJob`, which creates a Pencil Space for the author and the learner and stores its link. - **Disapprove** with an optional reason. The request is deleted and the learner is notified. Approving fails if the request is already approved or if the date is already full (`max_session_students`). The menu entry can be hidden with the setting `hideInMenu-OtherConsultation-access`. *Screenshot: Consultation requests list with Approve and Disapprove actions* ## Term lifecycle 1. The learner gets access (product purchase or user submission). A booked consultation row is created for them. 2. The learner reports a term: `POST /api/consultations/report-term/{id}`. It fails with 400 if the term already has `max_session_students` bookings. Status becomes `reported`. If the product is a bundle, the term is approved automatically (`App\Listeners\UpdateReportTermListener`). 3. A tutor approves (`approved`) or rejects (`reject`) it. 4. A tutor or administrator with `consultation_change_term` can move the term (admin calendar or `POST .../change-term/{id}`). 5. From the start time until start + duration, `GET /api/consultations/generate-jitsi/{id}` returns the room data. Learners need an approved term; tutors need at least one approved term at that time. The room uses the [Jitsi configuration](https://ulams-dev.github.io/ulams/admin/webinars/index.md#video-conference-configuration-jitsi). 6. A tutor marks the session finished with `POST /api/consultations/finish-term/{id}`. ## API endpoints | Method and path | Purpose | |---|---| | `GET/POST /api/admin/consultations`, `GET/PUT/DELETE /api/admin/consultations/{id}`, `POST /api/admin/consultations/{id}` | Admin CRUD | | `GET /api/admin/consultations/{id}/schedule` | Booked terms (admin calendar) | | `POST /api/admin/consultations/change-term/{termId}` | Move a term | | `GET /api/admin/consultations/users/assignable` | Users that can be author or teacher | | `GET /api/consultations`, `GET /api/consultations/{id}` | Public list and detail | | `GET /api/consultations/me`, `GET /api/consultations/my-schedule` | Learner's consultations, tutor's schedule | | `POST /api/consultations/report-term/{id}`, `GET .../proposed-terms/{id}` | Book a term | | `GET .../approve-term/{id}`, `GET .../reject-term/{id}`, `POST .../change-term/{id}`, `POST .../finish-term/{id}` | Tutor actions | | `GET /api/consultations/generate-jitsi/{id}` | Room data | | `GET /api/admin/consultation-access-enquiries`, `POST .../approve/{proposedTermId}`, `POST .../disapprove/{id}` | Admin review of requests | | `GET/POST /api/consultation-access-enquiries`, `GET/PATCH/DELETE .../{id}`, `GET .../{id}/join` | Learner's own requests; `join` returns the meeting link (a Pencil Spaces direct-login link for Pencil Spaces rooms) | Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions | Permission | admin | tutor | student | |---|---|---|---| | `consultation_list`, `consultation_read`, `consultation_update`, `consultation_delete` | yes | no | no | | `consultation_list-own`, `consultation_read-own`, `consultation_update-own`, `consultation_delete-own` | no | yes | no | | `consultation_create`, `consultation_change_term` | yes | yes | no | | `consultation-access_list`, `consultation-access_approve`, `consultation-access_disapprove` | yes | no | no | | `consultation-access_*-own` (create, list, read, update, delete) | yes | no | yes | See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Events and notifications | Event | Recipient | E-mail | SMS | |---|---|---|---| | `ReportTerm` | Author and teachers | yes | yes | | `ApprovedTerm` / `ApprovedTermWithTrainer` | Learner / tutor | yes | yes | | `RejectTerm` / `RejectTermWithTrainer` | Learner / tutor | yes | yes | | `ChangeTerm` | Learner | yes | no | | `ReminderAboutTerm` | Learner, one day and one hour before | yes | yes | | `ReminderTrainerAboutTerm` | Tutor, before the term | yes | yes | | `ConsultationAccessEnquiryAdminCreatedEvent` | Consultation author, on a new request | yes | no | | `ConsultationAccessEnquiryAdminUpdatedEvent` | Consultation author, on an edited request | no | no | | `ConsultationAccessEnquiryApprovedEvent` | Learner | yes | no | | `ConsultationAccessEnquiryDisapprovedEvent` | Learner, with the reason | yes | no | Reminders come from the scheduled job `ReminderAboutConsultationJob`: the one-hour reminder runs every minute and the one-day reminder hourly. See [Scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md), [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md) and [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Settings - Jitsi or JaaS: see [Webinars](https://ulams-dev.github.io/ulams/admin/webinars/index.md#video-conference-configuration-jitsi). - Pencil Spaces: `PENCIL_SPACES_API_URL` and `PENCIL_SPACES_API_KEY`, or the `pencil_spaces.api_url` and `pencil_spaces.api_key` settings in [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md). ## Known limitations - If Pencil Spaces is not configured or its API fails, `CreatePencilSpaceJob` only logs the error: the request stays approved without a meeting link and the learner gets no approval e-mail. - The "Jitsi" option for requests uses the public `meet.jit.si` service, not the configured Jitsi server. - The learner site (`front/web`) lists consultations read-only; booking and requests need the legacy learner app or a custom front. See [Learners](https://ulams-dev.github.io/ulams/learners/index.md). --- # Course Builder settings > Turn the Course Builder on, give tutors access, set upload limits and AI budgets, read the cost log and run the queue and event stream. Canonical page: https://ulams-dev.github.io/ulams/admin/course-builder/ The admin link **Courses → Build with AI** (`/courses/builder`) opens the studio in the web app; the studio itself is described in the [author guide](https://ulams-dev.github.io/ulams/creators/course-builder/index.md). ## Turning it on The builder calls Claude through the official Anthropic SDK. Set in the API environment (`api/.env`, or the tenant's `.env.`): | Variable | Default | Meaning | |---|---|---| | `AI_DRIVER` | `anthropic` | `anthropic`, `fake` (no network: recorded or synthetic answers, for demos and tests) or `disabled` | | `ANTHROPIC_API_KEY` | – | API key. The legacy spelling `ANTROPHIC_API_KEY` is accepted second. Without a key the driver is `disabled` | | `AI_MODEL_DEFAULT` / `AI_MODEL_LIGHT` / `AI_MODEL_PREMIUM` | `claude-sonnet-5-5` / `claude-haiku-5-5` / `claude-opus-5-5` | Models of the three profiles. The premium profile is only used when a task is switched to it | | `AI_TASK__PROFILE` | see below | Switch one task to another profile, e.g. `AI_TASK_OUTLINE_PROFILE=premium` | | `AI_CACHE_TTL` | `1h` | Prompt cache TTL for the source (`5m` or `1h`) | | `AI_TIMEOUT` / `AI_MAX_RETRIES` | `600` / `2` | Seconds per model request and retries of transient HTTP errors | | `ANTHROPIC_BASE_URL` | – | Point the SDK at a proxy or gateway | | `AI_FAKE_MODE` | `synthetic` | With `AI_DRIVER=fake`: `cassette` (replay only) or `synthetic` (replay, else a built-in deterministic answer) | When AI is disabled, every builder endpoint answers 503 with a message and the studio says so; the rest of the LMS works as before. Tasks and their default profiles: interview (light), outline (default), lesson (default), quiz (default), grounding (light), metadata (light), price (light), patch (default) and, for [Living Course](https://ulams-dev.github.io/ulams/admin/living-course/index.md), update (default). The web app needs nothing new. The admin link derives the studio address from the admin host (`coffee.admin.example` → `coffee.app.example`); set `REACT_APP_STUDIO_URL` in the admin's runtime environment when your hosts differ. ## Who can use it The permission `course_builder_use` is given to the **admin** and **tutor** roles. On an existing tenant, run the permissions seeder once after deploying: ```bash php artisan db:seed --class=PermissionsSeeder --force --domain= ``` Sessions are visible to their author and to admins; only the author can act on a session. ## Limits and budgets | Variable | Default | | |---|---|---| | `COURSE_BUILDER_SOURCE_MB` | 20 | Upload size | | `COURSE_BUILDER_PDF_PAGES` | 300 | PDF pages | | `COURSE_BUILDER_SOURCE_TOKENS` | 400000 | Source tokens per session | | `COURSE_BUILDER_SESSION_TOKENS` | 3000000 | Tokens per session (cache reads count 10 %) | | `COURSE_BUILDER_SESSION_COST_USD` | 5 | AI cost per session | | `COURSE_BUILDER_CONCURRENT_RUNS` | 2 | AI runs at once per author | | `COURSE_BUILDER_SESSIONS_PER_DAY` | 10 | New sessions per author per day | | `COURSE_BUILDER_LESSON_CONCURRENCY` | 4 | Lessons generated at once per run | | `COURSE_BUILDER_MAX_VARIANTS` | 6 | Variants of one course by level and role, besides its base; `0` removes the question from the interview. See [course variants](https://ulams-dev.github.io/ulams/creators/course-versions-and-variants/index.md) | | `COURSE_BUILDER_VARIANT_LESSON_USD` | 0.06 | Cost of one lesson assumed in the estimate shown before variants are drafted, until the session has lessons of its own | | `AI_TASK_VARIANT_OUTLINE_PROFILE`, `AI_TASK_VARIANT_LESSON_PROFILE` | `light`, `default` | The profile of the two tasks of course variants: the plan per lesson, and a lesson condensed, deepened or added for one audience | | `AI_LIMIT_TENANT_MONTHLY_USD` | 50 | AI spend per tenant per month (all tasks); `0` turns the cap off | | `COURSE_BUILDER_EVAL_MONTHLY_USD` | 20 | Spend cap of the eval command | | `COURSE_BUILDER_DOCX_UNCOMPRESSED_MB` | 100 | Largest unpacked size of a DOCX (zip-bomb guard) | ### Lesson formats LiaScript, H5P and interactive lessons are offered in the outline only when the installation can create them. Each can be turned off for the whole installation: | Variable | Default | | |---|---|---| | `COURSE_BUILDER_LIASCRIPT` | true | LiaScript lessons with self-checks | | `COURSE_BUILDER_H5P` | true | Lessons with an H5P activity (needs the H5P service and the libraries Blanks, Drag the Words and Dialog Cards) | | `COURSE_BUILDER_INTERACTIVE` | true | Lessons with an interactive from the library (needs at least one package, and the interactive topic type switched on) | | `COURSE_BUILDER_AUTO_FORMATS` | false | The outline gives every lesson with two or more objectives the LiaScript format; authors can still change it | The libraries the builder may use are listed in `config/course_builder.php` (`h5p_libraries`). Install them in the H5P service ([H5P libraries](https://ulams-dev.github.io/ulams/admin/h5p-libraries/index.md)). The extra generation tasks (`selfcheck`, `interaction_h5p`, `interaction_interactive`) use the same models as the other tasks and can be given another profile with `AI_TASK_SELFCHECK_PROFILE`, `AI_TASK_INTERACTION_H5P_PROFILE` and `AI_TASK_INTERACTION_INTERACTIVE_PROFILE`. Before every model call the budget is checked against the session tokens, the session cost and the tenant's month. The first that would be exceeded stops the call: the run fails with `RUN_ERROR` (`code: "budget"`) and a message such as "Budget reached: this course has used $5.00 of its $5.00 AI budget. Ask an admin to raise the limit to continue.", the studio shows the message, and the session is marked `budgetReached`. Nothing already generated is lost; the author retries after you raise the limit. `AI_LIMIT_SUBJECT_TOKENS` and `AI_LIMIT_SUBJECT_COST_USD` (3,000,000 and 5) are the defaults for AI calls that carry no budget of their own; builder sessions always carry one. A run that would start another AI run beyond `COURSE_BUILDER_CONCURRENT_RUNS` is refused with 429, a new session beyond `COURSE_BUILDER_SESSIONS_PER_DAY` too. The [API page](https://ulams-dev.github.io/ulams/developers/course-builder-api/index.md#cost-limits-and-what-happens-at-the-limit) has the exact messages. ## Cost and usage Every model call is logged in the `ai_calls` table of the tenant: task, prompt version, profile, model requested and served, input, output and cache tokens, cost in micro-USD, latency, status and the session. Totals per day and task: ```bash php artisan ai:usage --days=30 --domain= ``` The studio shows the running cost per course; `GET /api/admin/course-builder/sessions/{id}/usage` returns it per task and model. ## Checking a run from a script Every generation, patch or apply is a run. `GET /api/admin/course-builder/runs/{run}` returns its state without opening the event stream, which is what the `ulams` CLI polls for `--wait`: ```json { "id": "01j9z3k8m2x4q7r5t6v8w0y1ab", "sessionId": "01j9z3…", "kind": "generate", "status": "running", "needsAttention": false, "steps": [{ "id": "01j9z4…", "name": "lesson:el_8f2c", "status": "succeeded", "error": null }], "startedAt": "2026-10-09T10:02:11+00:00", "finishedAt": null, "error": null } ``` `status` is one of `queued`, `running`, `succeeded`, `failed`, `cancelled`; step status is one of `queued`, `running`, `succeeded`, `failed`. `needsAttention` is true while a step has failed and the run waits for a retry (`ulams builder runs retry-step`), so a poller stops and asks. Only the session's author and tenant admins can read a run (403 otherwise, 404 for an unknown id). ## Queues and streaming Generation runs in queued jobs on a dedicated connection (`COURSE_BUILDER_QUEUE_CONNECTION`, `COURSE_BUILDER_QUEUE`). With `QUEUE_CONNECTION=database` or `redis` the default is `database-builder` or `redis-builder`, queue `builder`, defined in `api/config/queue.php` with `retry_after` 2400 s (`BUILDER_QUEUE_RETRY_AFTER`), above the 1800 s job timeout. Run a worker for it on each tenant: Horizon (`supervisor-builder`) or `api/workers.sh queue`, which starts `queue:work -builder --queue=builder --timeout=1800` per tenant. Do not point these jobs at a connection with a shorter `retry_after`: a second worker would pick up a step that is still running and the model would be called, and billed, twice. You can run several workers (`queue:work` processes) against the same queue, including the `database` connection: stage changes of a run are serialised on the run row, so a run finishes the same way with one worker or four. The long-job queue (`LONG_JOB_QUEUE_CONNECTION`, `LONG_JOB_QUEUE`; `-long-job`, queue `queue-long-job`, `retry_after` 19000 s) is separate and serves course clone and import. Living Course checks and analysis steps use the builder queue by default (`LIVING_COURSE_QUEUE_CONNECTION`, `LIVING_COURSE_QUEUE`). A run job has one try (`tries = 1`): the SDK already retries transient errors, and a failed step is retried by the author, so a model call is never repeated silently. A step can take minutes; a test (`QueueRetryAfterConfigTest`) keeps `retry_after` above every job timeout. The event stream (`/api/admin/course-builder/sessions/{id}/events`) holds a PHP worker for up to 25 s per open browser tab (`COURSE_BUILDER_SSE_SECONDS`); in production route it to a small separate PHP-FPM pool. Old events are deleted by `php artisan course-builder:prune-events` (30 days, `COURSE_BUILDER_EVENTS_RETENTION_DAYS`); schedule it daily. ## Eval command ```bash php artisan course-builder:eval --fixtures=all --author= # fake driver, free php artisan course-builder:eval --fixtures=coffee,injection --live --author= # real model, costs money php artisan course-builder:eval --fixtures=coffee --live --record --author= # also write cassettes ``` Options: `--fixtures` (`all` or a list of `coffee`, `injection`, `git`, `pdf`, `docx`), `--live`, `--record`, `--author` (default: the first admin), `--patch=1` (one element-chat patch) and `--total-minutes=30`. `--live` needs `ANTHROPIC_API_KEY` and stops at `COURSE_BUILDER_EVAL_MONTHLY_USD` for the month. Details: [LLM layer](https://ulams-dev.github.io/ulams/developers/llm-layer/index.md#eval-command). For the endpoints and the event stream see the [Course Builder API](https://ulams-dev.github.io/ulams/developers/course-builder-api/index.md). ## Data Uploaded sources are stored on a private disk (`COURSE_BUILDER_DISK`, default `storage/app/private`), never in the public bucket. Removing a builder session does not remove a course it created. --- # Demo mode > Turn a throwaway tenant into a public demo with password-less login and an hourly reset of all its data. Canonical page: https://ulams-dev.github.io/ulams/admin/demo-mode/ Demo mode turns a [tenant](https://ulams-dev.github.io/ulams/admin/tenants/index.md) into a public demo that anyone can try without an account. Visitors of the learner site are logged in as the demo student, visitors of the admin panel as the demo admin, and the whole tenant is wiped and seeded again every hour. The six demo tenants of the reference setup, `coffee`, `oncall`, `nightsky`, `gravity`, `poland` and `ulam`, run in demo mode (see [Demos](https://ulams-dev.github.io/ulams/getting-started/demos/index.md)). > **Danger:** Demo mode has no security. Anyone who can reach the API can act as the tenant admin, and all > data of the tenant is deleted every hour. Turn it on only for throwaway demo tenants, never for > a tenant with real data. It never works on the platform. ## Turn it on or off Demo mode is on when the tenant's env file `.env.` contains `DEMO_MODE=true`. The default is off. Set it through the tenant registry, so that `ulams:tenant:sync-env` keeps the value: ```bash php artisan ulams:tenant:create coffee --demo=on # or --demo=off ``` Only the env file is rewritten; no data changes. To turn it on for the six demo tenants at once, run from `api/`: ```bash make demo-mode-on ``` This runs `ulams:tenant:create --demo=on` for all six. `ulams:tenant:list` shows the current state in the `demo` column. When demo mode is off, none of it exists: the demo routes answer 404, `GET /api/config` has no `ulams_demo` key and no reset is scheduled. ## Password-less login | Endpoint | What it does | |---|---| | `GET /api/demo` | Returns `enabled`, `users` (the demo accounts: `role`, `email`, never a password; the tutor only when that account exists), `front_url`, `admin_url` and `reset_cron` (`null` when `DEMO_RESET_SCHEDULE` is off). | | `POST /api/demo/login` with `{"role": "student"}`, `{"role": "tutor"}` or `{"role": "admin"}` | Issues a regular Passport personal access token for that account. The response body is the same as `POST /api/auth/login`. Rate limited to 60 requests a minute. A role whose account cannot be found (for example a tenant without a seeded tutor) answers 422. Any other role value is rejected by validation. | | `GET /api/config` | Gains `ulams_demo: {enabled, front_url, admin_url}`. | Before logging in the student, the API gives the demo student access to every published course (through the course access service), so any course link opens with access. The admin panel and the legacy React learner app read `ulams_demo` from `GET /api/config` at start-up. When nobody is logged in, the admin panel logs in as the demo admin and the learner app as the demo student, and each shows a demo badge that links to the other application. The reference front (`front/web`) calls `POST /api/demo/login` with the `student` role on the server and shares one cached demo token per tenant between visitors. If the tenant has no demo mode (404), it falls back to a password login only when a demo student password is configured for the front. The accounts used: | Role | Account | Override | |---|---|---| | admin | `INITIAL_USER_EMAIL`, by default `admin@.ulams.app` | `DEMO_ADMIN_EMAIL` | | student | `student1@` at the admin's e-mail domain | `DEMO_STUDENT_EMAIL` | | tutor | `tutor@` at the admin's e-mail domain (the course author in the studio) | `DEMO_TUTOR_EMAIL` | If the account does not exist, the first user with that role is used. ## Hourly reset The package schedules `ulams:demo:reset --force --domain=` on every domain whose env has `DEMO_MODE=true`, by default at the start of every hour (`DEMO_RESET_CRON`, `0 * * * *`). The container scheduler already runs `schedule:run` for every tenant, so nothing else needs to be set up. The reset runs in the background and never overlaps with itself (`withoutOverlapping`, with a 120-minute lock in the cache store). To reset a tenant now: ```bash php artisan ulams:demo:reset --force --domain=coffee.localhost make demo-reset DOMAIN=coffee.localhost ``` | Option | Meaning | |---|---| | `--force` | Do not ask for confirmation. | | `--wipe-files` | Also delete every file in the tenant bucket (same as `DEMO_RESET_WIPE_FILES=true`). By default uploads stay, and the demo assets are uploaded again at the same paths. | | `--recapture` | Take a new baseline (name, theme, accent, students) from the current database before wiping. | The command refuses to run when demo mode is off on that domain, and always refuses on the platform. ### What the reset does 1. **H5P content.** Deletes the tenant's H5P contents in the H5P service (`DELETE /h5p/contents/{id}` for every content id the tenant database knows, from `h5p.contents` and from H5P topics), then the files of contents that no longer have a row (`POST /h5p/contents/orphans/delete`). The service stores H5P content outside the main tenant schema, so `migrate:fresh` alone would leave it behind. If the service cannot be reached, the reset continues with a warning and the next reset deletes them. 2. **Database.** `migrate:fresh --force` on the whole tenant database, including the OAuth tables. Every token issued so far stops working; the admin panel and the front log in again by themselves. 3. **Passport client.** Creates the personal access client again. 4. **Roles and admin.** Seeds roles, permissions and the admin account. 5. **LTI keys.** `ulams:lti:rotate-keys --init` creates the tenant's LTI key set again (it lives in the wiped database). Skipped when the LTI package is not installed. 6. **Users and settings.** Creates the tutor and the students and stores the name, theme and accent from the baseline. 7. **Demo content.** `ulams:demo:seed`: seeds the demo courses for the tenant's experience (by default the tenant slug) and gives the demo student access to every published course. The tenant's Redis cache keys are deleted after the database wipe and again at the end. The shared Redis cache is not flushed, so other tenants are not affected. Each step runs as a child `php artisan … --domain=` process. **Baseline.** Name, theme, accent, front URL, number of students and e-mail domain are stored in the database being wiped. The first reset saves them to `storage//app/ulams-demo-baseline.json` (for example `storage/coffee_localhost/app/ulams-demo-baseline.json`), and later resets reuse that file. A theme change made in the demo admin therefore does not survive the next reset. Use `--recapture`, or change the tenant with `ulams:tenant:create`, to keep a change. ### Seed without a reset ```bash php artisan ulams:demo:seed --domain=coffee.localhost php artisan ulams:demo:seed --skip-content --domain=coffee.localhost ``` `--experience=` picks the demo content (`coffee`, `oncall`, `nightsky`, `gravity`, `poland`, `ulam` or `all`; default `ULAMS_DEMO_EXPERIENCE`, then the tenant slug). `--skip-content` only grants the demo student access to the published courses, for example after courses were created by hand. ### The gravity, poland and ulam packages The `gravity`, `poland` and `ulam` experiences play interactive packages from `demo-content/`, which the API container cannot see (it mounts only `api/`). `make -C api demo-packages` builds them on the host (Chromium is needed for the gravity posters) and puts `gravity.zip`, `poland.zip` and the five `ulam-*.zip` (`ulam-spiral`, `ulam-monte-carlo`, `ulam-automaton`, `ulam-scottish-book`, `ulam-lwow-map`) in `api/database/seeds/Demo/assets/cache/interactive/`, where the seeder reads them. A missing zip stops the seeding with a message that names it, instead of leaving the courses without their lessons. On a server, build the zips once and copy them to that folder. The ulam course also reads four photographs from `api/database/seeds/Demo/assets/ulam/images/` (committed, so nothing is fetched at seed time). Re-seeding with the same zip reuses the package; a changed zip becomes a new version of it. ## Configuration Set these in the tenant env file. Defaults are in [`api/packages/demo/src/config.php`](https://github.com/ulams-dev/ulams/blob/main/api/packages/demo/src/config.php). | Variable | Default | Purpose | |---|---|---| | `DEMO_MODE` | `false` | Turns demo mode on. Set through `ulams:tenant:create --demo=on`. | | `DEMO_ADMIN_EMAIL` | `INITIAL_USER_EMAIL` | Account for the admin login. | | `DEMO_STUDENT_EMAIL` | `student1@` | Account for the student login. | | `DEMO_TUTOR_EMAIL` | `tutor@` | Account for the tutor login. | | `DEMO_ADMIN_URL` | `ADMIN_URL` | Admin URL shown on the front's demo badge. | | `DEMO_RESET_SCHEDULE` | `true` | Schedule the reset. | | `DEMO_RESET_CRON` | `0 * * * *` | When the reset runs. | | `DEMO_RESET_WIPE_FILES` | `false` | Also empty the bucket on every reset. | | `DEMO_RESET_STUDENTS` | `5` | Number of students when no baseline exists yet. | | `DEMO_CONTENT_SEEDER` | `Database\Seeders\DemoCoursesSeeder` | Seeder for the demo courses; skipped if the class does not exist. | | `ULAMS_DEMO_EXPERIENCE` | tenant slug | Which demo content to seed. | See also [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md), [Artisan commands](https://ulams-dev.github.io/ulams/reference/artisan-commands/index.md) and [Scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md). ## Known limitations - Everyone shares the same demo student and demo admin, so visitors see each other's changes until the next reset. - Files uploaded to the bucket are kept across resets unless `--wipe-files` is used. - More detail on the reset internals is in the [demo package README](https://github.com/ulams-dev/ulams/blob/main/api/packages/demo/README.md). --- # Dictionaries > Build glossaries of words with descriptions, categories and videos in the admin panel, import them from CSV, and limit free views for visitors. Canonical page: https://ulams-dev.github.io/ulams/admin/dictionaries/ A dictionary is a named glossary of words. Each word has a short description, categories and any number of longer descriptions with an optional video. Learner apps read the words through a public API. The [dictionaries](https://ulams-dev.github.io/ulams/reference/packages/dictionaries/index.md) package provides it. | Screen | Route | Shown when | |---|---|---| | Dictionary list | `/other/dictionary` | `dictionary_list` or `dictionary_read` | | Dictionary (tabs Attributes, Words) | `/other/dictionary/:dictionaryId/:tab` | `dictionary_create` | | Word (tabs Attributes, Categories, Descriptions) | `/other/dictionary/:dictionaryId/:tab/:dictionaryWordId/:dictionaryWordTab` | `dictionary-word_create` | All screens also need the `ulams/dictionaries` package, and the menu item can be hidden with the `hideInMenu-OtherDictionary` setting. Note that opening a dictionary or a word, even to read it, needs the create permission. *Screenshot: The list of dictionaries* ## Creating a dictionary 1. Click **New** on the list. 2. On **Attributes** enter the **Name**; the **Slug** is used in the public API URL. 3. Set **Free views count**: how many words a visitor without access may open per day. Leave it empty for no limit. 4. Save, then open the **Words** tab to add words. *Screenshot: The words tab of a dictionary with the import button* ## Words On the **Words** tab, **New** opens the word form: - **Attributes**: the **Word** and a short **Description**. - **Categories**: categories from the [category tree](https://ulams-dev.github.io/ulams/admin/categories-and-tags/index.md). - **Descriptions**: a list of longer entries, each with a **Title**, a **Description** and a **Video URL**. ### Importing words With the `dictionary-word_import` permission the Words tab shows **Import dictionary**, which accepts one `.csv` or `.xlsx` file. The first row is a header and is skipped. Each following row is one word: | Column | Content | |---|---| | A | the word (required, up to 255 characters) | | B | the short description | | C | category names separated by commas; each must already exist | | D, E, F | title, description and video URL of the first long description | | G, H, I, … | further descriptions, three columns each | A row whose word already exists in the dictionary updates that word; its categories and descriptions are replaced by those in the file. ## Access and free views The public endpoints are `GET /api/dictionaries/{slug}/words` (list), `GET /api/dictionaries/{slug}/words/categories` and `GET /api/dictionaries/{slug}/words/{id}` (one word). Opening one word counts as a view. A signed-in user who has been given access to the dictionary (optionally until an end date) has no limit. Everyone else gets **Free views count** word views per 24 hours, counted per user or, for anonymous visitors, per IP address; after that the API answers 429 Too Many Requests. > **Note:** The admin panel has no screen for granting access. Use the admin API > `POST /api/admin/dictionaries/{id}/access` (list with `GET`); a signed-in user can see their > own access at `GET /api/dictionaries/access`. --- # Files > Browse, search, upload and delete files in the tenant's storage from the admin panel, and how upload folders and tutor access are organised. Canonical page: https://ulams-dev.github.io/ulams/admin/files/ **Configuration → Files** (`/configuration/files`, permission `file_list`) is a browser for the tenant's file storage, provided by the [files](https://ulams-dev.github.io/ulams/reference/packages/files/index.md) package. Each tenant has its own storage bucket (`ulams-` on SeaweedFS or S3; see [Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md)), so the library shows only that tenant's files. *Screenshot: The file browser showing folders and files* ## Using the browser - **Folders**: click the folder button to open a folder and `..` to go up. The current path is shown above the list. - **Search**: type part of a file name and click **Query** to search in the current folder; **Reset** returns to the plain listing. - **Upload**: the upload control above and below the list uploads files into the current folder (`POST /api/admin/file/upload`, permission `file_create`). The panel cannot create empty folders; upload into the folder you need. - **Delete**: the red button removes a file (`file_delete`). Folders have no delete button. ## Where uploads go The same browser opens from upload fields across the panel (**Browse files** next to an upload field), so a file can be uploaded once and reused. Forms upload to folders named after the item: | Folder | Content | |---|---| | `avatars/{user id}` | user avatars | | `course/{course id}` | course images, videos and topic files | | `webinar/{webinar id}` | webinar files | | `stationary-events/{id}` | stationary event files | | `categories/{category id}` | category icons | | `pages/{page id}/wysiwyg` | images inserted in static pages | > **Caution:** Deleting a file here does not update the courses, pages or settings that use it. Their links > break, so check where a file is used before deleting it. ## Tutor access to folders Users with `file_list_self` instead of `file_list` see only the folders listed in their account's `access_to_directories`. The package fills that list from events: - account confirmed: `avatars/{user id}`; - assigned as a course tutor: `course/{course id}` (removed when unassigned); - assigned as a webinar trainer: `webinar/{webinar id}` (removed when unassigned); - assigned as a stationary event author: `stationary-events/{id}` (removed when unassigned). Large media files, such as videos and SCORM or H5P packages, are uploaded through the course editor; see [Content creators](https://ulams-dev.github.io/ulams/creators/index.md). --- # H5P libraries > Install, restrict and remove H5P content types for every academy from the platform, and seed sample H5P content with make h5p-seed. Canonical page: https://ulams-dev.github.io/ulams/admin/h5p-libraries/ H5P content types (Multiple Choice, Drag and Drop, Interactive Video and so on) are H5P *libraries*. The **Courses → H5P libraries** screen lists the libraries installed in the H5P service, and lets a platform administrator upload, restrict and delete them and refresh the list of content types available from the H5P Hub. Creating and editing H5P content itself is covered in the [creators guide](https://ulams-dev.github.io/ulams/creators/index.md). ## How H5P is built H5P runs in its own service so that its GPL code never mixes with the rest of ulams ([ADR 0003](https://ulams-dev.github.io/ulams/decisions/0003-h5p-as-isolated-gpl-service/index.md)): | Part | What it does | |---|---| | `api/h5p` (app key `api-h5p`) | Node.js service built on Lumi's h5p-nodejs-library. Serves the H5P player, editor, AJAX endpoints, library administration and a small REST API under `/h5p/*` on every API host. Owns the `h5p` schema in each tenant database and stores files in the tenant bucket. | | `api/packages/h5p` (`h5p`) | Laravel package. A read-only model of the service's `h5p.contents` table, the admin content list with usage counts (`GET /api/admin/h5p/contents`, `DELETE /api/admin/h5p/unused`), an HTTP client for server-to-server calls (upload, download, delete, orphan clean-up) and the H5P permissions. It never writes to the `h5p` schema. | | admin and learner apps | Never load H5P code. They frame the service's embed pages and talk to them with `postMessage`. | The full service reference (environment variables, routes, embedding protocol, tenancy) is in the [api/h5p README](https://github.com/ulams-dev/ulams/blob/main/api/h5p/README.md). ## Libraries are shared by all academies All tenants use **one library volume** (`/data/libraries` in the image). Installing, updating or deleting a library therefore affects every academy. Content, user state and results stay per tenant (tenant database and bucket). In production the volume is a normal Docker volume of the `h5p` service; see [H5P service in production](https://ulams-dev.github.io/ulams/operators/h5p/index.md). Because of this, the service only accepts library **writes on the platform host** (tenant id `default`, `api.localhost` in development). The guard is the `platformOnlyWrites` middleware in [`api/h5p/src/http/platformOnly.ts`](https://github.com/ulams-dev/ulams/blob/main/api/h5p/src/http/platformOnly.ts), mounted in front of `/h5p/libraries` and `/h5p/content-type-cache`. On a tenant host, `POST`, `PATCH` and `DELETE` on those routes answer `403` with "H5P libraries are shared by all academies; install and update them on the platform." `GET` stays open, so tenant administrators can see the list. > **What the platform-only guard does not cover:** The admin panel does not hide the upload button or the switches on a tenant; the API rejects the > request and the panel shows the error. Libraries can also be installed outside these routes: from > the H5P Hub tab in the editor and by uploading a `.h5p` package that contains libraries. Both go > through Lumi's AJAX router and are allowed for any user with `h5p_library_install` or > `h5p_library_update`, on any tenant. ## The libraries screen *Screenshot: H5P libraries list with version, instance counts and the restricted switch* The table shows, for each installed library: - **Title**, with a *runnable* tag for content types (libraries a learner can play directly) and an *addon* tag for add-ons. - **Machine name** and **version** (`major.minor.patch`). - **Instances**: how many contents use it as the main library, plus how many use it as a dependency (shown in brackets). - **Dependents**: how many other libraries depend on it. - **Restricted**: a switch, enabled only for runnable libraries. A restricted content type can only be used by users with `h5p_library_install` or `h5p_library_update`. - **Delete**: enabled only when the service reports that the library can be deleted (nothing depends on it). Users who may update libraries also see: - **Upload a library**: a `.h5p` file sent to `POST /h5p/libraries` (field `file`). The result says how many libraries were installed and updated. - **Update content type cache**: refreshes the H5P Hub list (`POST /h5p/content-type-cache/update`) and shows when it was last updated. The service also refreshes this cache in the background. ## Ways to install content types 1. **From the platform admin panel**: upload a library package on this screen. 2. **From the H5P editor**: users with `h5p_library_install` or `h5p_library_update` see the H5P Hub in the content-type selector and can install from there (needs `H5P_HUB_ENABLED=true`, the default). 3. **By uploading content**: `POST /h5p/contents/upload` (the editor's upload tab) installs every library inside the package when the caller may install libraries. 4. **From the command line**, in the H5P container: ```bash docker compose exec h5p node dist/cli/seed.js --hub H5P.MultiChoice,H5P.DragQuestion ``` ## Seeding sample content: `make h5p-seed` `make h5p-seed` (in `api/makefile`) runs: ```bash docker compose exec h5p node dist/cli/seed.js --samples ``` The seeder runs as the system user and imports the curated sample packages (Image Hotspots, Drag and Drop, Dialog Cards, Flashcards, Branching Scenario, Interactive Video, Multiple Choice, Course Presentation, True/False, Fill in the Blanks, Memory Game). Importing a package also installs the libraries it contains. `make migrate-fresh` and `make refresh` call `h5p-seed` at the end. Useful options of `seed.js`: | Option | Effect | |---|---| | `--samples [k1,k2]` | Import all curated samples or only the listed keys | | `--list-samples` | Print the sample keys and exit | | `--hub ` | Install these content types from the H5P Hub first | | `--tenant ` | Tenant to import into; default `default` (the platform). A tenant's id is its storage directory name, e.g. `coffee_localhost` | | `--out ` | Also write the JSON report to a file | Positional arguments are local `.h5p` files, directories or URLs. The exit code is `2` if any item failed. > **Note:** Without `--tenant`, `make h5p-seed` imports the sample content into the platform tenant only. > The libraries it installs are visible to every tenant, the sample content is not. ## Permissions All H5P permissions come from `H5PPermissionsEnum` and are granted to the `admin` role by `H5PPermissionSeeder`. The H5P service reads them from `GET /api/profile/me`. | Permission | Used for | |---|---| | `h5p_library_list` | Opening this screen (`GET /h5p/libraries`) | | `h5p_library_read` | Reading one library | | `h5p_library_upload`, `h5p_library_install` | Uploading a library package | | `h5p_library_update` | The restricted switch; with `h5p_library_install`, Hub installs and using restricted types | | `h5p_library_delete` | Deleting a library | The menu entry also disappears when the H5P package is not installed or the `hideInMenu-CoursesH5ps` setting is on. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Configuration Laravel side (`api/packages/h5p/src/config.php`): | Variable | Default | Purpose | |---|---|---| | `H5P_SERVICE_URL` | `http://h5p:8080` | Where Laravel reaches the service | | `H5P_INTERNAL_TOKEN` | none | Shared secret for server-to-server calls (`X-Internal-Token`); must match the service | | `H5P_SERVICE_TIMEOUT` | `300` | Seconds, for large uploads and exports | Service side, the variables most relevant to libraries: `H5P_HUB_ENABLED`, `H5P_LIBRARIES_PATH`, `H5P_MAX_TOTAL_SIZE_MB` (upload limit, default 256) and `PLATFORM_HOSTS` (hosts treated as the platform). See [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md) and the [api/h5p README](https://github.com/ulams-dev/ulams/blob/main/api/h5p/README.md#environment-variables). ## Known limitations - Libraries are global. There is no per-academy set of content types; restricting a type restricts it everywhere. - The service caches library metadata in Redis. After changing the library volume by hand, clear the `h5p:lib:*` keys. - No events or notifications are emitted for library changes. --- # Learner Insights settings > Turn on learner insights for a tenant, tune the struggling and at-risk rules, choose privacy and retention settings and backfill existing data. Canonical page: https://ulams-dev.github.io/ulams/admin/learner-insights/ Learner Insights records what learners do in a course as small, structured signals and scores them with transparent rules into two statuses: **struggling** (with an element, such as a quiz question) and **at risk** (of dropping out). Every status carries the reasons in plain language. Later steps of the personalisation phase add nudges, personal help and author analytics. This page covers the signal stream and the rules. It adds no admin route yet: it is configured with settings, one set of permissions and a few commands. Signals and statuses are never sent to an AI provider, and a status never affects grades, access or certificates. ## Turn it on The module ships with the API and is always loaded, but it is **off for every tenant** until you switch it on. After an upgrade run once per tenant: ```bash php artisan migrate --force php artisan db:seed --class="Ulams\\LearnerInsights\\Database\\Seeders\\LearnerInsightsPermissionSeeder" --force php artisan learner-insights:backfill --dry-run # how many signals existing data would give ``` Switch it on with the tenant setting `learner_insights.enabled` (`POST /api/admin/config`, or `LEARNER_INSIGHTS_ENABLED=true` for the whole installation). The seeder creates the permissions `learner_insights_view`, `learner_insights_view_individuals` and `learner_insights_manage` and gives them to the `admin` role. Tutors get none of them by default. ## What is recorded | Signal | From | |---|---| | `course.started`, `course.completed` | enrolment progress events | | `topic.opened`, `topic.progressed`, `topic.completed` | progress saves (time spent as seconds, never page content) | | `quiz.attempt_started`, `quiz.attempt_finished`, `quiz.answer` | GIFT quizzes (score ratio and whether the answer was fully correct, never the answer text) | | `code.attempt_finished` | a run of a [code exercise](https://ulams-dev.github.io/ulams/creators/code-exercises/index.md): the attempt number and whether it passed, never the code (counted by the failed-attempts rule like quiz attempts) | | `scorm.status` | SCORM completion | | `h5p.result` | H5P results (the scaled score and the verb, never the xAPI statement) | | `media.replayed`, `media.seeked_back` | the video and audio players | | `session.login` | sign-in | Each signal belongs to a learner, usually a course and an element: the element of the Course Builder blueprint when the course was built with it, otherwise the topic or question id. There is no free text in any signal. ## The rules All values are defaults; change them per tenant with the settings `learner_insights.rules..` (`POST /api/admin/config`) and per course with `PUT /api/admin/learner-insights/courses/{course}/settings` (permission `learner_insights_manage`), for example `{"rules": {"inactivity": {"inactive_days": 5}}}`. | Rule | Fires when | Result | Defaults | |---|---|---|---| | `inactivity` | no activity in the course for `inactive_days` | learner **at risk** | 7 days; `struggling_elements_at_risk` = 3 struggling elements plus 3 inactive days is also at risk | | `failed_attempts` | the same question answered wrongly `failed_answers` times since the last correct answer, or `failed_quiz_attempts` failed attempts of one quiz since the last pass | element **struggling** | 2 and 2 | | `slow_element` | time on an element is more than `slow_factor` times the cohort median (cohort of at least `min_cohort` learners who finished it) | element **struggling** | 3 times, cohort 10 | | `abandoned_element` | an element was opened `abandoned_days` ago, not finished, while the learner worked on other parts | element **struggling** | 5 days | | `repetition` | `replays` replays or seeks back in media, or `revisits` revisits of a finished topic within 7 days | low weight: only counts together with another rule | 3 and 3 | A finished course is always on track. A struggling element returns to on track when the learner passes or finishes it. Statuses change only on transitions: the events `LearnerStruggling`, `LearnerAtRisk` and `LearnerRecovered` fire once per transition, never on a repeated evaluation. The first evaluation follows new signals within about a minute (one evaluation per learner and course per minute); the nightly `learner-insights:evaluate` covers the rules that depend on time passing, and `learner-insights:cohort-stats` computes the medians. ## Personal help For courses built with the [Course Builder](https://ulams-dev.github.io/ulams/admin/course-builder/index.md), a learner who is struggling with an element gets short extra help: an explanation and a practice question, or an explanation and a worked example. It is written from the sources the course cites, shown with those sources, an "AI-generated" label and the reason it was offered, and checked before it is shown: a claim the sources do not support means nothing is shown. Help is cached per difficulty and per version of the element, so most learners cost nothing, and it is retired when an author changes the element. AI must be configured (`AI_DRIVER`); without it nothing is generated and the rest of Learner Insights works as before. Learners can say "helpful" or "not helpful", hide a piece of help, or switch it off for a course or entirely. Learners can also paste their own explanation of the idea and get feedback (the text is sent to the AI provider and not stored). What reaches the provider is described in [data flows and DPIA](https://ulams-dev.github.io/ulams/operators/dpia-learner-insights/index.md). | Variable | Default | Meaning | |---|---|---| | `LEARNER_INSIGHTS_REMEDIATION_ENABLED` | `true` | Tenant switch for personal help (the module itself must be on) | | `LEARNER_INSIGHTS_REMEDIATION_PER_LEARNER_DAY` | `3` | New generations per learner per day | | `LEARNER_INSIGHTS_REFLECTIONS_PER_DAY` | `5` | Feedback requests on a learner's own explanation per day | | `LEARNER_INSIGHTS_MONTHLY_USD` | `20` | Monthly AI spend of personal help for the tenant | | `LEARNER_INSIGHTS_COURSE_MONTHLY_USD` | `5` | Monthly AI spend of personal help for one course | | `LEARNER_INSIGHTS_EVAL_MONTHLY_USD` | `5` | Monthly cap of `learner-insights:eval --live`, see [evals](https://ulams-dev.github.io/ulams/developers/learner-evals/index.md) | | `AI_TASK_REMEDIATION_PROFILE`, `AI_TASK_REFLECTION_PROFILE` | `default`, `light` | Model profiles of the two tasks | ### Measuring whether the help works A recovery rate alone does not prove that the help worked. `LEARNER_INSIGHTS_REMEDIATION_HOLDOUT_PERCENT` (default `0`, off) keeps that share of learners (the same learners every time) out of personal help, while their progress is still measured. Compare the recovery of both groups before you claim a benefit; ask your learners' representatives or data protection officer before switching it on, because some learners then get no help on purpose. ## Adaptive interface With `learner_insights.adaptive_interface` on (default off), the reference frontend asks `GET /api/learner-insights/courses/{course}/presentation` and shows lessons in steps with hints for a learner who has struggled with several parts, keeps the outline linear for a learner at risk, and uses a compact layout for a learner who moves through the course quickly. The answer says why, and the learner can switch any choice back (for example "show the whole lesson"). No AI is involved. ## Reminders An at-risk learner gets one reminder per course per 7 days and at most two per week in total, in the app and by e-mail, with the reason and a link to the next unfinished topic. Each suppressed reminder is logged with its reason. After 14 days the reminder counts as recovered (the learner finished a topic or passed a quiz again) or not recovered. Switch reminders off for the tenant with `learner_insights.nudges.enabled`; learners switch them off in their settings. ## Analytics for authors and admins `GET /api/admin/learner-insights/courses/{course}/summary` gives the per-course picture: how many learners are enrolled, active and finished, quiz scores and pass rate, how many learners are on track, struggling or at risk, and what reminders and personal help achieved. `.../elements` lists the sections that confuse people, ranked by the share of their learners who struggled, with the reasons and the share who recovered. Both accept `period=7|30|90` days. They are open to holders of the permission `learner_insights_view` (admins) and to the authors of the course. Nothing is shown for a group smaller than `LEARNER_INSIGHTS_MIN_GROUP_SIZE` (default 10): the API answers `smallGroup` or `hidden` instead of numbers, so a screen cannot leak a single learner. Names are available only through `.../learners` (struggling and at-risk learners with their reasons) and `/learners/{user}/courses/{course}/timeline`, which need the permission `learner_insights_view_individuals`. Authors of a course may use `.../learners` only when the tenant setting `learner_insights.instructors_see_individuals` is on (default off). `POST /api/admin/learner-insights/backfill` queues the backfill. Authors read the same aggregates on the course's Insights page in the studio, described in [See where learners struggle](https://ulams-dev.github.io/ulams/creators/course-insights/index.md); the **Insights** tab of a course in the admin summarises it and links to it. ## Privacy controls | Control | Effect | |---|---| | `learner_insights.enabled` (tenant) | Nothing is recorded while it is off | | `learner_insights.require_consent` (tenant) | Nothing is recorded for a learner until the user setting `insights.consent` exists | | `insights.enabled` = false (user setting) | The learner opted out: nothing is recorded about them | | `learner_insights.retention.signals_days` (tenant, default 180) | Older signals are deleted by the daily `learner-insights:prune` | ## Environment variables | Variable | Default | Meaning | |---|---|---| | `LEARNER_INSIGHTS_ENABLED` | `false` | Master switch for the installation (the tenant setting overrides it) | | `LEARNER_INSIGHTS_REQUIRE_CONSENT` | `false` | Consent mode | | `LEARNER_INSIGHTS_QUEUE_CONNECTION`, `LEARNER_INSIGHTS_QUEUE` | default queue | Where signals are recorded and statuses evaluated | | `LEARNER_INSIGHTS_AI_QUEUE_CONNECTION`, `LEARNER_INSIGHTS_AI_QUEUE` | the Course Builder queue | Where personal help is generated (the long queue with a `retry_after` above the job timeout, see [queues and scheduler](https://ulams-dev.github.io/ulams/operators/queues-and-scheduler/index.md)) | | `LEARNER_INSIGHTS_RETENTION_SIGNALS_DAYS` | `180` | Retention window | | `LEARNER_INSIGHTS_CLIENT_SIGNALS_PER_MINUTE` | `60` | Rate limit of the player endpoint, per learner | | `LEARNER_INSIGHTS_EVALUATE_DEBOUNCE_SECONDS` | `60` | One evaluation per learner and course in this window | | `LEARNER_INSIGHTS_MIN_GROUP_SIZE` | `10` | Smallest group an aggregate may describe | | `LEARNER_INSIGHTS_INSTRUCTORS_SEE_INDIVIDUALS` | `false` | Whether course authors may list individual statuses | ## Commands ```bash php artisan learner-insights:backfill --course=1 # build signals from existing progress, enrolments and quiz data (idempotent, --dry-run, --since=) php artisan learner-insights:timeline --user=42 --course=1 # one learner's journey with element labels (support) php artisan learner-insights:prune # runs daily at 02:40 per tenant php artisan learner-insights:cohort-stats # runs daily at 03:00 per tenant php artisan learner-insights:evaluate # runs daily at 03:30 per tenant (--course=) ``` Progress and SCORM keep only their latest state, so backfilled history is coarse. The backfill respects the module switch, opt-outs and the retention window. --- # Living Course settings > Enable source sync for the Course Builder, set the connectors, polling, webhooks and AI cost limits, give reviewers access, and run the queue, scheduler and backfill commands. Canonical page: https://ulams-dev.github.io/ulams/admin/living-course/ Living Course keeps a course built with the [Course Builder](https://ulams-dev.github.io/ulams/admin/course-builder/index.md) in sync with its sources. Authors work with it in the studio ([author guide](https://ulams-dev.github.io/ulams/creators/course-builder/index.md#10-keep-the-course-in-sync-with-its-sources)); this page is for the person who runs the installation. It adds no admin route: everything is configured by environment variables, one permission and a few commands. ## Turn it on The module ships with the API and is always loaded. After an upgrade, run once per tenant: ```bash php artisan migrate --force php artisan db:seed --class="Ulams\\LivingCourse\\Database\\Seeders\\LivingCoursePermissionSeeder" --force php artisan living-course:backfill # first revision for courses built before the upgrade php artisan gift:snapshot-max-scores # keeps old quiz results comparable (progress rules) ``` Add `--domain=` on a multi-tenant installation. The seeder creates the permission `living_course_review` and gives it to the `admin` role. The author of a session and admins can always act; give `living_course_review` to tutors who should review updates of courses they did not build. The requirements of the Course Builder apply: a configured `AI_DRIVER`, a queue worker for the builder queue (`COURSE_BUILDER_QUEUE`, default `builder`, or `LIVING_COURSE_QUEUE`; see the Course Builder queue notes: `retry_after` must stay above the 1800 s job timeout) and the scheduler, which runs `living-course:poll` every 15 minutes. ## Environment variables | Variable | Default | Meaning | |---|---|---| | `LIVING_COURSE_CONNECTORS` | `upload,git,url` | Connectors offered to authors. Plugins can register more. | | `LIVING_COURSE_QUEUE_CONNECTION`, `LIVING_COURSE_QUEUE` | the Course Builder queue (`-builder`, queue `builder`) | Where source checks and analysis steps run. Use a connection whose `retry_after` is above 1800 s. | | `LIVING_COURSE_MIN_POLL_MINUTES` | `60` | Shortest polling interval an author can choose. | | `LIVING_COURSE_WEBHOOK_DEBOUNCE_SECONDS` | `600` | Pushes within this window collapse into one check. | | `LIVING_COURSE_AUTO_ANALYSE_USD` | `0.50` | Estimated cost below which analysis starts by itself; above it the author confirms. | | `LIVING_COURSE_PROPOSAL_COST_USD` | `2` | Hard cap of one update proposal. | | `LIVING_COURSE_SOURCE_MONTHLY_USD` | `10` | Hard cap per source and month. Improvements proposed from learner insights count against the course (its builder session) instead. | | `LIVING_COURSE_INSIGHTS_PROPOSALS_PER_DAY` | `3` | Improvement proposals from learner insights per course and day (the course author's "Propose an improvement" on the Insights page). | | `LIVING_COURSE_MAX_GROUPS` | `40` | Most analysis groups of one proposal. | | `LIVING_COURSE_MAX_FRAGMENTS` | `4000` | Most fragments per revision before a check fails with a readable message. | | `LIVING_COURSE_ALLOWED_HOSTS` | empty | Allow-list of hosts (comma separated) the connectors may reach. Empty means any public host; once set, only these. | | `LIVING_COURSE_INSECURE_HOSTS` | empty | Hosts allowed over plain HTTP or on private addresses (development only). | | `LIVING_COURSE_LEARNER_NOTICE_AFTER_DAYS` | `3` | Days before an unseen update notice reaches a learner by e-mail. | | `LIVING_COURSE_GOOGLE_CLIENT_ID`, `LIVING_COURSE_GOOGLE_CLIENT_SECRET` | empty | OAuth client for **Google Drive** sign-in (see below). | | `LIVING_COURSE_NOTION_CLIENT_ID`, `LIVING_COURSE_NOTION_CLIENT_SECRET` | empty | OAuth client (a public Notion integration) for **Notion** sign-in. | | `LIVING_COURSE_OAUTH_RETURN_URL` | empty | Address of the studio's new-course page (for example `https://studio.example.org/studio/new`). The browser returns there after the sign-in with a one-time grant; empty answers with JSON instead. | | `LIVING_COURSE_GIT_TIMEOUT` | `120` | Seconds one `git` command of the `git-cli` connector may run. | | `LIVING_COURSE_GIT_CLONE_MB` | `200` | A `git-cli` clone larger than this is stopped. | | `AI_TASK_UPDATE_PROFILE` | the default profile | Model profile of the analysis (`update` task); the model name lives in `config/ai.php`. | | `AI_TASK_INSIGHTS_IMPROVE_PROFILE` | the default profile | Model profile of improvements proposed from learner insights (`insights_improve` task). | | `AI_TASK_NEW_LESSON_PROFILE` | the default profile | Model profile of suggested lessons for new source sections (`new_lesson` task). | Not configurable by environment variable (set in `api/packages/living-course/config/living_course.php`): at most 48 checks per connection and day, 5 update proposals per source and day, 3 regenerations per item, 3000 output tokens per analysis group, 3 failed checks before a connection shows **Error**, and a weekly digest of learner notices. Every model call of the analysis is logged in `ai_calls` with its model, tokens and cost, and the proposal as subject, so the [cost log](https://ulams-dev.github.io/ulams/admin/course-builder/index.md) shows it. ## Connectors and webhooks - **Upload** needs nothing. **Git** reads GitHub, GitLab and Gitea or Forgejo hosts through their APIs with a token the author provides; tokens are stored encrypted and never returned. **URL** reads up to 20 web pages and stores their Markdown. - **Git on any server** (`git-cli`, off by default) reads a repository on a server without a supported API with the `git` command: add `git-cli` to `LIVING_COURSE_CONNECTORS` on an image that ships git (the ulams PHP image does from this version; rebuild yours). It clones shallowly and read-only into a temporary directory that is always removed, over https only, to public addresses only (the same checks and host allow-list as the other connectors), without hooks, submodules, LFS or redirects, with an empty environment so server secrets are never visible to it, and stops a clone that grows past `LIVING_COURSE_GIT_CLONE_MB` or runs longer than `LIVING_COURSE_GIT_TIMEOUT`. The access token is sent as a request header from the environment; it is never in a URL, argument, log or error message, and what git prints is never shown to authors because it comes from the remote. A webhook is optional: a script or CI job can POST a body signed with the connection's secret in `X-Ulams-Signature`. - **Google Drive and Notion** (`google-drive`, `notion`; off by default, add them to `LIVING_COURSE_CONNECTORS`) need an OAuth app that your installation owns. Google: create an OAuth client of type *Web application* in Google Cloud, enable the Drive API, add the redirect URI `https:///api/living-course/oauth/google/callback` and the scope `drive.readonly`. Notion: create a *public* integration with the redirect URI `https:///api/living-course/oauth/notion/callback` and read content capability. Put the client id and secret in the variables above (a tenant can override them in its own settings). Authors then sign in once per source; the browser never sees a token, the studio only gets a one-time grant (ten minutes, bound to the user, redeemed once). The refresh token (Google) or access token (Notion) is stored encrypted in the connection, is never returned or logged, and is deleted when the source is disconnected. Both services are read with the same SSRF-safe client: with `LIVING_COURSE_ALLOWED_HOSTS` set, add `oauth2.googleapis.com`, `www.googleapis.com` and `api.notion.com`. Access tokens are fetched fresh for every check, so a revoked sign-in turns the connection to **Error** with a reconnect message. A Notion integration token pasted by the author (an internal integration) also works. - Every outbound request goes through one SSRF-safe client: private and link-local addresses, redirects to them and unlisted hosts are refused. - The webhook of a connection is `https:///api/living-course/webhooks/{id}`; the studio shows it with its secret. GitHub (`X-Hub-Signature-256`), GitLab (`X-Gitlab-Token`) and Gitea signatures are verified, deliveries are deduplicated and the endpoint is throttled. Polling is the fallback when a webhook is not possible. Signature headers, replies and a `curl` example are in [Living Course internals](https://ulams-dev.github.io/ulams/developers/living-course/index.md#webhook-requests). The route must be reachable from your Git host without a login; it is throttled to 60 requests a minute per webhook, refuses bodies over 1 MB and logs a refused signature once a minute per connection in the audit trail (`webhook.rejected`). ## Scheduler and checks The scheduler (`php artisan schedule:run` every minute) runs `living-course:poll` every 15 minutes. It queues a check for every Git or web connection whose time has come: schedules are `hourly`, `daily` and `weekly` (`manual` and uploads are never polled), never shorter than `LIVING_COURSE_MIN_POLL_MINUTES`, each with a random delay of up to 10 % so tenants do not all fetch at once. After three failed checks a connection shows **Error** with the last message and backs off to daily; **Check now**, resuming or fixing the settings clears it. Checks run as jobs on the builder queue. ## When a cost limit is reached Analysis is estimated before it starts. At or below `LIVING_COURSE_AUTO_ANALYSE_USD` it runs by itself (if the connection's automatic analysis is on); above it the proposal waits as `awaiting_analysis` until an author confirms (`ulams living proposals analyse --confirm-estimate`). If the estimate would exceed `LIVING_COURSE_PROPOSAL_COST_USD`, or this source's month (`LIVING_COURSE_SOURCE_MONTHLY_USD`), the proposal becomes `budget_blocked` with the reason and the changed elements are listed for editing by hand. The course session budget and `AI_LIMIT_TENANT_MONTHLY_USD` of the [Course Builder](https://ulams-dev.github.io/ulams/admin/course-builder/index.md) also apply to every call. Change detection, staleness and the audit trail cost nothing and keep working. ## Commands | Command | Use | |---|---| | `living-course:poll` | Checks the sources that are due; scheduled every 15 minutes, also prunes webhook deliveries older than 30 days. | | `living-course:backfill` | Creates the first revision of sessions that have none (`--session=` for one). Safe to repeat. | | `living-course:eval` | Runs the update fixtures end to end (`--fixtures=all` or `coffee,git,injection`) and writes a report; `--live` calls the real model, capped by `--max-usd` (default 1), `--record` stores the answers for CI replay, `--author=`. | | `gift:snapshot-max-scores` | Stores the maximum score on existing quiz results. | ## Restyle for a style profile A third kind of proposal besides source updates and improvements from learner insights: after an admin approves a new or changed [style profile](https://ulams-dev.github.io/ulams/creators/style-profiles/index.md), an author may ask for a **restyle** of a course that already exists. It is optional and never starts by itself. - The proposal has no source revision. It holds one item for every element the style check flags for a rule a rewrite can fix: a banned phrase, a term to avoid or a product name in the wrong casing. Reading level, landing components and image rules are not part of it, and a quiz question whose correct option is flagged is left to you: **the answer key is never restyled**. - One model call per lesson (`style_restyle`, model from configuration, logged with tokens and cost against the proposal) rewrites the flagged elements, with the approved profile and the findings in the prompt and the style guide itself never in it. The call is grounded like any update: a rewrite with an unsupported claim is left for you to edit by hand. - Ask for the estimate first (`POST sessions/{session}/style-proposals`, or `ulams living restyle `), then confirm (`confirmEstimate`, or `--confirm-estimate`). Review the diff on the Living Course review screen, accept or reject items, and apply. Rejecting the proposal, or an item, leaves the course as it was. - Applying writes a new course version (`Restyle for the style profile …`, release trigger `style`) with the usual audit entry. Source revisions and the synced source are untouched. - One open restyle per course at a time, and three new ones per course per day (`living_course.cost.style_proposals_per_session_per_day`). ## Audit The audit trail is append-only (a database trigger refuses updates and deletes) and hash-chained. Admins can export it as CSV or JSON and verify the chain from the studio or with `GET /api/admin/living-course/audit/verify`. --- # LTI 1.3 integrations > Register external LTI 1.3 tools that ulams launches in lessons, and LMS platforms such as Moodle that launch ulams courses. Canonical page: https://ulams-dev.github.io/ulams/admin/lti/ ulams speaks LTI 1.3 in both directions, separately for every academy (tenant): - **Platform side**: ulams launches an external tool inside a lesson (topic type `LtiLink`), receives grades back through Assignment and Grade Services (AGS) 2.0, shares the course member list through Names and Role Provisioning Services (NRPS) 2.0 when you allow it, and lets authors pick content in the tool with Deep Linking 2.0. - **Tool side**: Moodle, Canvas or another LMS launches a ulams course. The learner is signed in, given access to the course, and their course progress is sent back as a grade. Instructors can pick courses with deep linking. The design and the choice of libraries are recorded in [ADR 0012](https://ulams-dev.github.io/ulams/decisions/0012-lti-package-and-libraries/index.md). The package README is at [api/packages/lti/README.md](https://github.com/ulams-dev/ulams/blob/main/api/packages/lti/README.md). ## The Integrations → LTI screen *Screenshot: LTI screen with the Tools and Platforms tabs* `/integrations` redirects to `/integrations/lti`. The page has two tabs. Each opens a drawer to add or edit a record, and the drawer shows the ulams URLs to give to the other side, with copy buttons (from `GET /api/admin/lti/endpoints`). **Tools (ulams launches them)** The table lists each tool's name, the **Client ID** and **Deployment ID** that ulams issued for it, and whether it is enabled. Fields in the drawer: | Field | Required | Notes | |---|---|---| | Name | yes | | | OIDC login URL | yes | The tool's login initiation URL | | Launch URL | yes | | | Deep linking URL | no | Enables content picking from the lesson editor | | Other redirect URIs | no | One per line | | JWKS URL | one of the two | The tool's public key set | | Public key (PEM) | one of the two | If the tool has no JWKS URL | | Custom parameters | no | `key=value`, one per line, sent with every launch | | Share names / Share e-mails | no | Off by default: the tool receives no name or e-mail unless switched on | | Member list (NRPS) | no | Off by default: lets the tool read the members of the courses it is linked in (see below) | | Enabled | | | Give the tool the values shown in the drawer: issuer, OIDC auth URL, token URL, JWKS URL, and after saving, the client ID and deployment ID. **Platforms (they launch ulams)** The table lists each platform's name, issuer, client ID and deployment IDs. Fields in the drawer: | Field | Required | Notes | |---|---|---| | Name | yes | | | Issuer (platform ID) | yes | For Moodle, the site URL | | Client ID | yes | Issued by the platform | | Deployment IDs | yes | One or more | | Authentication request URL | yes | Moodle: `.../mod/lti/auth.php` | | Access token URL | yes | Moodle: `.../mod/lti/token.php` | | Public keyset URL | yes | Moodle: `.../mod/lti/certs.php` | | Default course ID | no | Used when a link does not name a course | | Enabled | | | Register ulams in the LMS with the values in the drawer: login URL, launch/redirect URL, deep linking URL and JWKS URL. ## Registering a tool in ulams 1. In **Integrations → LTI → Tools**, add the tool with its OIDC login URL, launch URL, optional deep linking URL, and its JWKS URL or PEM key. Save. 2. Copy the issuer, OIDC auth URL, token URL, JWKS URL, client ID and deployment ID from the drawer into the tool's configuration. 3. In a course program, add a topic of type LTI link and choose the tool. If the tool has a deep linking URL, the topic form can open the tool in a pop-up window to pick content (`POST /api/admin/lti/tools/{tool}/deep-link`); the tool's response creates `LtiLink` topics. See the [creators guide](https://ulams-dev.github.io/ulams/creators/index.md). When a learner opens the topic, the learner app calls `POST /api/lti/launches/{topic}` and gets the tool's OIDC login URL with a single-use login hint valid for two minutes. Roles sent to the tool: `admin` becomes Administrator and Instructor, `tutor` becomes Instructor, everyone else Learner. A tool with **Member list (NRPS)** switched on gets the Names and Role Provisioning Services 2.0 claim in launches (`context_memberships_url`) and may ask for the scope `https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly` at the token endpoint. With that token, `GET /api/lti/platform/nrps/{course}` returns the course members as `application/vnd.ims.lti-nrps.v2.membershipcontainer+json`: the learners with access to the course and its authors, each with `user_id` (the same `sub` the tool sees in launches), `status: Active` and roles. Names and e-mails are included only when the tool's **Share names** / **Share e-mails** are on. The list is paged: `limit` (default and maximum 100) and `page`; a `Link: <...>; rel="next"` header points to the next page; `role` filters by an LTI role (`Learner`, `Instructor`, `Administrator`, or the full URI). A tool can read only courses that contain one of its links, and switching NRPS off stops tokens already issued. The `rlid` (resource link) filter of the spec is not supported and is ignored. Scores the tool sends through AGS are stored append-only. A score with `activityProgress` `Completed` or `gradingProgress` `FullyGraded` marks the topic as finished in the learner's course progress. ## Registering ulams in Moodle (or another LMS) 1. In Moodle, add an external tool (LTI 1.3) using the tool URLs from the **Platforms** drawer: login URL, launch URL, deep linking URL, JWKS URL. 2. In **Integrations → LTI → Platforms**, add the platform with Moodle's issuer (site URL), client ID, deployment ID and its `auth.php`, `token.php` and `certs.php` URLs. 3. Point resource links at a course. ulams takes the course from, in this order: the custom parameter `course_id=` (deep linking sets it), `?course=` on the target link URI, or the platform's default course ID. On a launch, ulams: - matches the user by `(platform, sub)`, never by e-mail. A new user is created with the platform's e-mail, or a placeholder `lti-…@lti.invalid` address if the e-mail is missing or already taken; - assigns `tutor` to Instructor, ContentDeveloper and TeachingAssistant roles and `student` to everyone else; nobody becomes an administrator through LTI; - grants access to the course through the course access service; - remembers the AGS line item if the platform allows score passback; - redirects to the learner site with a one-time code (`LTI_TOOL_LANDING_URL`, default `{front}/lti/launch?code={code}&course={course}`), which the front exchanges for a session at `POST /api/lti/tool/exchange`. When the platform offers **Client Side postMessage Storage** (`lti_storage_target` in the login request), the login page first asks the platform's storage frame (`lti.capabilities`, then `lti.put_data`) to keep the nonce of this login under the key `lti1p3_`. The launch then reads it back (`lti.get_data`) in a second step and posts it with the `id_token` to `POST /api/lti/tool/launch/verify`; a value that is not the nonce of that login is refused, so a launch cannot be replayed into another browser. Only the platform's frame and origin (the origin of its issuer) are talked to. The state kept by ulams stays the source of truth: when the platform's storage does not answer within about two seconds per step, or the platform sends no `lti_storage_target`, the launch continues exactly as before, with no cookie involved either way. Implemented from the 1EdTech LTI Client Side postMessage Storage specification (frame lookup by name or `_parent`, the `frame` of a capabilities answer, `org.imsglobal.` prefixed or plain subjects). Only instructors can use deep linking to add course links. When a learner finishes a topic (`TopicFinished` event), ulams queues a job that sends their course progress to the platform as a score out of 100, marked `Completed` / `FullyGraded` once the course is complete. > **Caution:** Inside an LMS iframe the learner site's session cookie may be blocked as a third-party cookie. > Configure the platform to open ulams in a new window. ## Keys and JWKS Every tenant has its own RSA key set (2048-bit by default), with private keys encrypted with the tenant `APP_KEY`. Keys have three states: `next` (published, not used yet), `active` (signs everything) and `retired` (still published for a grace period). - Public key set: `GET /api/lti/jwks` and `GET /.well-known/jwks.json`, no authentication. - Initial keys: `ulams:lti:rotate-keys --init`, run as the `lti_keys` step when a tenant is created (see [Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md)). - Rotation: `ulams:lti:rotate-keys`, scheduled monthly on the 1st at 03:00. `next` becomes `active`, a new `next` is generated, and retired keys stay in the JWKS for `LTI_RETIRED_KEY_GRACE_DAYS` (30) days. ## API endpoints | Caller | Endpoints | |---|---| | Anyone | `GET /api/lti/jwks`, `GET /.well-known/jwks.json`, `GET /api/lti/frame-origins` (origins of the enabled tools, cached 5 minutes; used for the front's [CSP](https://ulams-dev.github.io/ulams/operators/security-headers/index.md#tools-in-the-fronts-policy)) | | Admin (`lti_manage`) | `GET /api/admin/lti/endpoints`; CRUD on `/api/admin/lti/tools` and `/api/admin/lti/platforms`; `POST /api/admin/lti/tools/{tool}/deep-link` | | Learner | `POST /api/lti/launches/{topic}` | | External tool | `GET/POST /api/lti/platform/authorize`, `POST /api/lti/platform/token`, `/api/lti/platform/ags/{course}/lineitems[/{id}[/scores, /results]]`, `GET /api/lti/platform/nrps/{course}`, `POST /api/lti/platform/deep-links` | | External platform | `GET/POST /api/lti/tool/login`, `POST /api/lti/tool/launch` | | Learner's browser (storage step) | `POST /api/lti/tool/launch/verify` | | Learner's browser / front | `POST /api/lti/tool/deep-link`, `POST /api/lti/tool/exchange` (throttled to 30 per minute) | See [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions One permission, `lti_manage`, controls the whole Integrations menu and every admin endpoint. The `LtiPermissionSeeder` grants it to the `admin` role. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Configuration All optional (`api/packages/lti/src/config.php`): | Variable | Default | Purpose | |---|---|---| | `LTI_ISSUER` | `APP_URL` | Our issuer and endpoint base | | `LTI_RETIRED_KEY_GRACE_DAYS` | `30` | How long retired keys stay in the JWKS | | `LTI_KEY_BITS` | `2048` | RSA key size | | `LTI_LOGIN_HINT_TTL` | `120` | Seconds | | `LTI_ID_TOKEN_TTL` | `300` | Seconds | | `LTI_ACCESS_TOKEN_TTL` | `3600` | AGS access tokens, seconds | | `LTI_STATE_TTL` | `600` | OIDC state, seconds | | `LTI_CODE_TTL` | `60` | One-time launch code, seconds | | `LTI_ALLOW_INSECURE_URLS` | `false` | Development only: allow `http` and private addresses for JWKS, OIDC and AGS calls | | `LTI_HTTP_TIMEOUT` | `10` | Seconds | | `LTI_JWKS_CACHE_TTL` | `600` | Seconds | | `LTI_TOOL_LANDING_URL` | `{front}/lti/launch?code={code}&course={course}` | Where a launched learner lands | See [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md). ## Security notes - Every inbound JWT is checked for signature, `iss`, `aud`, `exp`, nonce or `jti`, and deployment ID. Login hints, JWT ids, OIDC state and nonce, and launch codes are single use. - Outgoing requests go only to public `https` addresses, without following redirects, unless `LTI_ALLOW_INSECURE_URLS` is on. - Hints, AGS tokens, deep-linking data and keys of one tenant are rejected by another. - Launches are audited in the `lti_launches` table. ## Known limitations - The launch audit log and AGS scores are stored but not shown in the admin panel. - Tool-side grade passback sends course progress, not individual quiz scores. --- # My profile > Change your own name, avatar, extra profile fields, password and per-user settings from the My profile screen of the admin panel. Canonical page: https://ulams-dev.github.io/ulams/admin/my-profile/ **My profile** is your own account page. It is not in the left menu: open it from the avatar menu in the top-right corner. The screen needs the `user_read_self` permission and has three tabs, each with its own URL (`/my-profile/:tab`; `/my-profile` opens `general`). *Screenshot: The My profile screen with General, Change password and User settings tabs* ## General (`/my-profile/general`) - **First name** and **Last name**. - Extra fields defined in [User fields](https://ulams-dev.github.io/ulams/admin/users/index.md#user-fields). - **Avatar**: upload an image (`POST /api/profile/upload-avatar`), pick one from the [file library](https://ulams-dev.github.io/ulams/admin/files/index.md) (folder `avatars/{your id}`) or delete it. **Submit** saves the form with `PUT /api/profile/me`. Your email and roles cannot be changed here; another administrator changes them on [Users](https://ulams-dev.github.io/ulams/admin/users/index.md). ## Change password (`/my-profile/change_password`) Enter your **current password**, the **new password** and its **confirmation**. The API (`PUT /api/profile/password`) checks that the current password matches and that the new one has at least 6 characters, and dispatches the `PasswordChanged` event (which has an email template; see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)). If you have forgotten your password, sign out and use **Forgot password** on the sign-in screen ([The admin panel](https://ulams-dev.github.io/ulams/admin/index.md#forgotten-password)). ## User settings (`/my-profile/user_settings`) A key–value table of settings stored on your account (`/api/admin/users/{id}/settings`). Frontends use these to remember per-user preferences. The toolbar has two actions: - **New** adds or changes the given keys and keeps the others (`PATCH`). - **Overwrite** replaces all your settings with the keys you enter (`PUT`). The same settings exist for every user, but the panel lets you edit only your own; the corresponding tab on other users' edit screens is disabled in the code. --- # Notifications > How ulams records in-app notifications for platform events, how to read them in the admin panel, and how to send bulk push messages to users. Canonical page: https://ulams-dev.github.io/ulams/admin/notifications/ ulams has three ways of telling people that something happened: | Kind | What it is | Where it is managed | |---|---|---| | Templated messages | Emails, SMS and PDFs generated from templates when an event fires | [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md) | | In-app notifications | A record of each event, stored for the user it concerns | this page, and Analytics → Notifications | | Push messages | Messages an administrator writes and sends to mobile devices | Users → Notifications (this page) | ## In-app notifications The [notifications](https://ulams-dev.github.io/ulams/reference/packages/notifications/index.md) package listens to every event of the `Ulams\…` packages and stores it as a database notification for the user the event concerns (for example `CourseAssigned` for the learner who was assigned). Events listed in the package's configuration are not stored. - **Learners** read their own notifications through `GET /api/notifications` and mark them as read (`POST /api/notifications/{id}/read`, `POST /api/notifications/read-all`). - **In the admin panel**, the bell in the top bar shows your own notifications, with a **Read all** action. - **Analytics → Notifications** (`/analytics/notifications`) lists the notifications of all users. It needs the `dashboard-app_notification-list_access` permission and is described in [Reports and analytics](https://ulams-dev.github.io/ulams/admin/reports-and-analytics/index.md). The list of event names is available at `GET /api/admin/notifications/events`; the events themselves are listed in [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Push messages **Users → Notifications** sends push messages through Firebase Cloud Messaging with the [bulk-notifications](https://ulams-dev.github.io/ulams/reference/packages/bulk-notifications/index.md) package. Only users whose device has registered a push token receive them: a mobile or web app registers the token with `POST /api/notifications/tokens` after the user signs in (permission `device-token_create`). | Screen | Route | Permission needed to see it | |---|---|---| | Sent push messages | `/users/notifications`, `/users/notifications/push` | `bulk-notification_list` | | New push message | `/users/notifications/push/new` | `bulk-notification_create` | *Screenshot: The list of sent push messages* The list shows each delivery: ID, the recipient's user ID, the title and the content. ### Sending a push message *Screenshot: The new push message form* 1. Open **Users → Notifications** and click **New**. 2. Enter the **Title** and the **Content**. 3. Choose **Users**, or leave the field empty to send to every user with a registered device. 4. Optionally add a **Redirect URL** (opened when the message is tapped) and an **Image URL**. 5. Click **Submit**. The message is sent immediately; it cannot be scheduled or recalled. With users selected the panel calls `POST /api/admin/bulk-notifications/send`; without, it calls `POST /api/admin/bulk-notifications/send/multicast`. ### Configuration Set these keys on the **Package Bulk Notifications** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md): - `ulams_bulk_notifications.push.service_account`: the Firebase service account JSON of the project your apps use. - `ulams_bulk_notifications.push.base_redirect_url`: the base URL for redirect links. > **Note:** Push messages reach only devices whose app has registered a token. Check that your learner > app calls the token endpoint before relying on this channel. --- # Other integrations > Connect ulams to MailerLite mailing groups and to Mattermost chat channels; both are configured through package settings and have no screens of their own. Canonical page: https://ulams-dev.github.io/ulams/admin/other-integrations/ Two integrations are installed with the API but have no admin screens. They react to platform events and are configured on their tabs in [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md), through the package configuration API (`POST /api/admin/config`) or in the config files. Both are **disabled by default**. > **Note:** For LTI 1.3 tools and platforms see [LTI 1.3 integrations](https://ulams-dev.github.io/ulams/admin/lti/index.md). For payment gateways > see [Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md). ## MailerLite The [mailerlite](https://ulams-dev.github.io/ulams/reference/packages/mailerlite/index.md) package keeps [MailerLite](https://www.mailerlite.com/) subscriber groups in sync with what users do: | Event | Action | |---|---| | `AccountConfirmed` (the user verified the account) | add to the registered users group, only if the user's newsletter attribute is true | | `ProductBought` | add to the paid orders group | | `AbandonedCartEvent` | add to the abandoned cart group | | `OrderCreated` | remove from the abandoned cart group | | `AccountBlocked` | delete the subscriber | Groups are found by name and created in MailerLite if they do not exist. ### Configuring MailerLite On the **Package Mailer Lite** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) (config file `ulams_mailer_lite`): | Key | Default | Meaning | |---|---|---| | `package_status` | `disabled` | `enabled` turns the listeners on | | `api_key` | none | the MailerLite API key | | `newsletter_field_key` | `newsletter` | the user attribute that holds newsletter consent, for example a boolean [user field](https://ulams-dev.github.io/ulams/admin/users/index.md#user-fields) | | `group_registered_group` | `Registered users` | group for confirmed accounts | | `group_order_paid` | `Users with paid orders` | group for buyers | | `group_left_cart` | `Left cart` | group for abandoned carts | 1. Create a boolean user field named `newsletter` (or set `newsletter_field_key` to an existing field) so that registration can record consent. 2. Enter the `api_key`. 3. Set `package_status` to `enabled`. ## Mattermost The [mattermost](https://ulams-dev.github.io/ulams/reference/packages/mattermost/index.md) package creates [Mattermost](https://mattermost.com/) accounts for users and adds them to a channel per course and per webinar: | Event | Action | |---|---| | `AccountConfirmed` | create the user in Mattermost | | `AccountDeleted` | remove the user | | `AccountBlocked` | block the user's Mattermost account | | `CourseAssigned` / `CourseUnassigned` | add the learner to the course channel as a member, or remove them | | `CourseTutorAssigned` / `CourseTutorUnassigned` | add the tutor to the course channel as a channel admin, or remove them | | `WebinarUserAssigned` / `WebinarUserUnassigned` | add the participant to the webinar channel, or remove them | | `WebinarTrainerAssigned` / `WebinarTrainerUnassigned` | add the trainer to the webinar channel as a channel admin, or remove them | Signed-in users can call `GET /api/mattermost/me`, `GET /api/mattermost/reset_password` and `GET /api/mattermost/generate_credentials` to get or reset their Mattermost credentials, for example from a "Open chat" button in a learner app. ### Configuring Mattermost On the **Package Mattermost** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) (config file `mattermost`): | Key | Meaning | |---|---| | `package_status` | `enabled` turns the listeners on (default `disabled`) | | `servers.default.host` | the Mattermost server host | | `servers.default.login`, `servers.default.password` | an administrator account the API uses | The same values can come from the environment: `MATTERMOST_HOST`, `MATTERMOST_LOGIN`, `MATTERMOST_PASSWORD` (and `MATTERMOST_SERVER`, `MATTERMOST_AUTH`, `MATTERMOST_TOKEN` for a token-based server entry); see [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md). > **Caution:** Package settings are written to the API config files unless `CONFIG_USE_DATABASE=true`, which > makes them shared by every tenant on the same API. See > [Where package configuration is stored](https://ulams-dev.github.io/ulams/admin/settings/index.md#where-package-configuration-is-stored). --- # Pages > Create and edit static pages such as terms of service or a privacy policy in the admin panel, and how frontends read them by slug. Canonical page: https://ulams-dev.github.io/ulams/admin/pages/ **Other activities → Pages** manages static content pages: terms of service, privacy policy, an about page. The [pages](https://ulams-dev.github.io/ulams/reference/packages/pages/index.md) package stores them per tenant. | Screen | Route | Permission needed to see it | |---|---|---| | Page list | `/other/pages` | `page_list` | | New or edit page | `/other/pages/:page` (`new` for a new page) | `page_read` | Saving and deleting need `page_create`, `page_update` and `page_delete`. *Screenshot: The list of static pages* The list shows ID, title, slug and author, with **Edit** and **Delete** on each row. ## Creating a page *Screenshot: The page form with title, slug and the content editor* 1. Click **New**. 2. Enter the **Title**. The **Slug** is filled in from the title; change it if you need a different URL. 3. Turn on **Active** to publish the page. 4. Write the **Content** in the markdown editor. Images inserted in the editor are uploaded to the `pages/{id}/wysiwyg` folder of the [file library](https://ulams-dev.github.io/ulams/admin/files/index.md). 5. Click **Submit**. ## How frontends show pages Pages are public: `GET /api/pages` lists them and `GET /api/pages/{slug}` returns one if it is active (an inactive page answers 403), so a frontend can link `/terms` to the page with slug `terms`. > **Note:** The legacy React learner app (`front/src`) renders pages at `/{slug}`. The reference learner > site (`front/web`) does not render static pages yet. --- # Policy lifecycle > Turn a policy document into one cited course per department, approve changes that update the courses and retrain the people they affect, and follow who is assigned and which policy version their certificate certifies. Canonical page: https://ulams-dev.github.io/ulams/admin/policy-lifecycle/ The policy lifecycle module starts from a policy document (Markdown, PDF or DOCX) and a list of departments. It prepares one [Course Builder](https://ulams-dev.github.io/ulams/admin/course-builder/index.md) course for each department, every lesson and quiz question citing the policy text, and gives the policy owner a dashboard of who is trained. Everything is available through the API (`/api/admin/policies`), the CLI (`ulams policies`) and the **Policies** screens of the Studio (`/studio/policies`, in English, Polish and Chinese). > **Note:** AI proposes, the owner approves. The module prepares each department's course up to the outline review. The owner approves the > outline, the generated lessons and the apply in the Studio, publishes the course, and then approves the policy version. No AI > decides who must take a course or whether anyone completed it. Uploaded policy text is treated as untrusted input: instructions > inside it never change the brief, the output schema or what is published. ## In the Studio The Studio rail has a **Policies** entry (for people with `policy_owner` or `policy_manage`). - **Policies** lists your policies with the version in force and any version in review. - **New policy** takes the file, the course length and the departments (name, seniority, prior experience, optional minutes) and creates the policy; nothing is generated yet. - **A policy** shows each department's stage with a link to its builder session, who is trained (assigned, completed, pending, overdue, completion rate), the people with their course version, policy version and certificate (filter by department and status, page through, export as CSV), the versions, and the buttons that apply now: generate the department courses (with the cost estimate), approve version 1 (the reasons it cannot be approved yet are listed), and upload a change. - **A version in review** shows what changed in the policy text, how each department's course is updated (with a link to its update in the Studio), the suggested change class with its reasons, the pre-flight (certificates to revoke and people to reassign per department, which follows the class you pick), the reason field (required to lower the class), approve, and reject with a reason. Every state is written out, tables scroll sideways in a focusable region on a small screen, and everything works by keyboard; the screens are checked with axe (WCAG 2.2 AA) at desktop and phone width. ## An academy of its own for a department A department can have a separate academy: its own tenant (database, files, theme and users), created from a tenant template. On the policy page each department has an **Own academy** block: pick a theme preset and an accent colour, and ask. The platform creates the tenant from the template (`POLICY_ACADEMY_TEMPLATE`, or the `template` you send), styled for the department, records it as created for that department, and moves the department's reviewed builder session there; its author is invited by e-mail and applies and publishes the course in the academy. Asking again after a failure resumes the same tenant and does not move the course twice. **Remove the academy** (after a confirmation) deletes that tenant with everything in it. It is a platform operation, so it needs `TENANCY_NEW_SITES=true` and a platform administrator, like a new site for a course (ADR 0048); a platform limit (`TENANCY_MAX_DERIVED_PER_PARENT`, default 5) applies and its message is shown if it is reached. What stays here: the policy, its versions and changes, the certificates and this dashboard. What the academy has: the department's course (cited as before), its own learners (invite or import them there) and its own certificates, which this dashboard does not count. Departments that need only a look and an address of their own, without separate data, use branded entry points inside one academy instead (ADR 0195, a separate effort). API: `GET|POST|DELETE /api/admin/policies/{policy}/variants/{variant}/academy`. ## For learners A person who was given training again because of a policy change sees it on **My training**: the policy and its new version, whether they take the exam or the course, and the source diff in one sentence (`GET /api/policies/my-changes`, only their own rows). The public verification page of a certificate that a policy change replaced says which policy version replaced it. ## Permissions | Permission | Allows | |---|---| | `policy_manage` | Every policy of the tenant: create, generate, approve, read the dashboard. The `admin` role has it. | | `policy_owner` | The policies the user owns. Give it to the people who own policies (HR, compliance, a team lead). | An admin can act for an absent owner; the audit records that the approver was not the owner. Both permissions also need the Course Builder permission (`course_builder_use`) for the owner to review the courses in the Studio. ## From document to courses 1. **Create the policy.** `POST /api/admin/policies` (multipart) with `title`, `file`, the shared `brief` (`totalMinutes`, `lessonMinutes`, `language`, `tone`) and `departments`. Each department has a `label`, an optional `group_id` (the audience; a new group is created when omitted), `seniority` (`junior`, `mid`, `senior`, `mixed`), `priorExperience` (`none`, `some`, `expert`) and optionally its own `totalMinutes`. The file is stored privately as version 1, a draft. Nothing is generated yet. 2. **Look at the estimate.** `GET /api/admin/policies/{policy}` returns an estimate of the generation cost per department, from the builder's per-lesson figure. It is an estimate, not a quote. 3. **Generate.** `POST /api/admin/policies/{policy}/variants/generate` starts one builder session per department, each with its own copy of the policy file as the source. Departments run one after the other. The module answers the builder's interview from the policy and department brief (seniority sets the level, prior experience is stated in the target group, a final test is always included) and stops at the outline review. 4. **Review in the Studio.** Approve the outline, let the lessons generate, approve the apply and publish the course, exactly as for any generated course. Each department's session is in the owner's list of builder sessions, titled ` / `. 5. **Approve the version.** `POST /api/admin/policies/{policy}/versions/1/approve` works once every department course is applied and published; the answer lists what is still missing otherwise. On approval each department's course becomes mandatory (`default_due_days` is the policy's major due days, 30 by default), a one-course learning path is created, and an enrolment rule `group equals ` enrols the group's members now and everyone who joins the group later. Reminders, escalation, certificates and the [compliance](https://ulams-dev.github.io/ulams/admin/compliance/index.md) reports apply unchanged. ## Changing the policy 1. **Upload the new file.** `POST /api/admin/policies/{policy}/versions` (multipart `file`). The first version must be approved and no other version may wait. The file becomes version N+1, in review, and a new revision of each department's source, so Living Course finds what changed and prepares one update proposal per department. A file with the same text is refused. A department whose course cites nothing that changed shows `no_change` and is left alone. 2. **Review.** `GET /api/admin/policies/{policy}/versions/{n}` returns the source diff (built from the stored fragment changes, not generated), each department's proposal and what still blocks approval, the suggested change class with its reasons, and a pre-flight: per department, how many certificates approving will revoke and how many people it will reassign. Decide each item of each proposal in the Studio (or `living-course` endpoints). Items the model could not propose a change for (for example final-test questions) are yours to edit; until you do, the exam carries the old question. 3. **Approve.** `POST .../versions/{n}/approve` with an optional `change_class` (`minor` or `major`), `reason` and `overwrite`. The class is suggested from the proposals: major when an item changes the meaning of a lesson, changes a quiz answer, adds a lesson or removes a question, otherwise minor. You may raise it freely; lowering it needs a `reason`, which is recorded. Every department course is updated; nothing below runs unless all of them are. If one fails, the version returns to review and approving again resumes. 4. **Roll out.** For everyone whose live certificate certified the previous version of a department's course, the certificate is revoked (reason `policy_superseded:v`) and they are given the exam (minor change, due in `minor_due_days`, 14 by default) or the department course (major change, `major_due_days`, 30) with the assignment source `policy_change`. People who never finished keep their open assignment and see the updated course. The rollout is idempotent per person and version. 5. **Replacement certificate.** Finishing the exam or the course issues a certificate as usual; it is linked to the new policy version. `POST .../versions/{n}/reject` (with a `reason`) drops a change in review: its proposals are rejected, the current version stays in force and nobody is retrained. The **exam course** is the department course's own final test, with every question cited to the policy, as a course of its own (one heading lesson and the final test). It is derived from the course you approved, rebuilt after every change, published and kept out of the catalogue. Compliance certifies whole courses, so assignment, certificates and reports work on it unchanged; there is no topic-level exam. Notices: each reassigned person gets one e-mail and one in-app notice with the source diff, the course or exam and the due date (`policy.retraining.assigned` webhook); the owner gets one notice with the counts per department (`policy.change.approved`). A revoked certificate that no policy change superseded sends the holder a notice too. Templates are editable like any other; Polish texts ship. Nothing here is decided by AI: the class is a suggestion, approval is the owner's, and completion is the course's own. ## The owner dashboard `GET /api/admin/policies/{policy}/dashboard` returns, per department, the stage of the generation (`waiting`, `ingesting`, `outline_review`, `generating`, `apply_review`, `applied`, `failed`) and the counts assigned, completed, pending and overdue; and a page of people with the course version they took, the policy version their certificate certifies, and the certificate with its verification path. Filters: `variant` (department), `status`, `per_page`. `GET /api/admin/policies/{policy}/dashboard/export` streams the same people as CSV. Each export is recorded in `compliance_exports` with who exported it. Scoped tokens use the `reports` area for both dashboard routes and the `builder` area for the rest. The people of the dashboard are also the `policy_training` dataset of the [report builder](https://ulams-dev.github.io/ulams/admin/report-builder/index.md) (one row per person and department, with the policy version the certificate certifies): `policy_manage` sees every policy, `policy_owner` only their own. The CSV export above stays as it is. ## Audit Every state change (`policy.created`, `policy.variants.requested`, `policy.version.submitted`, `policy.version.approved`, `policy.version.rejected`, `policy.certificate.revoked`, `policy.reassigned`, `policy.rollout.applied`) is written to the Living Course audit chain, so the existing audit export and verification cover it. ## Install Run the migrations and the permission seeder after an upgrade, once per tenant: ```bash php artisan migrate --force php artisan db:seed --class="Ulams\\PolicyLifecycle\\Database\\Seeders\\PolicyPermissionSeeder" --force ``` The module needs a configured `AI_DRIVER` and a queue worker for the builder queue, like the Course Builder. Without AI, creating a policy and reading its dashboard still work; generating is refused with a clear message. --- # Questionnaires > Build surveys with rating, text and review questions, attach them to courses, webinars or consultations and read the results. Canonical page: https://ulams-dev.github.io/ulams/admin/questionnaires/ A questionnaire is a list of questions attached to one or more courses, webinars or consultations. Learners answer it in the context of that object, and the admin panel shows the answers and a report per question. Typical uses: course feedback, star ratings and public reviews. The feature comes from the `questionnaire` package ([README](https://github.com/ulams-dev/ulams/blob/main/api/packages/questionnaire/README.md)). ## Who uses it - **Administrators and tutors** create questionnaires, attach them and read the results. The seeder gives both roles the same management permissions. - **Learners** answer through the public API. The legacy React learner app renders questionnaires; the reference frontend (`front/web`) does not yet. ## Screens ### List (`/other/questionnaire`) *Screenshot: The questionnaire list* All questionnaires with their title and active flag. Create, open or delete from here. ### Questionnaire form (`/other/questionnaire/:questionnaireId`) *Screenshot: The questionnaire form with its tabs* The form has these tabs: - **Questionnaire**: title and an **active** switch. - **Questions**: add, edit, reorder (by position) and deactivate questions. Each question has a title, a description, a type, a public-answers flag and, optionally, a maximum score. - **Answers**: the answers given so far, with a switch to hide or show each one. Hidden answers are not returned to learners. - **Assign** (one tab per model type: course, webinar, consultations): pick the objects this questionnaire belongs to. For each object you can set a **target group** (`user` or `author`) and a **display frequency** in minutes. Both values are stored and returned by the API; when to show the questionnaire is up to the frontend. - **Reports**: per-question results, as a chart for rating questions. You can filter by model type and object and export the answers for one object to a spreadsheet. ## Question types | Type | What the learner gives | |---|---| | `rate` | A numeric rating | | `text` | Free text | | `review` | A rating plus a text review; at most one review question per questionnaire | Ratings feed the star summaries returned by `GET /api/questionnaire/stars/{model_type}/{model_id}`. ## Model types Questionnaires attach to rows of the `questionnaire_model_types` table. Migrations add three: `course`, `webinar` and `consultations`. A new type needs a new row with a title and a model class. ## Settings | Key | Default | Meaning | |---|---|---| | `ulams_questionnaires.new_answers_visible_by_default` | `true` | Whether a new answer is publicly visible right away (questions with public answers turned off always store answers as hidden) | The key is administrable, so it can be changed under [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md). ## API - Admin: `/api/admin/questionnaire` (CRUD, assign and unassign, report, export), `/api/admin/question` (CRUD), `/api/admin/question-answers/{id}` (list, change visibility), `/api/admin/questionnaire-models` (model types). - Learner: `/api/questionnaire/{model_type}/{model_id}` to list, read and answer, plus star and answer summaries. Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions `questionnaire_list|read|create|update|delete`, `question_list|read|create|update|delete` and `question_answer_visibility_change`, given to `admin` and `tutor`. Tutors also get `questionnaire_list_authored`. The menu item needs `questionnaire_list` and can be hidden with the `hideInMenu-OtherQuestionnaire` setting. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Events The package dispatches no events and sends no notifications. ## Limitations - Deleting a question also deletes all its answers, and deleting a questionnaire deletes its questions, answers and assignments. There is no archive; switch the questionnaire to inactive instead if you want to keep the results. - Display frequency and target group are hints for the frontend; the API does not enforce them. > **Note:** Questionnaires are separate from quizzes. Graded quizzes are GIFT quiz topics; their attempts > are under Courses → Quiz reports. --- # Report builder > The datasets an administrator can build reports on, how a report definition asks for rows or groups, how small groups are withheld, how reports are saved, shared with roles, exported and scheduled, and where the BI feed is described. Canonical page: https://ulams-dev.github.io/ulams/admin/report-builder/ Poor reporting is the most common reason an organisation replaces its LMS. The **report builder** lets an administrator pick a dataset, choose columns, filters, grouping and a date range, save the result as a report, share it and schedule it. It is built in steps (ADR 0194). This page covers what exists today: the **dataset registry** and the **report definition** that is compiled into a safe query. > **Note:** You can list the datasets, build a report on the admin screen or through the API, save it, share it with roles, run or export > it (CSV, JSON lines, XLSX), schedule it by e-mail and offer it to a BI tool as a [read-only feed](https://ulams-dev.github.io/ulams/admin/bi-connectors/index.md). ## The admin screen **Analytics > Report builder** (`/analytics/report-builder`, shown to everyone with the permission `reporting_read`) builds the same definitions without writing JSON: 1. **Dataset**: pick one from the datasets you may run. A short description says what a row is. 2. **Kind of report**: *List rows* (choose columns; personal columns are marked) or *Group and aggregate* (group by columns, dates with a day, week, month, quarter or year bucket, and aggregates with a name each). 3. **Filters**, **Date range** (a period that is worked out on every run, or custom dates) and **Order and size**. 4. **Preview** shows at most 500 rows and says how many there are. Small groups that were withheld are explained above the table and appear as one marked row; the text is the same for every viewer. 5. **Save report** asks for a name, an optional description and who sees it: only you and the people who manage reports, or the roles you name. The note in the dialog repeats that sharing shares the report, not the data. Below the builder, **Saved reports** lists the reports you can see, who they are shared with, whether they are ready, need repair or cannot be run with your permissions, and when they last ran. **Open** loads a report into the builder (then *Save changes* updates it and *Save as a new report* copies it), **Export as CSV** and **Export as JSON lines** download a file, and **Delete** asks first. Every control has a label, the whole screen works with the keyboard, results are real tables, and state changes are announced to screen readers (WCAG 2.2 AA, checked with axe in the admin browser tests). The screen is available in English, Polish and Chinese. ## Datasets A dataset is a set of rows a report can be built on. The package that owns the data registers it, so a dataset appears only when its package is installed and its tables exist. | Dataset | One row is | Permission to run it | |---|---|---| | `assignments` | a required-training assignment: learner, course, due date, outcome, certificate | `compliance_report` | | `certificates` | a course certificate with the course version it attests | `compliance_report` | | `audit` | a hash-chained Living Course audit entry (needs Living Course) | `compliance_report` | | `authoring` | a course built with the Course Builder: time, cost, counts and the split of AI elements ([authoring metrics](https://ulams-dev.github.io/ulams/operators/authoring-metrics/index.md)) | `authoring_metrics_read` | | `ai_usage` | a model call: task, model, tokens, cost in USD, latency | `reporting_ai_usage` | Every dataset declares its columns: type (string, int, decimal, bool, date, datetime or enum), the filter operators it accepts, whether it can be grouped or aggregated, and whether it holds **personal** data (learner names and e-mail addresses). Personal columns are never groupable or aggregatable. A report can only use columns declared here: there is no way to name a table or write SQL. What the datasets leave out on purpose: - `ai_usage` has no prompt or response text, no error text, no request or subject ids and no user. - `audit` has no IP address, user agent or free-form payload, as in the audit export. - `authoring` has no per-person figures. Review time is empty, never zero, until it is recorded. - A learner who was deleted is not named in `assignments` or `certificates`; the id stays, so the row can still be counted. ## List the datasets `GET /api/admin/reporting/datasets` (permission `reporting_read`, seeded for administrators and tutors) returns the datasets the caller may run, each with its columns. A tutor sees only the datasets whose permission they hold. ```bash ulams reporting datasets --json ``` Each entry has `key`, `label`, `description`, `permission`, `subject_column` (the learner column used for small-group protection, null when the dataset holds no learner data), `aggregate_only`, `date_columns` and `columns`. ## Describe a report A report definition is JSON (schema `report-definition/v1`, in the `reporting` package). It asks one dataset for rows or for groups: ```json { "dataset": "assignments", "filters": [{ "column": "status", "op": "in", "value": ["overdue", "assigned"] }], "dateRange": { "column": "assigned_at", "preset": "last_90_days" }, "groupBy": ["course_title", { "column": "assigned_at", "bucket": "month" }], "aggregates": [{ "fn": "count_distinct", "column": "user_id", "as": "learners" }], "sort": [{ "column": "learners", "dir": "desc" }], "limit": 1000 } ``` | Part | Meaning | |---|---| | `columns` | A **row-level** report: the columns to list. Leave it out for a grouped report. | | `filters` | All of them apply. Operators: `eq`, `neq`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte`, `between`, `contains` (ignores case), `is_null` (`true` or `false`). Each column accepts only the operators its type allows, and values must have the column's type. | | `dateRange` | A date column and either a `preset` (`last_7_days`, `last_30_days`, `last_90_days`, `last_12_months`, `this_month`, `last_month`, `this_quarter`, `this_year`, `last_year`) or inclusive `from` and `to` dates. A preset is worked out every time the report runs. | | `groupBy` | A column name, or a date column with a `bucket` (`day`, `week`, `month`, `quarter`, `year`; weeks start on Monday). The output column of a bucket is named `_`. | | `aggregates` | `count`, `count_distinct`, `sum`, `avg`, `min`, `max`, each with an output name (`as`). `sum` and `avg` need a number, `min` and `max` a number or a date. | | `sort`, `limit` | Output columns and the most rows the report returns. | A grouped report returns its groups followed by its aggregates. Names are looked up in the dataset's declared columns, values are sent to the database as parameters, and the only SQL words that come from outside the dataset are the fixed list above, so a definition cannot read a table or column the dataset does not declare. Personal columns can be listed in a row-level report (and are then recorded like an export: who, which dataset, how many rows) but never grouped, aggregated, or used to filter a grouped report. `POST /api/admin/reporting/query` (permission `reporting_read` **and** the permission of the dataset; a token needs only `reports:read`, because a preview changes nothing) runs a definition with the caller's own permissions and returns at most 500 rows and the total: ```bash ulams reporting query --dataset assignments --group-by '["course_title"]' \ --aggregates '[{"fn":"count_distinct","column":"user_id","as":"learners"}]' --json ``` The answer has `data.columns` (name, type, label), `data.rows` and `meta`: `mode` (`rows` or `grouped`), `total_rows`, `preview_rows`, `truncated`, `withheld_groups` and `min_group_size`. A definition that cannot run answers `422` with the problem by path, for example `filters.0.op`. A grouped report with more than 100 000 groups is refused. ## Small groups are withheld On a dataset that holds learners (`assignments` and `certificates`), a grouped report never shows a group with fewer distinct learners than the threshold, **10** by default (`REPORTING_MIN_GROUP_SIZE`; when it is not set, the Learner Insights threshold `LEARNER_INSIGHTS_MIN_GROUP_SIZE` is used, so one number rules). The group's figures are not sent at all: it is replaced by one row marked `_withheld`, with the text "withheld (fewer than 10 learners)" in the first group column and empty figures. Withholding one group alone would not protect it: the total minus the visible groups would give it back. So the withheld groups together must span at least the threshold in distinct learners. When they do not, the smallest visible group is withheld with them. Learners who are in several groups (a learner in two courses) are counted once, not added up. `meta.withheld_groups` says how many groups are behind the row, never how many learners. A grand total (aggregates with no grouping) over fewer learners than the threshold is withheld the same way. Datasets without learners (`authoring`, `ai_usage`, `audit`) are not withheld. This protects the output of one report. It does not stop a person who may run row-level reports from reading individual rows, and it cannot stop two different queries from being subtracted from each other: who may see learner data at all is decided by the dataset's permission. ## Save and share a report A **saved report** is a name, a description and a definition. `POST /api/admin/reporting/saved` (permission `reporting_create`, administrators; the saver must also hold the permission of the dataset) stores it: ```bash ulams reporting save --input @report.json ``` with `name`, optional `description`, `definition`, and `visibility`: `private` (the default: the owner, and administrators who hold `reporting_manage`) or `roles` with `shared_roles` naming roles of this academy (for example `tutor`). Everyone who holds one of those roles and the permission `reporting_read` then sees the report in `GET /api/admin/reporting/saved`. **Sharing shares the definition, not the data.** A report always runs with the permissions and scope of whoever runs it. A tutor who opens a report an administrator shared sees only what the dataset's `baseQuery` allows that tutor, and a person without the dataset's permission gets "you cannot run this report" (`403`; the list marks it `runnable: false`). Small groups are withheld the same way for every viewer. Only the owner (who still holds `reporting_create`) or an administrator with `reporting_manage` changes or deletes a report. Deleted reports are kept out of every list. When a dataset is removed or renames a column a saved report uses, the report is not silently wrong: the list and `GET /api/admin/reporting/saved/{id}` show `needs_repair: true` with the problems by path, and running it answers `409` until it is fixed. ## Run and export `GET /api/admin/reporting/saved/{id}/run?format=json|csv|jsonl` runs the report as the caller: | Format | Answer | |---|---| | `json` (default) | like the query preview: `columns`, at most 500 `rows`, `meta` | | `csv` | every row up to 1 000 000 (`reporting.export_rows`) as a stream: UTF-8 with a BOM, text that a spreadsheet could read as a formula gets an apostrophe | | `jsonl` | the same rows as JSON lines; a withheld group is a row with `"_withheld": true` and empty figures | | `xlsx` | an Excel workbook with one sheet: the column labels as a bold, frozen header row with a filter, numbers and booleans as typed cells, text as text (a cell that starts with `=` is never a formula). An Excel sheet holds 1 048 575 data rows, so a longer report is cut there | Every CSV and JSON lines export is recorded with who ran it, the dataset, the definition, the saved report, the number of rows and the route it left by (`download`). The record is the same `compliance_exports` log the compliance export uses. ## Schedule a saved report `POST /api/admin/compliance/schedules` (permission `compliance_report`) takes `saved_report_id` instead of `dataset`, with `name`, `frequency` (`daily`, `weekly`, `monthly`, always at 06:00), `recipient_ids` (users of this academy) and a `format` of `csv`, `jsonl` or `xlsx` (XLSX is for saved reports only). The report must be one you can see, and it must not need repair. The report is **run once per recipient, with that recipient's own permissions and scope**, in one queued job each, and the file is mailed to that person: two people can get different rows from the same schedule. Every run is recorded as an export (channel `schedule`, the recipient, the saved report). A recipient who cannot run the report (they lost the dataset's permission, have no e-mail address, no longer exist) is skipped, and the person who created the schedule gets a mail that names who was skipped and why; `skipped_recipient_ids` on the schedule lists them. If the saved report was deleted nobody gets a file and the owner is told the same way. Existing schedules on a compliance dataset are unchanged. ## From the command line and from an agent The same report builder is a set of CLI commands and, in the MCP toolset `analytics` (`ulams mcp --toolsets analytics`), eight tools named from the command (`reporting.run` is `reporting_run`): | Command | Tool | Does | |---|---|---| | `ulams reporting datasets` | `reporting_datasets` | the datasets and every column with what it allows | | `ulams reporting query --file def.json` | `reporting_query` | a preview of a definition (a file, or inline for an agent) | | `ulams reporting list`, `show ` | `reporting_list`, `reporting_show` | saved reports you can see | | `ulams reporting run --format json\|csv\|jsonl\|xlsx [--out file]` | `reporting_run` | run a saved report with your permissions | | `ulams reporting save --name ... --file def.json [--role tutor]` | `reporting_save` | save a definition, private or shared | | `ulams reporting update [--feed on]` | `reporting_update` | change a report; the feed switch needs `reporting_manage` | | `ulams reporting delete ` | `reporting_delete` | delete (destructive: a plan and a confirm token first) | The reads (`datasets`, `query`, `list`, `show`, `run`) work with `--read-only`. The descriptions an agent reads say that the figures are the academy's own measurements and that withheld groups are withheld on purpose, so an agent does not try to recover them. The result keeps the report's own `meta` (`mode`, `total_rows`, `withheld_groups`, `min_group_size`). ## BI tools A saved report can be offered as a read-only OData v4 feed to Excel, Power BI and Tableau, with a token limited to that one report; Looker Studio, Metabase and Superset read the CSV. See [Connect a BI tool](https://ulams-dev.github.io/ulams/admin/bi-connectors/index.md). ## Tokens The report builder endpoints (datasets, query, saved reports and their runs) and the compliance report, its export and the compliance schedules belong to the **reports** token area: a scoped token needs `reports:read` (or `reports:write` to change schedules). Before this release the compliance report and schedules were under `certificates`; a token that was created for them with only `certificates:read` now needs `reports:read` as well. The rest of the compliance API (assignments, paths, rules, competencies, the dashboard) stays under `certificates`. --- # Reports and analytics > The Analytics menu of the admin panel, covering the notification log, course and tutor report charts, and the reports API. Canonical page: https://ulams-dev.github.io/ulams/admin/reports-and-analytics/ The **Analytics** menu groups two screens: a log of notifications sent to users and a reports dashboard with charts. The reports data comes from the `reports` package ([README](https://github.com/ulams-dev/ulams/blob/main/api/packages/reports/README.md)); the notification log comes from the `notifications` package. Course-level and quiz-level statistics are shown on the course itself and under Courses → Quiz reports; see [Creators](https://ulams-dev.github.io/ulams/creators/index.md). ## Notifications (`/analytics/notifications`) *Screenshot: The notification log filtered by user, event and date range* A table of the in-app notifications stored in the database: date, user and event. Without a user filter it lists your own notifications; pick a user to see theirs. You can filter by event type (the list comes from `GET /api/admin/notifications/events`) and by a date range. Seeing other users' notifications needs `dashboard-app_notification-list_access`, which the seeder gives to the `admin` role. Which events produce notifications is described in [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md) and [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Authoring (`/analytics/authoring`) One row per course built with the Course Builder: generation and AI edit time, interview time, author time, build and maintenance cost, the lessons and questions produced, and what became of the AI's elements (kept, revised on request, edited, unknown). Filter by the date the courses were created, and **Download CSV** or **Download JSON lines** for the same rows with every column and the `method_version` of the definitions. The menu entry and the page need the permission `authoring_metrics_read`, which the seeder gives to the `admin` role. Author time reads "Not recorded" until review time is recorded, never zero, and nothing is compared with another academy or an industry figure. The definitions, the API and the cost rules are in [Authoring metrics](https://ulams-dev.github.io/ulams/operators/authoring-metrics/index.md); authors see the same figures per course in the studio ([How a course was produced](https://ulams-dev.github.io/ulams/creators/course-production/index.md)). ## Reports (`/analytics/reports`) *Screenshot: Four pie charts: money spent, popularity and time spent per course, and tutor popularity* Four pie charts, each showing the top entries of one metric: | Chart | Metric class | What it counts | |---|---|---| | Money spent per course | `CoursesMoneySpentMetric` | Sum of paid order items for each course | | Course popularity | `CoursesPopularityMetric` | Users assigned to each course | | Time spent per course | `CoursesSecondsSpentMetric` | Learning time on each course | | Tutor popularity | `TutorsPopularityMetric` | Users assigned to courses authored by each tutor | The package also defines metrics the dashboard does not show: best rated courses, top-selling courses, and authored-only variants of popularity, money and time (for tutors who should see only their own courses). ### Metrics and history Each metric in `config/reports.php` has a `limit` (data points returned, default 10), a `history` flag and a `cron` expression. When `history` is `true`, the scheduler calculates the metric on that cron and stores it, and the API can return the value for a past `date`. In the shipped configuration every metric has `history: false`, so nothing is scheduled and each request calculates current values. Change the config file to keep history; there is no admin setting for it. ### Stats Stats are calculated on demand for one object and never stored: - **Course**: average time, average time per topic, money earned, people who bought, started and finished, finished topics, finished course, attendance list. - **Topic**: average time, GIFT quiz summary. - **Cart**: new customers, returning customers, spend per customer. - **Date range**: new users, active users, courses started and finished. Course and topic stats can be exported to a spreadsheet, and the course "finished topics" stat can be imported back from one. ## API - `GET /api/admin/reports/metrics`: enabled metrics. - `GET /api/admin/reports/available-for-user`: metrics the current user may see (their package is installed and they have the metric's permissions). - `GET /api/admin/reports/report?metric=…&limit=…&date=…`: one metric's data. - `GET /api/admin/stats/available`, `/stats/course/{id}`, `/stats/topic/{id}`, `/stats/cart`, `/stats/date-range`, plus `/export` and `/import` for course and topic stats. - `GET /api/admin/notifications`, `/notifications/{user}`, `/notifications/all`, `/notifications/events`. Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions | Screen | Needs | |---|---| | Analytics menu | Any of `dashboard-app_notification-list_access`, `report_list` | | Notifications | `dashboard-app_notification-list_access` | | Reports | `report_list` (given to `admin`) | > **Caution:** In the admin panel the Reports item is also hidden when the `hideInMenu-CoursesCategories` > setting is on (`admin/src/access.ts`). That looks like a copy-paste of the categories key; if > you hide categories, Reports disappears too. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Limitations - The dashboard is fixed to four charts; other metrics are reachable only through the API. - This dashboard has no scheduled or emailed reports. Completion, overdue and certificate numbers, scheduled e-mail reports and a CSV audit export exist in the `compliance` package behind the API, with no screen yet: see [Compliance](https://ulams-dev.github.io/ulams/admin/compliance/index.md). --- # Roles and permissions > Create roles, choose their permissions in the admin panel, and understand how permissions decide which menu items and API calls a user gets. Canonical page: https://ulams-dev.github.io/ulams/admin/roles-and-permissions/ Access in ulams is role based. Roles and permissions are [spatie/laravel-permission](https://spatie.be/docs/laravel-permission) records on the `api` guard, stored per tenant. A user's effective permissions are the permissions of all their roles plus any permissions given to the user directly (the only place the panel sets direct permissions is the [CSV import](https://ulams-dev.github.io/ulams/admin/users/index.md#import-users-from-csv-or-excel)). The [permissions](https://ulams-dev.github.io/ulams/reference/packages/permissions/index.md) package provides the role screens (`/api/admin/roles`). The full list of permission names, grouped by package, is generated in [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). | Screen | Route | Permission needed to see it | |---|---|---| | Role list | `/users/roles` | `permission_role_list` | | Role permissions | `/users/roles/:name` | `permission_role_update` | Creating and deleting roles is checked by the API with `permission_role_create` and `permission_role_delete`. ## Default roles Three roles are created by the core seeder and receive permissions from every package's permission seeder (`api/database/seeds/PermissionsSeeder.php`): | Role | Meant for | |---|---| | `admin` | Platform or tenant administrators. Each package seeder gives it that package's administrative permissions. | | `tutor` | Course authors and trainers. Can open the panel (`access dashboard`); package seeders give it a smaller set, often limited to the tutor's own records. | | `student` | Learners. Cannot open the admin panel. | When a database has no users yet, the seeder also creates the first administrator from the `INITIAL_USER_EMAIL` and `INITIAL_USER_PASSWORD` environment variables (see [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md)). Every new tenant runs this seeder during provisioning ([Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md)). ## The role list *Screenshot: The role list* The table shows each role's ID and name, with a search by name. **Edit** opens the permission matrix of the role; **Delete** removes it after confirmation. To create a role, click **New**, enter a name and confirm. The API stores the name as a slug (`Content editors` becomes `content-editors`) and the panel opens its permissions. ## Editing a role's permissions *Screenshot: The permission matrix of a role, grouped in cards* 1. Open a role from the list. 2. Permissions are grouped in cards by the part of the name before the first underscore: `user_list` and `user_create` are in the `user` card, `category_list` in `category`, and so on. Hover over a permission to see its description (the `permissions` translation group, if translated). 3. Tick or clear the checkboxes. **Reset** returns to the saved state. 4. Click **Submit**. The whole set is saved at once (`PATCH /api/admin/roles/{name}`). Users with the role get the new permissions on their next request to the API. The admin panel reads the current user's permissions only when it loads, so reload the panel to see menu changes. > **Caution:** The `admin` role cannot be changed or deleted through the API: saving its permissions or > deleting it returns an error. Its permissions come only from the seeders. Run > `php artisan db:seed --class=PermissionsSeeder` (with `--domain=` for a tenant) > after installing or upgrading packages so that `admin` gets the new permissions. ## How permissions map to the admin menu The panel shows a screen when your permissions satisfy its rule in [`admin/src/access.ts`](https://github.com/ulams-dev/ulams/blob/main/admin/src/access.ts). Most rules require `access dashboard`, then at least one permission from the list, and sometimes an installed package or a setting (see [Why a menu item is hidden](https://ulams-dev.github.io/ulams/admin/index.md#why-a-menu-item-is-hidden)). Some examples: | Menu item | Shown with any of | |---|---| | Users (group) | `user_list`, `permission_role_list`, `user-group_list` | | Users → List | `user_list` | | Users → Roles | `permission_role_list` | | Users → User groups | `user-group_list` | | Users → Notifications | `bulk-notification_list` | | Courses → Categories | `category_list` | | Configuration (group) | `file_list`, `settings_list`, `template_read`, `translation_list` | | Configuration → Settings | `settings_list` | | Configuration → Templates | `template_read` | | Other activities → Pages | `page_list` | | Other activities → Dictionary | `dictionary_list`, `dictionary_read` | | My profile | `user_read_self` | The API does not use these rules. Each endpoint has its own policy, usually with separate permissions for listing, reading, creating, updating and deleting, and some with a `_self` or `_course-authored` variant that limits the action to the user's own records. A role that should edit, and not only see, a screen needs those permissions too. ## Designing a custom role 1. Start from what the person must do in the panel and tick `access dashboard`. 2. For each screen, tick the list and read permissions that show it, then the create, update and delete permissions for the actions you want to allow. 3. Sign in as a test user with the role and check both the menu and the actions; a missing write permission shows up as an error message when saving. Roles and permissions are per tenant, so repeat the setup in every tenant that needs the role. --- # Sales > Products, orders, payments and vouchers in the admin panel, the payment gateways, and how a paid order grants course access today. Canonical page: https://ulams-dev.github.io/ulams/admin/sales/ The **Sales** menu is where you sell access to learning content: you wrap courses, webinars, consultations, stationary events and dictionaries in **products**, learners buy them through a cart, and the platform records **orders** and **payments**. **Vouchers** give discounts at checkout. This is the commerce stack inherited from Wellms. The roadmap replaces it with a separate Sylius service (see the last section of this page); until then, everything on this page is what runs. Who uses it: administrators and sales staff with the cart, payment and voucher permissions. ## Screens | Screen | Route | What you do there | |---|---|---| | Orders | `/sales/orders` | List orders with subtotal, tax, total, items, buyer and status; filter by date range, user, product and status. | | Payments | `/sales/payments` | List payments with amount, currency, status and the paid-for object (`payable`); filter by date range and status. | | Vouchers | `/sales/vouchers` | List discount codes. | | Voucher form | `/sales/vouchers/:voucherId/` | Create or edit a voucher (`new` creates one). | | Products | `/sales/products` | List products. | | Product form | `/sales/products/:id`, `/sales/products/:id/:tab` | Create or edit a product, in tabs. | *Screenshot: Orders list in the admin panel* *Screenshot: Products list in the admin panel* ### Product form tabs - **Attributes**: name, the productables it sells (one or more courses, webinars and so on, each with a quantity), type, purchasable flag, price, old price, tax rate, extra fees, duration, per-user and total limits, teaser URL, language, related products and description. For subscription types also the period and duration, auto-renew (`recursive`) and an optional trial (period and duration). App Store and Play Store IDs appear when the RevenueCat integration package is installed. - **Media**: poster. - **Categories**: categories and tags. - **Users attached**: who owns the product. You can attach or detach users by hand, which grants or removes access without an order. - **User submissions**: answers to custom fields submitted for the product. - **Template**: trigger a notification template manually for every user of the product. Product types (`ProductType`): `single`, `bundle`, `subscription`, `subscription-all-in`. *Screenshot: Product form with its tabs* ### Voucher form A voucher has a name, a code, a type, active flag, an "exclude promotions" flag, an active-from and active-to window, a total usage limit, a per-user limit, minimum and maximum cart value, and an amount. It can be limited to products, categories or users, or exclude products and categories. Voucher types (`CouponTypeEnum`): | Type | Discount | |---|---| | `cart_fixed` | Fixed amount off the cart | | `cart_percent` | Percentage off the cart | | `product_fixed` | Fixed amount off the included products | | `product_percent` | Percentage off the included products | Learners apply a code to their cart with `POST /api/cart/voucher` and remove it with `DELETE /api/cart/voucher`. *Screenshot: Voucher form* ## Payment gateways The `payments` package picks a driver per payment. Drivers in `api/packages/payments/src/Gateway/Drivers`: | Driver | Used for | Configuration | |---|---|---| | `free` | Always used when the amount is 0; it refuses non-zero payments. | None | | `stripe` | Card payments through a Stripe PaymentIntent. Callbacks are accepted only with a valid `Stripe-Signature` header or after the PaymentIntent is fetched from the Stripe API. | `PAYMENTS_STRIPE_SECRET_KEY`, `PAYMENTS_STRIPE_PUBLISHABLE_KEY`, `PAYMENTS_STRIPE_WEBHOOK_SECRET`, `PAYMENTS_STRIPE_WEBHOOK_TOLERANCE`, `PAYMENTS_STRIPE_API_BASE` | | `przelewy24` | Redirect payments through Przelewy24 (Polish bank transfers, BLIK, cards), using the vendored `przelewy24-php` API client. | `PAYMENTS_PRZELEWY24_LIVE`, `PAYMENTS_PRZELEWY24_MERCHANT_ID`, `PAYMENTS_PRZELEWY24_POS_ID`, `PAYMENTS_PRZELEWY24_API_KEY`, `PAYMENTS_PRZELEWY24_CRC` | | `revenuecat` | Mobile in-app purchases. Off by default; a purchase is accepted only when a server-side receipt verifier class is configured. | `PAYMENTS_REVENUECAT_ENABLED`, `PAYMENTS_REVENUECAT_RECEIPT_VERIFIER` | The default gateway (`PAYMENTS_DEFAULT_GATEWAY`, default `Stripe`) and currency (`PAYMENTS_DEFAULT_CURRENCY`, default `USD`) apply unless the checkout request names a `gateway` and `currency`. `GET /api/payments-gateways` lists the gateways, whether each is enabled and which parameters the frontend must send (for example `return_url` and `payment_method` for Stripe, `return_url` and `email` for Przelewy24). Gateway credentials, enable flags, default gateway and default currency are also administrable settings (`ulams_payments.*`), so they can be changed per tenant in the admin settings without a redeploy. Secret keys are stored but not exposed publicly. See [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) and [Settings reference](https://ulams-dev.github.io/ulams/reference/settings/index.md); environment variables are listed in [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md). Payment statuses: `new`, `redirect`, `paid`, `failed`, `cancelled`, `refunded`. ### Stripe webhook and 3-D Secure Stripe confirms payments to `POST /api/payments-gateways/webhook/stripe` on the API host (one URL per Stripe account). In the Stripe dashboard, add an endpoint with that URL and subscribe it to `payment_intent.succeeded`, `payment_intent.payment_failed` and `payment_intent.canceled`. Copy the endpoint's signing secret (`whsec_...`) into `PAYMENTS_STRIPE_WEBHOOK_SECRET` (or the administrable `ulams_payments.drivers.stripe.webhook_secret` setting). Without the secret the webhook answers 400 and only the `payment_intent` returned on the checkout redirect can confirm a payment. When the card needs 3-D Secure, `POST /api/cart/pay` returns a `redirect_url` in `data`. The legacy learner front sends the browser to that URL; the return goes to the `return_url` of the request. ## How a purchase grants access today 1. The learner adds products to the cart (`POST /api/cart/products`) or buys a single product directly (`POST /api/product/{id}/pay`, which answers 403 for a product that is not purchasable or whose limits are reached). 2. `POST /api/cart/pay` turns the cart into an **order** (status `PROCESSING`, or `TRIAL_PROCESSING` for a trial) and creates a **payment** for it. Zero-value orders go through the `free` driver and are paid immediately. Price, currency, product type and trial settings always come from the product; of the request body only `gateway`, `payment_method`, `return_url`, `email` and `channel` reach the payment drivers, and anything else (such as `currency`, `amount` or `has_trial`) is ignored. 3. For Stripe or Przelewy24, the payment either succeeds at once or returns a redirect URL. The gateway later calls `/api/payments-gateways/callback/{payment}` (Stripe also has `/api/payments-gateways/webhook/stripe`). The callback runs in a transaction with the payment row locked; rejected (unverified) callbacks are logged and ignored, and an already settled payment is left untouched, so repeated notifications do not fire events twice. 4. A successful payment fires `PaymentSuccess`. The cart's `PaymentSuccessListener` marks the order `PAID` (or `TRIAL_PAID`) and fires `OrderPaid`. Marking an already paid order is a no-op. 5. For each order item the order service fires `ProductBought` and attaches the product to the buyer (`products_users`, respecting `limit_per_user`; subscriptions get an end date). Then each productable in the product is attached: for a course this enrols the learner (with the subscription end date, if any) and fires `CourseAssigned` and `CourseAccessStarted`. Products can sell `Course`, `Webinar`, `Consultation`, `StationaryEvent` and `Dictionary` (registered in `api/app/Providers/ShopServiceProvider.php`). Access can also be granted without payment: attach a user on the product's **Users attached** tab, or assign the course directly (see [Users](https://ulams-dev.github.io/ulams/admin/users/index.md)). > **Note:** The reference learner site (`front/web`) has no cart or checkout yet; the cart API is used by the > legacy React learner app (`front/`). Invoices are generated on demand as PDF from > `GET /api/order-invoices/{id}` for the order's buyer or a user who can list all orders; seller > details and currency come from the `invoices` settings. ## Subscriptions and scheduled jobs The `cart` package schedules: - `RenewRecursiveProduct` hourly and `ExpireRecursiveProduct` daily, for subscription products. - `cart:abandoned-event` daily at 01:00: finds carts abandoned 24 to 48 hours ago and fires `AbandonedCartEvent`. Learners cancel a subscription with `POST /api/products/cancel/{id}`. See [Scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md). ## API endpoints | Area | Endpoints | |---|---| | Orders (admin) | `GET /api/admin/orders`, `GET /api/admin/orders/{id}`, `GET /api/admin/orders/export` | | Products (admin) | `GET`, `POST /api/admin/products`; `GET`, `PUT`, `DELETE /api/admin/products/{id}`; `POST /api/admin/products/{id}/attach` and `/detach`; `POST /api/admin/products/{id}/trigger-event-manually/{idTemplate}`; `/api/admin/productables` (list, registered types, product of a productable, attach, detach) | | Payments (admin) | `GET /api/admin/payments`, `GET /api/admin/payments/{payment}`, `GET /api/admin/payments/export` | | Vouchers (admin) | `GET`, `POST /api/admin/vouchers`; `GET`, `PUT`, `PATCH`, `DELETE /api/admin/vouchers/{id}` | | Learner | `/api/cart` (view, set quantity, add missing, remove, add productable), `/api/cart/voucher`, `/api/cart/pay`, `/api/product/{id}/pay`, `/api/products` (catalogue, `my`, cancel), `/api/orders`, `/api/payments`, `/api/order-invoices/{id}` | | Gateways | `GET /api/payments-gateways`, callbacks, Stripe webhook | The export endpoints exist in the API; the admin screens do not show an export button. Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions | Permission | Allows | |---|---| | `cart_order_list` | Orders screen and any order | | `orders_export` | Order export | | `products_list` | Open a product | | `products_manage` | Products list, create, edit, delete, attach users | | `products_list_purchasable`, `products_buy` | Learner catalogue and purchase | | `payment_list`, `payment_read`, `payment_export` | Payments screen, details, export | | `coupon_list`, `coupon_read`, `coupon_create`, `coupon_update`, `coupon_delete` | Vouchers | | `coupon_use` | Apply a voucher at checkout | The **Sales** menu appears when the user has any of `cart_order_list`, `payment_list`, `coupon_list` or `products_manage`. See [Permissions reference](https://ulams-dev.github.io/ulams/reference/permissions/index.md) and [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md). ## Events and notifications | Event | Package | Used by | |---|---|---| | `OrderCreated` | cart | Email template; MailerLite | | `OrderPaid`, `OrderCancelled` | cart | | | `ProductBought` | cart | MailerLite | | `ProductAttached`, `ProductDetached`, `ProductableAttached`, `ProductableDetached` | cart | `ProductAttached` email template | | `ProductAddedToCart`, `ProductRemovedFromCart`, `AbandonedCartEvent` | cart | `AbandonedCartEvent`: MailerLite | | `PaymentRegistered`, `PaymentSuccess`, `PaymentFailed`, `PaymentCancelled` | payments | Email templates | Configure the templates under [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md). Full list: [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Settings | Key | Meaning | |---|---| | `ulams_payments.default_gateway` | `Free`, `Stripe` or `Przelewy24` | | `ulams_payments.default_currency` | Default currency | | `ulams_payments.drivers.*` | Enable flags and credentials per gateway | | `ulams_cart.min_product_price` | Minimum product price (default 0) | | `invoices.*` | Payment term (`date.pay_until_days`), currency, seller name, address, code, VAT, phone, SWIFT | ## Known limitations - Refunds are not an admin action. The only refund path is automatic: a trial paid with a card check is refunded right after the gateway confirms it. - `GET /api/order-invoices/{id}` sits outside the `auth:api` group; it relies on the order policy and is useful only to an authenticated owner or admin. - Access is granted inside the platform from the verified gateway callback, not from the frontend redirect, but there is no reconciliation job for missed callbacks. ## Planned: Sylius commerce (Coming) The spec moves commerce to a separate **Sylius 2.x** headless service (roadmap Phase 6.4): Sylius will own catalogue, cart, checkout, taxes and invoices, while the LMS keeps an entitlements model and stays the only system that decides who has access. Access will be granted only from signed, idempotent Sylius order events plus a reconciliation job, behind a `CommerceProvider` interface. The LMS half exists: the `entitlements` package grants and revokes purchased access idempotently, and the signed order webhook with its reconciliation command is tested against a test-only provider. The Sylius service, its adapter, catalogue sync and checkout are not built (plan `docs/plans/phase-6-commerce.md`, milestones CM-3 onwards); see the [Roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md) and the [Phase 0 commerce audit](https://github.com/ulams-dev/ulams/blob/main/docs/reports/phase-0-audit.md). --- # Settings > Edit tenant settings in the admin panel, from global keys and the learner theme and accent to package configuration, and how each kind is stored. Canonical page: https://ulams-dev.github.io/ulams/admin/settings/ **Configuration → Settings** (`/configuration/settings`, permission `settings_list`) edits two different kinds of data, both provided by the [settings](https://ulams-dev.github.io/ulams/reference/packages/settings/index.md) package: | | Settings | Package configuration | |---|---|---| | What it is | Free key–value rows with a group, key, type and value | Laravel config keys that packages register as administrable | | Examples | `global.companyName`, `theme.accent`, `hideInMenu-CoursesCategories` | `ulams_auth.registration`, `ulams_payments.default_currency`, `mattermost.package_status` | | Who defines the keys | You, or the panel's suggestions | The packages, in code | | Stored in | the tenant database (`settings` table) | see [Where package configuration is stored](#where-package-configuration-is-stored) | | Read by clients | `GET /api/settings` (public rows) | `GET /api/config` (public keys) | | Admin API | `/api/admin/settings` | `/api/admin/config` | | Tabs | User settings, Global settings | one tab per package | The tab is part of the URL: `/configuration/settings/:tab`. *Screenshot: The settings screen with the User settings, Global settings and package tabs* ## Settings rows Every row has: - **Group** and **Key**: the name, for example group `global` and key `frontURL`. - **Type**: `text`, `markdown`, `json`, `file`, `image`, `boolean`, `number` or `array`. The value editor changes with the type: a file picker for `file` and `image`, a markdown editor, a JSON editor, a checkbox for `boolean`. - **Public**: the row can be read without signing in. - **Enumerable**: the row is included in the list `GET /api/settings`. A public row that is not enumerable can only be read by name (`GET /api/settings/{group}/{key}`). - **Sort**: the order in the list. Public, enumerable rows are what frontends read to brand the site. They are also available in templates as global variables (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md#variables)). ### User settings tab Lists the rows of every group except `global` and filters them by group. Use **New** to add a row in any group, **Edit** and **Delete** on existing rows. Despite the name, these are tenant settings, not settings of a single user; per-user settings are on [My profile](https://ulams-dev.github.io/ulams/admin/my-profile/index.md). ### Global settings tab *Screenshot: The Global settings tab with suggested keys* Lists the rows of the `global` group. The panel also suggests the keys it understands: a suggested key that does not exist yet has a **Create** button instead of **Edit**, pre-filled with the type and a default value. If the tenant has no global rows at all, the screen shows a warning to add them. | Key | Type | Used for | |---|---|---| | `companyName`, `companyURL` | text | The organisation name and website, shown by frontends and in templates | | `frontURL` | text | The learner site URL: the dashboard's **Go to platform** button and the email verification link sent from the user form | | `logo` | image | The logo in the admin panel menu | | `logoLogin` | image | The logo on the admin sign-in screen | | `logoFooter` | image | The footer logo | | `footerFontColor` | text | Footer text colour | | `showLoginBackgroundImage` | boolean | Background image on the admin sign-in screen | | `loginHeaderBackgroundColor`, `loginHeaderFontColor`, `loginFormBackgroundColor` | text | Colours of the admin sign-in screen | | `contentBackgroundColor` | text | Background colour of the admin panel content area | | `technicalMaintenance`, `technicalMaintenanceText` | boolean, text | A maintenance flag and message for frontends | | `maxLessonsNestingInProgram`, `minTopicNestingInProgram` | number | Limits of lesson nesting in the course program editor | | `disable-ECommerce` | boolean | Hides the Sales menu | | `disable-Certificates` | boolean | Hides the PDF (certificate) templates tab | | `disableTopicType-{type}` | boolean | Hides a topic type in the course editor, one key per type | | `hideInMenu-{Route}` | boolean or array | Hides a menu item, one key per admin route (for example `hideInMenu-CoursesCategories`) | | `hideInCourseTabs-{tab}` | boolean | Hides the `statistics`, `user_submission` or `user_projects` tab of the course editor | | `showInCourseAdditionalSettings-public` | boolean | Shows the `public` switch in the course editor | | `hideTemplateTab-email`, `hideTemplateTab-sms` | boolean | Hides a tab on the Templates screen | | `templates.email.visual_editor` | boolean | `false` removes the Visual mode of the e-mail template editor, leaving Code view; on when missing | The `hideInMenu-*`, `hideTemplateTab-*` and `disable-*` switches can also hold an array of role names: the item is then hidden only for users whose every role is in the array. See [Why a menu item is hidden](https://ulams-dev.github.io/ulams/admin/index.md#why-a-menu-item-is-hidden). Saved global settings take effect in the panel without a reload. ## Learner site theme and accent The reference learner site (`front/web`) styles each tenant with a theme preset and an accent colour, both read from public settings in the `theme` group ([ADR 0004](https://ulams-dev.github.io/ulams/decisions/0004-css-custom-properties-theming/index.md)): | Group and key | Value | Effect | |---|---|---| | `theme.theme` | `coffee`, `oncall`, `nightsky`, `gravity`, `poland` or `ulam` | The preset. Any other value falls back to the preset named like the tenant slug, else `coffee`. | | `theme.accent` | a hex colour, `#C2552D` or `#C52` | Overrides the accent CSS variables (`--ulams-color-accent`, `--ulams-color-primary`, …). An invalid value is ignored. | The site does not use the accent as is for text: it darkens or lightens it until it reaches a 5:1 contrast ratio on the theme background (3:1 for large type), and picks black or white for text on it, so WCAG AA contrast holds whatever colour you choose. 1. Open **User settings** and filter by group `theme`. 2. Edit `accent` (or create it: group `theme`, key `accent`, type `text`), enter the colour and keep **Public** and **Enumerable** on. 3. Reload a page of the learner site. New tenants get both rows from `php artisan ulams:tenant:create … --theme=… --accent=…`; see [Tenants](https://ulams-dev.github.io/ulams/admin/tenants/index.md). ### Propose a theme from a brand `proposeBrandTheme()` in `@ulams/ui/theme/brand-import.ts` turns pasted brand input into a proposal, with no agent: a JSON object of colours, CSS custom properties (`--brand-primary: #c2552d;`), colours from a URL query, or a plain list of colours. It picks the preset with the same light or dark mood and the nearest accent hue, uses the brand colour as `theme.accent`, and returns the contrast checks (the brand accent, the accent as rendered after the adjustment above, and brand text on the brand background). `themeDiff()` lists what approving it would change against the current settings. The proposal is data only: nothing is saved until an admin sets `theme.theme` and `theme.accent` (or runs `ulams theme set`). Tenant themes keep the preset's own page colours, so a brand background only chooses light or dark. Logos and fonts are not imported. ### Propose a theme from a style profile A [style profile](https://ulams-dev.github.io/ulams/creators/style-profiles/index.md) made from an uploaded style guide can carry a theme preset and an accent. Its studio page links to this screen with the profile in the address (`?styleProfile=`). The screen reads the profile and shows its preset and accent in the same *Proposed changes* table as an imported brand (`proposeFromStyleTheme()` in `@ulams/ui/theme/brand-import.ts`), with the contrast checks and, when the accent is too weak, the readable shade. A profile that sets only a preset keeps the current accent. Nothing is saved until you choose **Approve and save**. ## Package configuration tabs > **Note:** These tabs show only the keys that packages register with > `AdministrableConfig::registerConfig()`. The complete list, with validation rules and which > keys are public or read-only, is generated in [Settings keys](https://ulams-dev.github.io/ulams/reference/settings/index.md). There is one tab per config file, named after it (`ulams_auth` is shown as **Package Auth**). Each row shows the key, whether it is **readonly** and **public**, and the current value; **Edit** opens a form validated with the package's rules. Read-only keys are shown but cannot be changed. Loading the tabs needs `settings_config_list`; saving needs `settings_config_update`. Frequently used keys: | Key | Purpose | |---|---| | `ulams_auth.registration` | `enabled` or `disabled`: whether self-registration is open | | `ulams_auth.account_must_be_enabled_by_admin` | new accounts wait for an administrator to activate them | | `ulams_auth.auto_verified_email` | new accounts are verified without the email link | | `ulams_auth.return_url` | the link in the verification email of accounts created in the panel; the panel cannot create users while it is empty | | `services.google.*`, `services.facebook.*` | social login credentials | | `ulams_interactive.enabled` | `true` by default: Interactive topics can be played. Off: launches answer 404, the course editor hides the type and existing topics show their text version ([Interactive](https://ulams-dev.github.io/ulams/creators/interactive/index.md)) | | `ulams_interactive.allow_network` | `false` by default: when `true`, the origins a package lists under `network` in its manifest are added to its `connect-src` | | `ulams_code_exercises.enabled` | `true` by default: code exercises can be opened and their runs reported. Off: launches and attempts answer 404 and the course editor hides the type ([Code exercises](https://ulams-dev.github.io/ulams/creators/code-exercises/index.md)) | | `ulams_payments.*` | payment gateways and currency ([Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md)) | | `sms.*` | SMS driver and Twilio credentials ([Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md#sms-templates)) | | `ulams_templates_email.mjml.*` | MJML rendering ([Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md#email-templates)) | | `ulams_bulk_notifications.push.*` | Firebase credentials for push messages ([Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md)) | | `ulams_mailer_lite.*`, `mattermost.*` | [Other integrations](https://ulams-dev.github.io/ulams/admin/other-integrations/index.md) | ### Where package configuration is stored The `settings` package config key `ulams_settings.use_database` (environment variable `CONFIG_USE_DATABASE`, default `false`) decides where saved values go: - **`true`**: values are stored in the tenant database (`config` table) and cached, and loaded on every request on top of the config files. Each tenant has its own values. - **`false`** (default): the panel writes the values into the API's PHP config files (`config/.php`). This rewrites the whole file, drops comments and replaces `env()` calls with their current values, and the files are shared by every tenant served by the same API deployment. > **Caution:** On a multi-tenant deployment set `CONFIG_USE_DATABASE=true` before changing package > configuration in the panel; see [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md). --- # Stationary events > Publish in-person events with a place, dates, participant limit and program, assign authors, and sell seats as a product. Canonical page: https://ulams-dev.github.io/ulams/admin/stationary-events/ A stationary event is an in-person event: a workshop, a meetup, a classroom session. It has a place, start and end dates, a participant limit, a program and an agenda. Seats are sold through the event's product, and participants can also be added by hand. The `stationary-events` package holds the data; there is no check-in or attendance tracking. ## Who uses it - **Administrators and tutors** manage events. With the default roles both have the full set of `stationary-event_*` permissions; there are no `-own` variants, so a tutor can edit any event. - **Learners** see published events on the learner site and in their account (`GET /api/stationary-events/me`). ## Screens ### Event list `/other/stationary-events` (Other activities → StationaryEvents). Columns: ID, name, started at and finished at. The entry can be hidden with the dashboard setting `hideInMenu-OtherStationary-events`. *Screenshot: Stationary events list in the admin panel* ### Event form `/other/stationary-events/:id/:tab` (`new` to create). Tabs: | Tab | Content | |---|---| | Attributes | Name, place, authors, maximum participants, status, started at, finished at, short description, program and description | | Agenda | Agenda items | | Product | Price and sale settings (see [Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md)) | | Media | Cover image | | Categories | Categories | | User submission | Assign participants by e-mail, including people without an account yet | The tabs other than Attributes appear after the first save. *Screenshot: Stationary event form with the Attributes tab* ### Statuses | Status | Meaning in the code | |---|---| | `draft` | Not listed publicly | | `published` | Listed publicly | | `published_unactivated` | Also listed publicly by `GET /api/stationary-events` | | `archived` | Not listed publicly | > **Note:** The public list filters on `published` and `published_unactivated` only. The code does not show > any other behaviour tied to `published_unactivated`. ## API endpoints | Method and path | Purpose | |---|---| | `GET /api/admin/stationary-events`, `POST /api/admin/stationary-events` | List and create | | `GET/PUT/DELETE /api/admin/stationary-events/{id}` | Read, update, delete | | `GET /api/stationary-events`, `GET /api/stationary-events/{id}` | Public list and detail | | `GET /api/stationary-events/me` | Events the current user is assigned to | Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions | Permission | admin | tutor | |---|---|---| | `stationary-event_list`, `stationary-event_read`, `stationary-event_create`, `stationary-event_update`, `stationary-event_delete` | yes | yes | See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Events and notifications | Event | When | |---|---| | `StationaryEventAssigned` | A user is attached to the event (purchase or manual assignment) | | `StationaryEventUnassigned` | A user is detached | | `StationaryEventAuthorAssigned` | An author is added | | `StationaryEventAuthorUnassigned` | An author is removed | No e-mail or SMS templates are registered for these events in `templates-email` or `templates-sms`. There are no scheduled reminders. See [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Known limitations - No reminders, check-in, attendance or waiting list. - `max_participants` is stored and shown; the package itself does not refuse assignments above the limit. - The learner site (`front/web`) shows events read-only under `/events`; buying a seat needs the legacy learner app or a custom front. See [Learners](https://ulams-dev.github.io/ulams/learners/index.md). --- # Tasks > Create to-do tasks for users, link them to a course, lesson or topic, track completion and send overdue reminders. Canonical page: https://ulams-dev.github.io/ulams/admin/tasks/ A task is a to-do item with a title, an optional description and type, an optional due date and an optional link to a course, lesson or topic. Administrators create tasks for any user; learners can create tasks for themselves. Either side can add notes to a task. The feature comes from the `tasks` package ([README](https://github.com/ulams-dev/ulams/blob/main/api/packages/tasks/README.md)). ## Who uses it - **Administrators** assign tasks to users and confirm that assigned tasks are done (**Other activities → Tasks**). - **Learners** manage their own tasks through the learner API. The legacy React learner app has a "My tasks" screen (`/user/my-tasks`); the reference frontend (`front/web`) does not show tasks yet. ## Screens ### Task list (`/other/tasks`) *Screenshot: The task list with title, type, author, assignee and completion date* The list shows the ID, title, type, author, assigned user and completion date of every task. You can search by title, by the type of the linked resource and by author, open a task, create a new one or delete one. ### Task form (`/other/tasks/:task`) *Screenshot: The task form with assigned user, linked resource and notes* - **Title** (required), **description**, **type** (free text) and **due date** (today or later). - **User**: the person the task is assigned to (required). - **Related**: a course, lesson or topic picked from the course tree. It is stored as a `related_type` and `related_id` pair. - **Complete / incomplete**: mark the task as done or reopen it. - **Notes**: a thread of notes on the task. Each note records who wrote it. ## How completion works - A task is **assigned** when its author and its user are different people. - When the assigned user marks the task complete through the learner API, the task is **not** completed. Instead a completion request goes to the author (`TaskCompleteRequestEvent`). - When the author (or an administrator through the admin API) marks it complete, `completed_at` is set and the assigned user is told the task was accepted (`TaskCompleteUserConfirmationEvent`). - Reopening a task clears `completed_at` and notifies the assigned user (`TaskIncompleteEvent`). - A user's own task (author = user) is completed directly, with no request. ## Overdue reminders A scheduled job (`OverdueTaskJob`) runs **daily**. Each run fires `TaskOverdueEvent` for every uncompleted task whose due date lies between now and the overdue period ago, so a user keeps getting a reminder every day until the task is completed or the period has passed. Older tasks are not reminded about. The period is `ulams_tasks.notifications.overdue_period`, in days, default `30`. It is administrable, so you can change it under [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) without a deploy. The job needs the Laravel scheduler to run; see [Scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md). ## Events and notifications | Event | When | |---|---| | `TaskAssignedEvent` | An assigned task is created | | `TaskUpdatedEvent` | An assigned task is updated | | `TaskDeletedEvent` | An assigned task is deleted | | `TaskCompleteRequestEvent` | The assigned user asks the author to accept the task | | `TaskCompleteUserConfirmationEvent` | The author accepts the task as done | | `TaskIncompleteEvent` | An assigned task is reopened | | `TaskOverdueEvent` | The daily overdue check | | `TaskNoteCreatedEvent` | A note is added | The `templates-email` package registers email template variables for these events, and the `notifications` package stores them as in-app notifications. Edit the emails under [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md); see also [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## API - Admin: `GET|POST /api/admin/tasks`, `GET|PATCH|DELETE /api/admin/tasks/{id}`, `POST /api/admin/tasks/complete/{id}`, `POST /api/admin/tasks/incomplete/{id}`, and `POST|PATCH|DELETE /api/admin/tasks/notes[/{id}]`. - Learner: the same shape under `/api/tasks`, limited to the user's own tasks. All endpoints need a signed-in user. Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions The seeder gives the `admin` role every task permission and the `student` role the `-own` variants (`task_create-own`, `task_list-own`, `task-note_create-own` and so on). The admin menu item needs `task_list`. Admin endpoints check `task_list`, `task_find`, `task_create`, `task_update` and `task_delete`. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Limitations - Learners cannot assign tasks to other users; only the admin API takes a `user_id`. - **Type** is a free-text field with no predefined values. - A task has one assignee. To give the same task to a group, create one task per user. > **Note:** The admin panel shows the menu item to anyone with `task_list`; the API still checks the finer > permissions on each action. --- # Teacher and competency challenges > Admin screens for teacher subjects and competency challenges that are still in the panel but have no backend in this repository. Canonical page: https://ulams-dev.github.io/ulams/admin/teacher-and-competencies/ > **No backend in this repository:** The **Teacher** and **Competency challenges** screens are left over from the admin panel that > ULAMS forked. They call API packages that are not in `api/packages`: `ulams/pcg-integration`, > `ulams/pcg-grades`, `ulams/pcg-attendances` and `ulams/competency-challenges`. None of their > endpoints exist and none of their permissions are seeded, so the menu items stay hidden on > every tenant. This page records what the screens are so they are not mistaken for working > features. ## Why the menus are hidden The admin panel asks `GET /api/core/packages` which packages are installed. That endpoint lists the modules in `api/packages` (from `api/packages/versions.json`) plus any installed composer packages under `ulams/`. The access rules in `admin/src/access.ts` require the matching package for each screen: | Screen | Needs package | Needs one of these permissions | |---|---|---| | Teacher → Subjects (`/teacher/subjects`) | `ulams/pcg-integration` | `pcg-integration_semester-subject_list`, `pcg-integration_semester_list`, `pcg-integration_academic-year_list` | | Subject details (`/teacher/subjects/:subjectId[/:tab]`) | `ulams/pcg-integration`, `ulams/pcg-grades`, `ulams/pcg-attendances` | grade, exam and attendance permissions such as `exam_list` or `attendance_list-admin` | | Competency challenges (`/competency-challenges/list`, `/competency-challenges/:id/:tab`) | `ulams/competency-challenges` | `competency-challenges_list`, `_read`, `_create`, `_update`, `_delete`, `competency-challenge-scale_*` | None of those packages is reported, so the screens are hidden whatever the user's role. ## Teacher → Subjects *Screenshot: The teacher subject list* Written for a university integration ("PCG"): a tutor sees the semester subjects they teach. The subject view has tabs for groups, students, exams with results, schedule, a class register with attendance, the grade scale, final grades and a history of exported grade files. The screens call endpoints such as `/api/admin/semester-subjects`, `/api/admin/exams`, `/api/admin/final-grades`, `/api/admin/grade-terms`, `/api/admin/schedules` and `/api/admin/pcg-export`. None of them exists in this API. ## Competency challenges *Screenshot: The competency challenge list* A competency challenge is a `simple` or `complex` assessment built from quiz question categories, with scales that map results to levels and a diagnostic-test tab. The screens call `/api/admin/competency-challenges` and `/api/admin/competency-challenges/scales`, which do not exist in this API. ## What replaced them A competency framework per tenant, with AI-suggested tags that the author confirms and learner skill profiles, is built in the `compliance` package (API only, no admin screen yet): see [Compliance](https://ulams-dev.github.io/ulams/admin/compliance/index.md#competencies-and-skill-profiles). It is a new design, not a revival of these screens. ## Related settings The menu items can also be hidden with the `hideInMenu-Teacher`, `hideInMenu-TeacherSubjects` and `hideInMenu-Competency-challengesList` settings; see [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md). --- # Templates > Edit the email, PDF and SMS templates that ulams sends when an event happens, use variables, preview them and choose which template is used. Canonical page: https://ulams-dev.github.io/ulams/admin/templates/ Every message ulams sends to a user, and every certificate it generates, comes from a template stored in the tenant database. **Configuration → Templates** edits them. ## How events become messages ```mermaid flowchart LR E[Domain event
e.g. ResetPassword] --> L[Template listener] L --> A{Template assigned
to the item?} A -- yes --> T[Assigned template] A -- no --> D[Default template
for event + channel] T --> R[Fill in variables] D --> R R --> C[Channel: email, SMS or PDF] ``` The [templates](https://ulams-dev.github.io/ulams/reference/packages/templates/index.md) package listens to every `Ulams\…` event. The channel packages register, in code, which events they support and which variables each event provides: `Template::register(Event, Channel, Variables)`. When a registered event fires, the listener, for each channel: 1. picks the template **assigned** to the item the event is about, if the event type supports assignment (for example a certificate assigned to one course), otherwise the **default** template for that event and channel, in the language of the course, the academy's default language or English (see [Languages](#languages)); 2. skips the channel and writes an error to the log if there is no template, or if the template is invalid (for example it lacks a required variable); 3. replaces the variables and hands the result to the channel, which sends the email or SMS or generates the PDF. So a message is sent only if a default (or assigned) template exists. Each channel package has a seeder that creates a default template, named `Default template for event … on … channel`, for every registered event that has none: `TemplatesEmailSeeder` (run by the API's `DatabaseSeeder`), `TemplateSmsSeeder` and `TemplatesPdfSeeder`. Tenant provisioning does not run them, so check the lists on a new tenant. The complete list of events and the template types registered for them is generated in [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). | Channel | Package | Sections you edit | Sent to | |---|---|---|---| | Email | [templates-email](https://ulams-dev.github.io/ulams/reference/packages/templates-email/index.md) | `title` (subject), `content` (MJML) | the user's email | | PDF | [templates-pdf](https://ulams-dev.github.io/ulams/reference/packages/templates-pdf/index.md) | `title`, `content` (a fabric.js design) | stored as a PDF for the user | | SMS | [templates-sms](https://ulams-dev.github.io/ulams/reference/packages/templates-sms/index.md) | `content` (text) | the user's `phone`; nothing is sent without one | ## The templates screen | Screen | Route | Permission needed to see it | |---|---|---| | Template lists (tabs Email, PDF, SMS) | `/configuration/templates/:template` | `template_read` | | New or edit template | `/configuration/templates/:template/:id` (`new` for a new template) | `template_read` | Saving and deleting need `template_create`, `template_update` and `template_delete`; generating PDFs manually needs `events_trigger`. The tabs can be hidden with the `hideTemplateTab-email` and `hideTemplateTab-sms` settings, and the PDF tab with `disable-Certificates` (see [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md)). *Screenshot: The email template list* Each list shows ID, creation date, name, event and whether the template is the default, with **New**, **Edit** and **Delete**. ## Editing a template *Screenshot: The template form with event, variables and content editor* 1. Open a tab and click **New**, or **Edit** on a row. 2. Enter a **Name** and choose the **Event**. The event list contains only events registered for this channel, and the choice decides which variables you can use. 3. Tick **Set as default template** if this template should be used for the event. 4. Fill in the sections. Above each section the form lists the event's variables; the **required variables** must appear in the template, otherwise it is saved as invalid and never sent. A new template is pre-filled with the event's default content. 5. Click **Submit**. ### Variables Variables are written with an `@` prefix, for example `@VarUserName` or `@VarCourseTitle`. There are two kinds: - **Event variables**, defined by the variable class registered for the event. The form shows them for the selected event (they come from `GET /api/admin/templates/variables`). - **Global variables** built from the tenant [settings](https://ulams-dev.github.io/ulams/admin/settings/index.md): every public, enumerable setting that is not of type `json` becomes `@GlobalSettings` followed by its key and type in camel case. For example `global.companyName` of type `text` becomes `@GlobalSettingsCompanyNameText`. Markdown values are converted to HTML and file and image values to URLs. You can keep recurring blocks, such as an email header and footer, in settings and use them as global variables in every template. When such a setting changes, the email templates that use it are rendered again in the background. ### Preview **Preview** renders the template with mocked variable values and sends the result to you: the email to your address, the SMS to your phone number. A PDF preview is not sent anywhere. ## Email templates The `content` section is [MJML](https://mjml.io/), which is rendered to HTML when the template is saved, not when each email is sent. The renderer is configured on the **Package Templates Email** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) (`ulams_templates_email.mjml.*`): either the MJML API (`use_api`, `api_url`, `api_id`, `api_secret`) or a local `mjml` binary (`MJML_BINARY_PATH` in the environment). `default_template` is the MJML wrapper into which the content is placed (`@VarTemplateContent`). In the editor the code is on the left, with a list of the variables of the event (choose one to insert it at the cursor), and a preview with sample data on the right. The preview shows your unsaved changes, lists MJML errors, missing required variables and accessibility warnings, and **Send a test e-mail** sends the current content to your own address. See [E-mail](https://ulams-dev.github.io/ulams/operators/email/index.md#in-the-admin) for details. The switch above the editor also offers a **Visual** mode, an editor for the same MJML that works with the mouse (drag and drop) and fully with the keyboard. A template it cannot represent without losing markup stays in Code view, and conversion needs your confirmation after a diff. In Visual mode variables are chips, shared headers and footers from Settings are locked blocks (edit them in Settings), and images are uploaded to your own storage with required alternative text (PNG, JPEG, GIF or WebP, no SVG). How to use it without dragging: above the canvas, **Structure and keyboard tools** has a block list with **Add block**, the actions Move up, Move down, Remove, Edit text, Undo and Redo, the structure of the e-mail as a tree (arrow keys; selecting a block there selects it in the canvas) and a form with the properties of the selected block (link, alternative text, colours, spacing). Alt+Up and Alt+Down move a block, Delete removes it, Enter edits a text block or opens the image dialog, and Escape ends text editing. Changes are announced to screen readers. The full key list is under **Keyboard map** in the panel and in [Visual mode](https://ulams-dev.github.io/ulams/operators/email/index.md#visual-mode). Email templates exist for events of most packages: account registration, verification, blocking and deletion, password reset and change, group membership, course access and deadlines, payments, tasks, webinars and consultations, video processing, users imported from CSV and invitations of people without an account. ### Languages An e-mail template can be written for one language. On the template page, the **Languages** panel shows English, Polski and 中文 for the event: the ones that have a template, and the ones marked **Missing translation**. **Create translation** starts a new template for the missing language as a copy of the one you have, **Copy content from** copies another template's content into the form, and the **Language** field sets the language of the template. The list has **Language** and **Translations** columns, so you can see which events still miss a language. The language of an e-mail is the language of the course it is about, then the academy's default language, then English, then a template without a language. The full order, the seeded defaults and the API fields are in [E-mail](https://ulams-dev.github.io/ulams/operators/email/index.md#templates-per-language). ## PDF templates PDF templates are certificates and other documents designed in a visual editor (fabric.js). They are registered for `CourseFinished`, so a certificate is generated when a learner finishes a course, and for the manually triggered event. A certificate can be assigned to a specific course in the course editor; see [Content creators](https://ulams-dev.github.io/ulams/creators/index.md). For a template of the manually triggered event, the form has **Generate PDF**: choose users and generate the document for them now. Products have a similar action. Generated PDFs are listed under the form. ## SMS templates SMS templates are registered for consultation events (term approved, rejected, reported and reminders) and the manually triggered event. Sending needs a driver configured on the **Package Sms** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md): - `sms.default`: `twilio`, `requestbin`, or `mail` (sends the text as an email to `@sms.com`, useful only for testing); - `sms.drivers.twilio.sid`, `token` and `from` for Twilio, or the `TWILIO_SID`, `TWILIO_TOKEN` and `TWILIO_FROM` environment variables. > **Caution:** Templates are data in the tenant database. A template you delete or leave invalid is simply > skipped: the event still happens, but nobody is notified, and the only trace is an error in > the API log. --- # Tenants > Create, list, update and delete tenants with the ulams:tenant commands, each with its own database, bucket, keys and theme. Canonical page: https://ulams-dev.github.io/ulams/admin/tenants/ One ulams API deployment serves the **platform** and any number of **tenants**. Each tenant has its own hosts, database, storage bucket, encryption and token keys, Redis prefix and theme. Tenants are managed from the command line on the platform, or over HTTP with the [platform tenant API](https://ulams-dev.github.io/ulams/operators/platform-api/index.md) (off by default); there is no admin screen for them. This page is for operators who create and maintain tenants. For how tenant resolution works inside the code, see [Tenancy](https://ulams-dev.github.io/ulams/developers/tenancy/index.md) and [ADR 0007](https://ulams-dev.github.io/ulams/decisions/0007-tenancy-package/index.md). ## What a tenant gets For a tenant with the slug `coffee`, with the default naming: | Resource | Value | |---|---| | API | `http://coffee.localhost` | | Learner front | `http://coffee.app.localhost` | | Admin panel | `http://coffee.admin.localhost` | | Content origin | `http://coffee.content.localhost` (written as `CONTENT_ORIGIN`) | | PostgreSQL role and database | `ulams_coffee` | | S3 bucket and, on the bundled SeaweedFS, its own key limited to the bucket | `ulams-coffee`, public read | | Env file | `.env.coffee.localhost` on top of the platform `.env` | | Storage directory | `storage/coffee_localhost/` | | Passport keys | `storage/coffee_localhost/oauth-*.key` | | Redis prefix | `ulams_coffee_` (cache `ulams_coffee_cache`, Horizon `ulams_coffee_horizon:`) | | E-mail domain | `coffee.ulams.app` (sender `no-reply@coffee.ulams.app`) | Every tenant has its own `APP_KEY` and Passport key pair, so a token issued by one tenant is rejected by every other. The tenant also gets its own LTI signing keys and its own `H5P_INTERNAL_TOKEN` for calls between the API and the H5P service. The **content origin** is a separate host that serves only SCORM, cmi5 and similar packages and their players: no cookies and no API. Uploaded package code therefore never runs on the API or front origin. The registry is the `tenants` table in the platform database. Secrets in it (database password, `APP_KEY`, Passport keys) are encrypted with the platform `APP_KEY`. The env files, domain registrations and key files are derived from that table and can be rebuilt at any time (see [sync-env](#rebuild-env-files-ulamstenantsync-env)). > **Caution:** A request to a host that is neither a platform host (`TENANCY_PLATFORM_HOSTS`) nor a > registered tenant gets a 404. Without this, the multi-domain library would serve the unknown > host with the platform configuration. In Kubernetes, add the hosts used by health checks to > `TENANCY_PLATFORM_HOSTS`. ## Commands All `ulams:tenant:*` commands run **on the platform**, without `--domain`. They refuse to run inside a tenant. In the Docker setup prefix them with `docker compose exec api`. ### Create or update a tenant: `ulams:tenant:create` ```bash php artisan ulams:tenant:create coffee \ --name="The Coffee Atlas" --theme=coffee --accent="#C2552D" --users=5 ``` | Argument / option | Meaning | |---|---| | `slug` | Lowercase letters and digits. Used for the hosts, database and bucket names. | | `--name=` | Display name: `APP_NAME`, the mail sender name and the `global.companyName` setting. | | `--theme=` | Front theme preset key, stored as the `theme.theme` setting. The reference front knows `coffee`, `oncall`, `nightsky`, `gravity`, `poland` and `ulam`. Letters, digits, `-` and `_`, up to 40 characters. | | `--accent=` | Accent colour as `#RRGGBB`, stored as the `theme.accent` setting. | | `--users=5` | Number of demo students to create (default 5). | | `--demo=on` / `--demo=off` | Turns [demo mode](https://ulams-dev.github.io/ulams/admin/demo-mode/index.md) on or off (`DEMO_MODE` in the env file). | | `--redo=` | Runs a step again even if it is recorded as done. Repeatable. | The command is **resumable**. Each finished step is recorded on the tenant row (`tenants.steps`). If a step fails, the tenant is marked `failed`, the error is printed, and running the same command again continues from the first unfinished step. Running it for an existing tenant updates it. Changing `--name`, `--theme` or `--accent` rewrites the env file and re-runs the `demo` step (which stores the settings). Changing only `--demo` rewrites only the env file. The steps, in order: | Step | What it does | |---|---| | `database` | Creates the PostgreSQL role and database through the `pgsql_admin` connection (needs `CREATEROLE`/`CREATEDB`). | | `bucket` | Creates the bucket and a public read policy. | | `storage_identity` | With `TENANCY_S3_IDENTITY_DRIVER=seaweedfs`: creates the tenant's own object store key, limited to its bucket, and keeps an encrypted copy on the tenant row. Nothing happens with `none` (the tenant uses the platform key). See [Object storage](https://ulams-dev.github.io/ulams/operators/storage/index.md#one-key-per-tenant). | | `env` | Registers the host and writes `.env.`. | | `migrate` | `migrate --force` in the tenant database. | | `passport_keys` | Generates the Passport key pair; an encrypted copy is stored on the tenant row. | | `passport_client` | Creates the personal access client. | | `permissions` | Seeds roles and permissions and creates the admin user. | | `lti_keys` | Creates the tenant's LTI signing keys (`ulams:lti:rotate-keys --init`, see [LTI](https://ulams-dev.github.io/ulams/admin/lti/index.md)). | | `demo` | Creates the tutor and the students and stores the name, front URL, theme and accent settings. | Every step from `migrate` on runs as a child process `php artisan … --domain=`, so it uses the tenant configuration and not the platform one. Child processes time out after `TENANCY_PROCESS_TIMEOUT` seconds (default 900). When it finishes, the command prints the tenant URLs and the seeded accounts: - `admin@.ulams.app` (admin) - `tutor@.ulams.app` (tutor) - `student1@.ulams.app` … `studentN@.ulams.app` All of them get the password from `TENANT_DEMO_PASSWORD` (default `secret`). This is meant for development; change the passwords of any tenant that is not a throwaway demo. > **Note:** The help text of `--redo` lists every step except `lti_keys`, but the command accepts any > step name from the table above. ### List tenants: `ulams:tenant:list` ```bash php artisan ulams:tenant:list php artisan ulams:tenant:list --hosts ``` The table shows slug, name, theme, demo mode, status (`provisioning`, `active`, `failed`), the API, front and admin hosts, and the finished steps (for example `9/9`). With `--hosts` it prints only the API hosts of active tenants, one per line; the worker scripts use this. A tenant created before a step was added (for example `lti_keys`) shows fewer finished steps, such as `8/9`. Run `ulams:tenant:create ` again to run the missing step. ### Rebuild env files: `ulams:tenant:sync-env` ```bash php artisan ulams:tenant:sync-env php artisan ulams:tenant:sync-env --migrate ``` Rebuilds the `.env.` files, domain registrations and Passport key files of every tenant from the `tenants` table. `--migrate` also runs pending migrations in every tenant database. The container start script (`api/init.sh`) runs it with `--migrate` after the platform migrations, so a fresh container or pod gets all tenants back. It runs without `--migrate` when `DISABLE_DB_MIGRATE=true`, and not at all when `DISABLE_TENANT_SYNC=true`. ```bash php artisan ulams:tenant:sync-env --rotate-storage-keys # tenants without a key get one, others get an additional key php artisan ulams:tenant:sync-env --prune-storage-keys # delete the old keys once every process uses the new one php artisan ulams:tenant:sync-env --rotate-storage-keys --tenant=coffee php artisan ulams:tenant:ensure-buckets # create missing buckets and re-apply the public read policy ``` `--rotate-storage-keys` adds a key and rewrites the env file; the old key keeps working until `--prune-storage-keys`, so queue workers and the H5P service can be restarted in between. `ensure-buckets` is what you run after moving to another object store. Because the env files are generated, edit tenant values through `ulams:tenant:create`, not by hand: hand edits are overwritten on the next sync. ### AI settings per tenant: `ulams:tenant:set-env` Every tenant inherits the platform AI settings (`ANTHROPIC_API_KEY`, `AI_DRIVER`, `AI_MODEL_*`, `ANTHROPIC_BASE_URL`) when `create` or `sync-env` writes its env file, so one platform key serves all tenants and a changed key reaches them on the next `sync-env` (which also runs on container start). A tenant can override them: ```bash php artisan ulams:tenant:set-env coffee --set=ANTHROPIC_API_KEY=sk-... --set=AI_MODEL_DEFAULT=... php artisan ulams:tenant:set-env coffee --set=AI_DRIVER=disabled php artisan ulams:tenant:set-env coffee --unset=ANTHROPIC_API_KEY # inherit the platform value again ``` Overrides are stored encrypted in the `tenants` table and only the listed keys are accepted. The command prints key names, never values; the key is never logged. See ADR 0063. ### Delete a tenant: `ulams:tenant:delete` ```bash php artisan ulams:tenant:delete coffee --force ``` Without `--force` the command refuses. With it, it drops the database and role, the bucket contents, the env file, the storage directory and the tenant's Redis keys. This cannot be undone. ### Templates and tenants created for a purpose A **template** is a named starting point for new tenants: theme, accent, demo flag, demo users and inheritable settings. It applies only when a tenant is created (an existing tenant is never changed by it, and changing a template later does not touch the tenants made from it); options you pass to `ulams:tenant:create` win over it. ```bash php artisan ulams:tenant:template policy-academy --name="Policy academy" --theme=coffee --accent="#C2552D" --users=0 --set=AI_DRIVER=fake php artisan ulams:tenant:create acmesales --template=policy-academy --theme=nightsky php artisan ulams:tenant:template policy-academy --delete ``` A tenant can also be created **for another tenant and a purpose**, which is how a department gets an academy of its own (`--derived-from=acme --purpose=policy_department --reference=`). The platform records it (who asked, for what, when; the row stays after the tenant is deleted), runs it once per reference (asking again resumes the same tenant), allows at most `TENANCY_MAX_DERIVED_PER_PARENT` active ones per parent (default 5) and refuses chains (a derived tenant cannot create tenants). `ulams:tenant:delete` refuses a tenant that has some, unless `--with-derived` deletes them first. Each academy is a tenant like any other: its own database, role, bucket and object-store key (with `TENANCY_S3_IDENTITY_DRIVER=seaweedfs`), env file and Redis prefix. ## Typical workflow 1. Create the tenant on the platform: `docker compose exec api php artisan ulams:tenant:create acme --name="Acme Academy" --theme=coffee --accent="#1F6FEB"` 2. Make the hosts resolve. Locally, `*.localhost` resolves to `127.0.0.1` on most systems; otherwise add `acme.localhost`, `acme.app.localhost`, `acme.admin.localhost` and `acme.content.localhost` to `/etc/hosts`. 3. Open `http://acme.admin.localhost` and log in as `admin@acme.ulams.app`. 4. Queue workers and the scheduler pick the new tenant up on their next pass; no restart is needed. ## Configuration Platform environment variables of the tenancy package (defaults in [`api/packages/tenancy/src/config.php`](https://github.com/ulams-dev/ulams/blob/main/api/packages/tenancy/src/config.php)): | Variable | Default | Purpose | |---|---|---| | `TENANCY_PLATFORM_HOSTS` | `api.localhost,localhost,127.0.0.1,caddy,api` | Hosts served with the platform `.env`. | | `TENANCY_ENFORCE_HOSTS` | `true` | Answer 404 to unknown hosts. | | `TENANCY_SCHEME` | `http` | Scheme of the generated URLs. | | `TENANCY_API_HOST`, `TENANCY_FRONT_HOST`, `TENANCY_ADMIN_HOST`, `TENANCY_CONTENT_HOST` | `{slug}.localhost`, `{slug}.app.localhost`, `{slug}.admin.localhost`, `{slug}.content.localhost` | Host patterns. | | `TENANCY_EMAIL_DOMAIN` | `{slug}.ulams.app` | Domain of the seeded accounts and the mail sender. | | `TENANCY_DATABASE`, `TENANCY_BUCKET`, `TENANCY_REDIS_PREFIX` | `ulams_{slug}`, `ulams-{slug}`, `ulams_{slug}_` | Resource names. | | `TENANCY_STORAGE_PUBLIC_URL` | `http://storage.localhost` | Public base URL of the object store; the bucket name is appended. | | `TENANCY_S3_ENDPOINT`, `TENANCY_S3_REGION`, `TENANCY_S3_KEY`, `TENANCY_S3_SECRET` | the `AWS_*` values | Object store used to create buckets. | | `TENANCY_ADMIN_CONNECTION` | `pgsql_admin` | Database connection with rights to create roles and databases. | | `TENANCY_DATABASE_PROVISIONER` | `admin` | `manual`: you create each tenant database (shared hosting); the `database` step only checks the login. Pass its password to `ulams:tenant:create --db-password=` (16+ characters). See [Install on MyDevil](https://ulams-dev.github.io/ulams/operators/install-mydevil/index.md). | | `TENANCY_S3_IDENTITY_DRIVER`, `TENANCY_S3_IAM_ENDPOINT` | `none`, the S3 endpoint | `seaweedfs`: one object store key per tenant through the store's IAM API. `none`: every tenant uses the platform key (AWS S3, R2). | | `TENANCY_S3_PUBLIC_READ_POLICY` | `true` | `false` for stores without bucket policies (Cloudflare R2): no policy is attached; make the buckets public yourself. | | `TENANT_DEMO_PASSWORD` | `secret` | Password of the seeded accounts. Development only. | | `TENANCY_PROCESS_TIMEOUT` | `900` | Timeout of each child `artisan` process, in seconds. | | `TENANCY_PLATFORM_API` | `false` | Turn on the [platform tenant API](https://ulams-dev.github.io/ulams/operators/platform-api/index.md) (`/api/platform/*`, `ulams tenants`). Platform hosts only. | | `TENANCY_MAX_DERIVED_PER_PARENT` | `5` | How many active tenants one tenant may have created for a purpose (a department academy). | | `TENANCY_NEW_SITES` | `false` | Lets an author with the `platform_admin` permission create a new site for a course from the Course Builder. | | `TENANCY_PLATFORM_HOST` | `api.localhost` | The host platform commands run under when a tenant's queue worker has to create a tenant. | See also [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md) and [Artisan commands](https://ulams-dev.github.io/ulams/reference/artisan-commands/index.md). ## Known limitations - With `TENANCY_S3_IDENTITY_DRIVER=none` (external S3) all tenants use the same object store credentials; isolation is per bucket, not per key. The bundled SeaweedFS gives each tenant its own key. - There is no admin UI for tenants. They are managed with the artisan commands above or, when `TENANCY_PLATFORM_API=true`, over HTTP and with `ulams tenants` ([Platform tenant API](https://ulams-dev.github.io/ulams/operators/platform-api/index.md)). - Theme presets are defined in the frontends. The reference front (`front/web`) uses the `theme.theme` setting if it is a known preset, else the slug if that names a preset, else `coffee`. - The older setup that declares domains through `MULTI_DOMAINS` environment variables still works; see [api/docs/multidomain.md](https://github.com/ulams-dev/ulams/blob/main/api/docs/multidomain.md) and the [tenancy package README](https://github.com/ulams-dev/ulams/blob/main/api/packages/tenancy/README.md). --- # Translations > Override the API's and frontends' texts per language with database translations, and change the labels of the admin panel itself. Canonical page: https://ulams-dev.github.io/ulams/admin/translations/ The [translations](https://ulams-dev.github.io/ulams/reference/packages/translations/index.md) package stores translation lines in the tenant database. A line has a **group**, a **key** and a **text** per language, and a **public** flag. Two screens under **Configuration** edit them; both need the `translation_list` permission, the `ulams/translations` package, and can be hidden with the `hideInMenu-ConfigurationTranslations` and `hideInMenu-ConfigurationAdminTranslations` settings. Creating, updating and deleting lines need `translation_create`, `translation_update` and `translation_delete`. ## Translations (API and frontends) *Screenshot: The translations list with group and key filters* `/configuration/translations` lists all database lines with their group, key and texts, and filters them by group and key. **New** and **Edit** open a form with: - **Group** and **Key**: for API messages, the Laravel translation file and key. For example group `validation`, key `required` overrides `validation.required`. - **Public**: the line is returned without signing in by `GET /api/translations`, so a frontend can load its labels from the API. - **Text**: a JSON object with one entry per language, for example `{"en": "Required", "pl": "Wymagane"}`. How the lines are used: - **API messages**: when the API translates a key, a database line with the same group and key replaces the value from the package's language files. The language comes from the request's locale header (`en-US` uses the `en` files). - **Frontends**: public lines are available at `GET /api/translations` for any frontend that wants editable labels. ## Panel translations *Screenshot: The panel translations list* `/configuration/admin_translations` changes the labels of the admin panel. The list shows every message of the panel's built-in language files (language, key, value), searchable by language, key and text. **Edit** on a key opens the values in all languages; saving stores them as a database line in the `Admin` group with that key. 1. Search for the label, for example key `menu.Users` or the text `Users`. 2. Click **Edit**, change the text in the languages you need and save. 3. The change applies immediately in your browser. Other administrators see it after they sign in again or reload the panel, which loads the `Admin` group on start. > **Note:** The panel ships language files for English, Polish and French (plus small partial files for > a few other languages); the language switcher in the top bar chooses among them. Panel translations > override those messages per tenant, so different tenants can label the same screen > differently. --- # Course tutor settings > Switch on the course tutor, set its daily and monthly limits, choose the model profile and see what learners and authors can and cannot see. Canonical page: https://ulams-dev.github.io/ulams/admin/tutor/ The course tutor lets a learner ask a question inside a course and get a short answer built only from that course's own content, with links back to the lesson. When the course does not cover the question it says so instead of guessing. While a learner has a quiz attempt open it does not give or confirm quiz answers. It is **off for every tenant** until you switch it on, and it needs AI to be configured (`AI_DRIVER`). ## Turn it on The module ships with the API. After an upgrade run `php artisan migrate --force` once per tenant, then set the tenant setting `tutor.enabled` to true (`POST /api/admin/config`, or `TUTOR_ENABLED=true` for the whole installation). The first question in a course builds its search index; `php artisan tutor:index --course=1` rebuilds it by hand. ## How it answers The tutor searches the lesson text of the course (and, for courses built with the Course Builder, the source passages that text cites) with PostgreSQL full-text search, adds the lesson the learner has open, and sends those pieces, the last six messages and the question to the model. Every answer must cite the pieces it used; an answer without valid citations is not shown. Quiz questions, answer options, explanations and final tests are never indexed, so the tutor cannot find them. Text of a learner or of a source is treated as data and cannot change the tutor's rules. During an open quiz attempt the tutor explains concepts in general terms or declines, and a check on the server drops any answer that contains a correct option. An attempt that was never submitted and has no time limit counts as open, which errs on the side of not helping. ## Limits and settings | Setting or variable | Default | Meaning | |---|---|---| | `tutor.enabled` / `TUTOR_ENABLED` | `false` | Tenant switch | | `TUTOR_DAILY_QUESTIONS` | `30` | Questions per learner per day | | `TUTOR_PER_MINUTE` | `6` | Requests per learner per minute | | `TUTOR_TENANT_MONTHLY_USD` | `30` | Monthly AI spend of the tutor for the tenant | | `TUTOR_EVAL_MONTHLY_USD` | `5` | Monthly cap of `tutor:eval --live`, see [evals](https://ulams-dev.github.io/ulams/developers/learner-evals/index.md) | | `TUTOR_RETENTION_DAYS` | `90` | Conversations are deleted this many days after the last message | | `AI_TASK_TUTOR_PROFILE` | `light` | Model profile of the tutor | | `tutor.stream.enabled` / `TUTOR_STREAM_ENABLED` | `true` | Streamed answers (see below); off makes every question use the plain request | | `TUTOR_STREAM_TIMEOUT_SECONDS` | `60` | A queued answer that runs longer ends with an error and frees the conversation | | `TUTOR_STREAM_SSE_SECONDS` | `25` | A reader connection closes after this long and the widget reconnects where it left off | | `TUTOR_STREAM_EVENTS_RETENTION_DAYS` | `1` | Run events are deleted this many days after the answer ended | | `TUTOR_STREAM_QUEUE_CONNECTION`, `TUTOR_STREAM_QUEUE` | default | Queue of the answer job | ## Streamed answers With streaming on, the widget shows the answer as it is written. The question is stored and the answer is queued (`POST /api/tutor/courses/{course}/messages` with `stream: true` answers 202 with a run id); a queue worker writes the answer, and the widget reads its events from `GET /api/tutor/runs/{run}/events` (server-sent events, resumable with `Last-Event-ID`, so a reload mid-answer continues). **A queue worker must be running** and the queue must not be `sync`, or the answer arrives only when it is complete. The text on screen is a draft: the final event carries the checked answer with its citations and replaces it, and a draft whose check fails is replaced by the standard "I couldn't answer that" message. While a learner has a quiz attempt open nothing is streamed: the answer is written whole, checked for correct options and shown only then. A learner can have one answer running per conversation; asking again meanwhile gives 409. A run that outlives `TUTOR_STREAM_TIMEOUT_SECONDS` ends with an error. Events are transport only: the stored message is the record, and the events are deleted a day after the run ends (and with their conversation after the retention period) by `tutor:prune`. Behind a reverse proxy keep response buffering off for `/bff/api/tutor/runs/*/events` (the reference frontend sends `X-Accel-Buffering: no`). Set `TUTOR_STREAM_ENABLED=false` to fall back to the plain request, which stays available either way. ## Privacy Conversations belong to the learner, who can list and delete them; an account deletion erases them. No screen shows transcripts to authors or admins. The analytics endpoint `GET /api/admin/tutor/courses/{course}/analytics` returns counts only (questions, the share the course did not cover, refusals during attempts), and only for groups of at least `LEARNER_INSIGHTS_MIN_GROUP_SIZE` learners. The model sees the question, recent messages and course content, never the learner's name, e-mail, results or history, and the call is logged without a user. --- # User groups > Create nested user groups, let learners join registerable groups at sign-up, and add or remove group members in the admin panel. Canonical page: https://ulams-dev.github.io/ulams/admin/user-groups/ **Users → User groups** organises accounts into groups. Groups can be nested, and a group can be given access to a course as a whole (on the course's access tab; see [Content creators](https://ulams-dev.github.io/ulams/creators/index.md)). Groups belong to the [auth](https://ulams-dev.github.io/ulams/reference/packages/auth/index.md) package (`/api/admin/user-groups`). Access given to a group reaches the members of its sub-groups too, down to 10 levels below it. A group that ends up as its own ancestor does not make the lookup loop. | Screen | Route | Permission needed to see it | |---|---|---| | Group list | `/users/groups` | `user-group_list` | | New or edit group | `/users/groups/:group` (`new` for a new group) | `user-group_read` | Creating, updating and deleting groups and changing members are checked by the API with `user-group_create`, `user-group_update`, `user-group_delete`, `user-group_member-add` and `user-group_member-remove`. ## The group list *Screenshot: The user group list with search and the Show tree button* The table shows ID, the full name (the group name with its parents, for example `School / Class 1A`), the name, **Registerable** and the parent group. Search by name or filter by parent. **Show tree** opens the whole hierarchy in a dialog. ## Creating or editing a group *Screenshot: The group form with members* 1. Click **New** on the list, or **Edit** on a row. 2. Enter a **Name** and, optionally, a **Parent group**. Leave the parent empty for a top-level group. 3. Turn on **Registerable** if people may join the group themselves when they register. 4. Click **Submit**. 5. On an existing group, use **Add user to group** to search for a user by name and add them. **Delete** next to a member removes them from the group. Adding and removing members takes effect immediately and dispatches the `UserAddedToGroup` and `UserRemovedFromGroup` events, which have email templates (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)). You can also change a user's groups from the user's edit screen; see [Users](https://ulams-dev.github.io/ulams/admin/users/index.md). ## Registerable groups Groups marked **Registerable** are listed without authentication at `GET /api/auth/registerable-groups`. A registration form can offer them, and the registration request accepts a `groups` array: the new user is added only to the groups in that list that are registerable. Other groups are ignored. ## Group import and export The [csv-users](https://ulams-dev.github.io/ulams/reference/packages/csv-users/index.md) package has endpoints to export the members of a group and import a group (`/api/admin/csv/groups`, permissions `csv-user_group_export` and `csv-user_group_import`). The admin panel does not use them. When users are imported from a file, the group names in their `groups` column are created if they do not exist; see [Users](https://ulams-dev.github.io/ulams/admin/users/index.md). --- # Users > Find, create, edit and delete user accounts in the admin panel, import and export them as CSV, and add extra fields to the user model. Canonical page: https://ulams-dev.github.io/ulams/admin/users/ **Users → List** manages the accounts of the current tenant. The screens call the admin user endpoints of the [auth](https://ulams-dev.github.io/ulams/reference/packages/auth/index.md) package (`/api/admin/users`); the import and export buttons call the [csv-users](https://ulams-dev.github.io/ulams/reference/packages/csv-users/index.md) package. | Screen | Route | Permission needed to see it | |---|---|---| | User list | `/users/list` | `user_list` | | New user | `/users/list/new` | `user_create` | | Edit user (tabs) | `/users/:user/:tab` | `user_read` | | User fields | `/users/fields` | `user_read` | Saving, deleting, importing and exporting are checked again by the API with `user_update`, `user_delete`, `csv-users_import` and `csv-users_export`. See [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md). ## The user list *Screenshot: The user list with search filters, import and export buttons* The table shows ID, creation date, first and last name, email, **Active** (the `is_active` flag), **Email verified** and roles. Boolean and short text fields added on the [User fields](#user-fields) tab appear as extra columns. Filters (click **Expand** to see all of them): - **Search**: a fragment of the first name, last name or email. - **Created after** / **Created before**: the account creation date. - **Role**: `student`, `tutor` or `admin`. Custom roles are not offered in this filter. - **Login last n days** (`>=` and `<=`): days since the last login. Columns can be sorted, hidden with the gear icon and paginated. Each row has **Edit** and **Delete**. Deleting asks for confirmation, removes the account and dispatches the `AccountDeleted` event; it cannot be undone. ## Creating a user *Screenshot: The new user form* 1. Click **New** on the list. 2. Fill in first name, last name and email. A password is required for a new user: at least 8 characters from letters, digits and `!@#$%^&*`, with at least one of those special characters. 3. Fill in any extra fields defined on the [User fields](#user-fields) tab. 4. Set **Active** and choose the roles. 5. Click **Submit**. The panel opens the new user's edit screen. An account created here does not go through registration, so registration settings such as `ulams_auth.account_must_be_enabled_by_admin` do not apply to it. The new account's email is not verified: the API sends the verification email (event `AccountRegistered`) with the link from the `ulams_auth.return_url` package setting. The form does not send a return URL itself, so the API rejects new users until that setting is filled in on the **Package Auth** tab of [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md#package-configuration-tabs). ## Editing a user The edit screen has two tabs; the tab is part of the URL (`/users/:user/:tab`). *Screenshot: The edit user screen with its tabs* ### Edit user (`user_info`) The same fields as the creation form, plus: - **Password** may be left empty to keep the current one. - **Email verified**: a switch to verify the address without the activation email. It is not shown for users with the `admin` role. - **Resend**: while the email is not verified, sends the verification email again (`POST /api/auth/email/resend`) with a link to `{frontURL}email-verify`. If the `global.frontURL` setting is empty the panel shows a link to the settings instead. - **Avatar**: upload an image, pick one from the [file library](https://ulams-dev.github.io/ulams/admin/files/index.md) (folder `avatars/{id}`) or delete it. - **Groups**: add or remove the user from [user groups](https://ulams-dev.github.io/ulams/admin/user-groups/index.md). Each change is saved immediately, not with **Submit**. Setting **Active** off blocks the account and dispatches `AccountBlocked`; integrations such as [MailerLite and Mattermost](https://ulams-dev.github.io/ulams/admin/other-integrations/index.md) react to it. ### Categories (`categories`) A category tree with checkboxes. The selection is stored as the user's interests (`PUT /api/admin/users/{id}/interests`). Frontends can show it, for example as a tutor's field of expertise. Categories are managed in [Categories and tags](https://ulams-dev.github.io/ulams/admin/categories-and-tags/index.md). ## Import users from CSV or Excel **Import users** uploads a `.csv` or `.xlsx` file to `POST /api/admin/csv/users`. The first row is the header. Rows are matched by email: - **Existing email**: the user is updated with the values in the row. - **New email**: the user is created as active with a verified email, and the `UlamsImportedNewUserTemplateEvent` event is dispatched. Its email template contains a link to set a password; the panel passes its own `/user/reset-password` page as the return URL. Columns: | Column | Required | Format | |---|---|---| | `email` | yes | | | `first_name`, `last_name` | yes | | | `password` | no | at least 6 characters, stored hashed | | `is_active` | no | an empty value is saved as inactive | | `roles` | no | JSON array of existing role names, for example `["tutor"]` | | `permissions` | no | JSON array of existing permission names | | `groups` | no | JSON array of group names; missing groups are created | | other user columns | no | for example `path_avatar`, kept only if the file exists in storage | > **Caution:** Roles and direct permissions are replaced by the values in the file: an empty `roles` cell > removes all roles from an existing user. Groups are only added, never removed. Export the > users first and edit that file to keep what you do not want to change. ## Export users **Export** downloads the users that match the current filters as `csv`, `xlsx` or `xls` (`GET /api/admin/csv/users?format=…`). The file has the columns of the full user resource (roles and permissions as JSON arrays), so it can be edited and imported back. The csv-users package can also export and import the members of a group (`/api/admin/csv/groups`); the panel has no button for it. ## User fields *Screenshot: The user fields tab listing extra fields* The **User fields** tab (`/users/fields`) adds extra fields to the user model without a database migration, through the [model-fields](https://ulams-dev.github.io/ulams/reference/packages/model-fields/index.md) package. Each field has: - **Name**: the attribute name, for example `bio` or `newsletter`. - **Type**: `boolean`, `number`, `varchar`, `text` or `json`. - **Default** value. - **Rules**: a JSON array of [Laravel validation rules](https://laravel.com/docs/validation#available-validation-rules), for example `["required", "string", "max:255"]`, applied when a user is saved. - **Visibility**: a power of two that decides who receives the field in API responses: `1` public, `2` authorised users, `4` administrators. - **Extra**: JSON with additional data. The panel reads translated labels from it, for example `[{"en": "Bio"}, {"pl": "Biogram"}]`. The fields appear on the user form, on [My profile](https://ulams-dev.github.io/ulams/admin/my-profile/index.md) and in the user API resources. The [MailerLite integration](https://ulams-dev.github.io/ulams/admin/other-integrations/index.md) reads its newsletter consent from a user attribute, which can be such a field. Managing fields needs the `metadata_*` permissions (`metadata_create_update`, `metadata_delete`, `metadata_list`). ## Invite people without an account The course, webinar, consultation, stationary event and product forms have a list of **users without an account** (package [assign-without-account](https://ulams-dev.github.io/ulams/reference/packages/assign-without-account/index.md)). It is not a screen of the Users menu, but it creates access for people who are not users yet: 1. Add an email address to the list. The submission is stored with status `sent` and the `AssignToProduct` or `AssignToProductable` event is dispatched; its email template is the invitation (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)). 2. When someone registers with that email (`AccountRegistered`), every `sent` submission for it is applied: the person is assigned to the item and the status changes to `accepted`. 3. Deleting a submission dispatches an unassign event. ## Related - [User groups](https://ulams-dev.github.io/ulams/admin/user-groups/index.md), [Roles and permissions](https://ulams-dev.github.io/ulams/admin/roles-and-permissions/index.md) - Registration and login settings (`ulams_auth.*`): [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) and [Settings keys](https://ulams-dev.github.io/ulams/reference/settings/index.md) - Account events (`AccountRegistered`, `AccountConfirmed`, `AccountBlocked`, …): [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md) --- # Webinars > Schedule live webinars with trainers, run them in Jitsi or JaaS rooms, optionally stream to YouTube, and sell access as a product. Canonical page: https://ulams-dev.github.io/ulams/admin/webinars/ A webinar is a scheduled live session with one or more trainers. Learners who have access (usually by buying the webinar's product) join a video room at the scheduled time. The room is a Jitsi room, either on a self-hosted Jitsi server or on 8x8 JaaS. Optionally the session is broadcast to YouTube as an unlisted live stream. Three packages are involved: | Package | Role | |---|---| | `webinar` | Webinar model, admin and learner endpoints, reminders, trainer assignment events | | `jitsi` | Builds the room parameters and the signed JWT for Jitsi or JaaS; receives the recording webhook | | `pencil-spaces` | Pencil Spaces client. Not used by webinars; it creates rooms for approved [consultation requests](https://ulams-dev.github.io/ulams/admin/consultations/index.md#consultation-requests) | ## Who uses it - **Administrators** create webinars, assign trainers and manage the product. The admin panel menu entry needs `webinar_list`; the edit screen needs `webinar_read`. - **Tutors** (trainers) are moderators in the room. With the default roles they hold only the `-own` permissions (see [Permissions](#permissions)), so the admin menu entry is hidden for them. - **Learners** see published webinars on the learner site and join from their account once the session has started. ## Screens ### Webinar list `/courses/webinars/list` (Courses → Webinars). Columns: ID, name, status, product, duration, active from, active to and tags. Filters: date range, name and tags. When loading the list fails with a YouTube error, the panel opens a **Generate token** dialog: it asks for an e-mail address, calls `POST /api/admin/g-token/generate` and opens the Google consent page that reconnects the YouTube account used for live streams. *Screenshot: Webinar list in the admin panel* The entry can be hidden with the dashboard setting `hideInMenu-CoursesWebinars`. ### Webinar form `/courses/webinars/webinar/:webinar` (`new` to create). Tabs: | Tab | Content | |---|---| | Attributes | Name, duration (free text such as `2 hours`), status (`draft`, `published`, `archived`), active from, active to, trainers, the "AI Recording Analysis" switch, short description, program (agenda) and description | | Product | Price and sale settings of the webinar's product (see [Sales](https://ulams-dev.github.io/ulams/admin/sales/index.md)) | | Media | Cover image | | Tags | Tags used for filtering | | Branding | Logotype; shown inside the Jitsi room instead of the default logo | | User submission | Assign users by e-mail, including people without an account yet (`assign-without-account`) | The tabs other than Attributes appear after the first save. *Screenshot: Webinar edit form with the Attributes tab open* > **Dates:** The session starts at **active to** and lasts **duration**. The code uses `active_to` as the start > of the event: the room opens at `active_to` and closes at `active_to + duration`. Reminders, the > YouTube broadcast start time and the `is_started` / `is_ended` flags are all computed from it. ## How joining works 1. A learner gets access, normally by buying the webinar product; the webinar is then attached to the user (`webinar_user`). Trainers are attached through the form. 2. `GET /api/webinars/generate-jitsi/{id}` returns the room data. It answers 404 unless the webinar is published and the current time is between `active_to` and `active_to + duration`. When YouTube is configured, the webinar must also have a YouTube stream. 3. Trainers get moderator rights in the room; the room name is derived from the webinar name. 4. The response also carries `yt_url`, `yt_stream_url` and `yt_stream_key`, which the trainer uses to broadcast. Trainers start and stop the YouTube broadcast with `GET /api/webinars/start-live-stream/{id}` and `GET /api/webinars/stop-live-stream/{id}`. ## Video conference configuration (jitsi) The `jitsi` package picks the mode from the configuration: - **JaaS** when `app_id`, `jaas_host`, `aud`, `iss`, `kid` and `private_key` are all set. - **Self-hosted Jitsi** when `jitsi_host`, `app_id` and `secret` are set. The token is signed with HS256; the secret must be at least 32 bytes. - Otherwise no JWT is generated and the room data contains only the domain and room name. | Config key (`jitsi.*`) | Environment variable | Default | |---|---|---| | `jitsi_host` | `JITSI_HOST` | `meet-stage.ulams.app` | | `app_id` | `JITSI_APP_ID` | `meet-id` | | `secret` | `JITSI_APP_SECRET` | `Test` | | `jaas_host` | `JAAS_HOST` | `https://8x8.vc/` | | `aud`, `iss`, `sub` | `JAAS_AUD`, `JAAS_ISS`, `JAAS_SUB` | `jitsi`, `chat`, empty | | `kid`, `private_key` | `JAAS_KEY_ID`, `JAAS_PRIVATE_KEY` | empty | | `recording` | `JAAS_RECORDING` | `false` | | `package_status` | none | `enabled`; any other value makes room generation return "Package is disabled" | All keys above are also registered as administrable settings, so they can be changed per tenant in [Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md) under the `jitsi` group. ### Recording webhook `POST /api/jitsi/recorded-video` receives finished recordings, downloads the file and stores it under `jitsi/videos/...` on the tenant's storage disk. Requests are rejected unless one of these is set: - `JITSI_WEBHOOK_SECRET`: JaaS signing secret, checked against the `X-Jaas-Signature` header (tolerance `JITSI_WEBHOOK_TOLERANCE`, default 300 seconds); - `JITSI_WEBHOOK_TOKEN`: shared token for self-hosted Jitsi, sent as `Authorization: Bearer `. Downloads are allowed only over HTTPS from hosts in `JITSI_RECORDING_HOSTS` (comma-separated, `*.example.com` matches subdomains), never from private addresses, only `mp4`/`webm`, up to `JITSI_RECORDING_MAX_BYTES` (default 2 GB) and `JITSI_RECORDING_DOWNLOAD_TIMEOUT` (default 600 s). The endpoint is throttled to 60 requests per minute. For JaaS, set `JITSI_WEBHOOK_SECRET` to the endpoint secret shown by the "Reveal secret" button in the JaaS console (Webhooks). JaaS signs `.` with HMAC-SHA256, base64 encoded, in `X-Jaas-Signature: t=,v1=`; schemes other than `v1` are ignored. The recording link of `RECORDING_UPLOADED` is a pre-authenticated, 24-hour URL on Oracle object storage (`https://objectstorage..oraclecloud.com/...mp4`), so JaaS deployments set `JITSI_RECORDING_HOSTS=*.oraclecloud.com`, or the exact region host if it is known. Both formats follow the [JaaS webhook documentation](https://developer.8x8.com/jaas/docs/webhooks-signatures) (checked 2026-10-09). Self-hosted Jitsi leaves the secret empty and uses `JITSI_WEBHOOK_TOKEN` with its own recording host. ### YouTube Live streaming uses the `youtube` package (Google OAuth client ID, secret and API key, plus a refresh token obtained through the Google consent flow). When YouTube is configured, saving a webinar creates or updates an unlisted YouTube broadcast. If it is not configured, webinars run in the video room only. ## API endpoints | Method and path | Purpose | |---|---| | `GET/POST /api/admin/webinars`, `GET/PUT/DELETE /api/admin/webinars/{id}`, `POST /api/admin/webinars/{id}` | Admin CRUD (the POST variant accepts multipart uploads) | | `GET /api/admin/webinars/{id}/users` | Users attached to a webinar | | `GET /api/admin/webinars/users/assignable` | Users that can be assigned as trainers | | `GET /api/webinars`, `GET /api/webinars/{id}` | Public list and detail | | `GET /api/webinars/me` | Webinars of the current user | | `GET /api/webinars/generate-jitsi/{id}` | Room data for the current user | | `GET /api/webinars/start-live-stream/{id}`, `GET /api/webinars/stop-live-stream/{id}` | Control the YouTube broadcast | | `POST /api/pencil-spaces/login` | Direct login link to Pencil Spaces (needs `pencil-spaces_login`) | Full list: [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Permissions | Permission | admin | tutor | |---|---|---| | `webinar_list`, `webinar_read`, `webinar_create`, `webinar_update`, `webinar_delete` | yes | `webinar_create` only | | `webinar_list-own`, `webinar_read-own`, `webinar_update-own`, `webinar_delete-own` | no | yes | The `-own` variants apply to webinars where the user is a trainer. The `pencil-spaces_login` permission exists, but the application's permission seeder does not run the Pencil Spaces seeder, so no role has it by default. See [Permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md). ## Events and notifications | Event | When | E-mail template | |---|---|---| | `WebinarTrainerAssigned` | A trainer is added to a webinar | yes | | `WebinarTrainerUnassigned` | A trainer is removed | yes | | `ReminderAboutTerm` | One day and one hour before the start, for each attached user | yes | | `YtProblem` (youtube package) | The YouTube API call fails | yes | Reminders come from the scheduled job `ReminderAboutWebinarJob`: the one-hour reminder runs every five minutes, the one-day reminder every six hours. Each webinar stores the last reminder sent so a user is not reminded twice. See [Scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md), [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md) and [Events and notifications](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md). ## Known limitations - The admin panel only works for users with `webinar_list`; tutors cannot manage their own webinars there with the default roles. - The learner site (`front/web`) lists webinars read-only; buying and joining happen in the legacy learner app or a custom front. See [Learners](https://ulams-dev.github.io/ulams/learners/index.md). - The JaaS webhook signature format still has to be confirmed against the JaaS documentation (open roadmap item). --- # Contributing > How to take part in ulams, from reporting a bug to merging a pull request, with the rules for decisions, documentation and security reports. Canonical page: https://ulams-dev.github.io/ulams/contributing/ ulams is developed in the open in [ulams-dev/ulams](https://github.com/ulams-dev/ulams). Bug reports, ideas, documentation fixes and code are all welcome. The rules on these pages apply to people and to coding agents alike. - [Contributing guide](https://ulams-dev.github.io/ulams/contributing/contributing-guide/index.md): Issues, branches, Conventional Commits, what every pull request needs, review and the licence of contributions. - [Decisions and documentation](https://ulams-dev.github.io/ulams/contributing/decisions-and-documentation/index.md): When a change needs an ADR, the template used here, and why every significant change updates this site. - [Writing docs](https://ulams-dev.github.io/ulams/contributing/writing-docs/index.md): How this site is built: adding a page, the coverage check, generated pages, screenshots and links. - [Code of conduct](https://ulams-dev.github.io/ulams/contributing/code-of-conduct/index.md): The Contributor Covenant 2.1, which applies in every project space. - [Security policy](https://ulams-dev.github.io/ulams/contributing/security-policy/index.md): How to report a vulnerability privately and how disclosure works. ## The short version 1. Open or pick an issue, and for anything non-trivial agree the scope there first. 2. Plan larger work in `docs/plans/phase-N.md`; the product owner approves the plan before implementation starts. 3. Branch as `phase-N/short-description`, commit with Conventional Commits, one concern per commit, tests in the same commit. 4. Record every decision as an ADR and update this site in the same branch. 5. Open the pull request, fill in the checklist and wait for green CI and a review. > **Security problems:** Never report a vulnerability in a public issue. Follow the [security policy](https://ulams-dev.github.io/ulams/contributing/security-policy/index.md). The contributing guide, code of conduct and security policy pages are rendered from `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` and `SECURITY.md` at the repository root, so GitHub and this site always show the same text. Edit those files, not the pages. --- # Brand > The ulams brand identity, Orbital Folio: concept, logo variants with downloads, clear space, minimum sizes, colours and contrast rules, do and don't, and how the assets are built and used in code. Canonical page: https://ulams-dev.github.io/ulams/contributing/brand/ ulams has one visual identity, **Orbital Folio**, chosen by the product owner and recorded in [ADR 0038](https://ulams-dev.github.io/ulams/decisions/0038-brand-identity-orbital-folio/index.md). It applies to the product and the platform: the documentation site, the platform landing, the admin sign-in and navigation, the Course Builder, the apps' icons and the "built on ulams" mark. A customer's own site keeps the customer's logo, colours and theme; it only carries the small ulams mark in its footer. ## Concept An open book, two dark page-wings with the left one slightly smaller, and a thin arc that sweeps up from the lower left over the book and ends in an orange dot. The book stands for open knowledge. The arc is an orbit: courses that stay in sync with their sources, adapt to each learner and grow with traceable, cited knowledge. The Orbital Folio brand board: the horizontal, stacked and symbol-only logos, light and dark app icons, one-colour versions, the colour palette and the clear-space rule. The board is the approved source of the identity. The original is committed as [`front/docs/design/brand/orbital-folio-board.png`](https://github.com/ulams-dev/ulams/blob/main/front/docs/design/brand/orbital-folio-board.png); the image above is its WebP copy for this site. The logo files below are redrawn from it as SVG (see [Using the brand in code](#using-the-brand-in-code)), so when the two differ, the board and [ADR 0038](https://ulams-dev.github.io/ulams/decisions/0038-brand-identity-orbital-folio/index.md) decide. ## Logo Use the horizontal lockup by default. Use the stacked lockup where the space is square or narrow, and the symbol alone only where the name is already present (an app icon, a favicon, a rail button). Every file is hand-written SVG with a `viewBox`, no raster image and no font.
Horizontal lockup, indigo with an orange dot
Horizontal, primary
Horizontal lockup, white with an orange dot
Horizontal, on indigo or dark
Stacked lockup, symbol above the wordmark
Stacked
The symbol alone
Symbol only
App icon on white
App icon, light
App icon on indigo
App icon, dark
### Downloads Each lockup comes in four colourways. **Primary** is indigo with the orange dot, for white and light backgrounds. **Reversed** is white with the orange dot, for indigo and dark backgrounds. **Black** and **white** are one-colour, dot included, for print, stamps, embossing and anywhere colour is not available. | Form | Primary | Reversed | Black | White | |---|---|---|---|---| | Horizontal | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-horizontal.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-horizontal-reversed.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-horizontal-black.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-horizontal-white.svg) | | Stacked | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-stacked.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-stacked-reversed.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-stacked-black.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-logo-stacked-white.svg) | | Symbol | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-symbol.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-symbol-reversed.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-symbol-black.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-symbol-white.svg) | | Wordmark | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-wordmark.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-wordmark-reversed.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-wordmark-black.svg) | [SVG](https://ulams-dev.github.io/ulams/brand/ulams-wordmark-white.svg) | | Other | Files | |---|---| | App icon | [light SVG](https://ulams-dev.github.io/ulams/brand/ulams-app-icon-light.svg), [light PNG 1024](https://ulams-dev.github.io/ulams/brand/ulams-app-icon-light-1024.png), [dark SVG](https://ulams-dev.github.io/ulams/brand/ulams-app-icon-dark.svg), [dark PNG 1024](https://ulams-dev.github.io/ulams/brand/ulams-app-icon-dark-1024.png), [maskable SVG](https://ulams-dev.github.io/ulams/brand/ulams-app-icon-maskable.svg) | | Favicon | [SVG](https://ulams-dev.github.io/ulams/brand/favicon.svg), [ICO](https://ulams-dev.github.io/ulams/favicon.ico) | | Social image (1200 by 630) | [PNG](https://ulams-dev.github.io/ulams/brand/ulams-og.png), [SVG](https://ulams-dev.github.io/ulams/brand/ulams-og.svg) | ## Clear space Keep an empty margin around the logo on every side, at least the **width of the letter u** in the wordmark (about 40 % of the lockup's height). No text, image edge or other logo enters that margin. The orbit dot is part of the logo and sits inside it. ## Minimum sizes | Form | Screen | Print | |---|---|---| | Horizontal | 96 px wide | 25 mm wide | | Stacked | 64 px wide | 16 mm wide | | Symbol | 16 px wide (favicon on the dark tile) | 6 mm wide | Below those sizes the left page-wing and the gap beside the arc close up. Use the favicon tile, which draws the symbol larger inside its square, instead of shrinking the lockup further. ## Colours

Indigo
#0F2B46
--ulams-brand-indigo

Orange
#FF7A2E
--ulams-brand-orange

Blue (indigo tint)
#1F5A94
--ulams-brand-blue

Sky (indigo tint)
#8FB3D9
--ulams-brand-sky

Indigo and orange are the brand. Blue and sky are tints of indigo for the places where indigo itself is too dark to show an accent: blue for large accent text on a light page (the platform hero), sky for links and accent text on a dark page. ### Contrast rules (WCAG 2.2 AA) > **Orange is an accent, not a text colour:** Orange `#FF7A2E` on white is **2.6:1**, below the 4.5:1 that body text needs and the 3:1 that > large text, icons and focus rings need. Use orange for the orbit dot, small graphics and > decoration such as a thin rule. Never use it for body text, links, labels, borders of inputs or > focus indicators on a light background, and never put white text on an orange fill. | Pair | Ratio | Use | |---|---|---| | Indigo on white | 14.4:1 | Text, links, buttons with white labels. | | White on indigo | 14.4:1 | Reversed logo, text on indigo panels. | | Indigo on orange | 5.5:1 | The only text colour on an orange fill. | | Orange on indigo | 5.5:1 | Orange text or icons are allowed on indigo. | | Orange on near-black `#0E0E10` | 7.4:1 | Orange accents on the dark docs theme. | | Blue `#1F5A94` on `#FAFAF9` | 6.8:1 | Large accent text on the platform page. | | Sky `#8FB3D9` on `#0E0E10` | 8.8:1 | Links and accent text in dark mode. | | White on orange | 2.6:1 | **Fails.** Do not use. | | Orange on white | 2.6:1 | **Fails** for text and for focus rings. Graphics only. | The unit test `front/ui/tests/brand.test.ts` pins these rules, so a token change that breaks one fails CI. The same file checks that the token values agree in the web UI, the docs site and the admin. ## Typography The wordmark is **drawn, not typeset**: the five letters `u l a m s` are geometric paths with squared stems and rounded corners, traced from the approved board and outlined, so no font is needed to display it and no font licence applies to the logo. Do not retype the name in another font to imitate it; use the wordmark file. Interface text uses the fonts already in the product: [Inter](https://rsms.me/inter/) for text, Inter Tight for headings and JetBrains Mono for code, all under the SIL Open Font License 1.1. The closest open-licence display faces to the wordmark (Exo 2, Saira, Orbitron; all OFL 1.1) can be used for headlines in marketing material, but never as a replacement for the wordmark. ## Do and don't
**Do** - Use the supplied files; scale them proportionally. - Use the primary logo on white or very light backgrounds and the reversed logo on indigo, dark or photographic backgrounds with enough contrast. - Use the one-colour versions when colour is not available. - Keep the clear space and the minimum sizes. - Use orange for the dot and for small graphic accents.
**Don't** - Redraw, recolour, outline, stretch, rotate, add shadows or effects to the logo. - Move the dot, change the arc, or separate the symbol from a wordmark that it appears with. - Put the primary (indigo) logo on a dark or busy background. - Set text in orange on white, or white text on orange. - Use the ulams logo as a tenant's own logo, or in a tenant's header: customers keep their own identity. - Put the symbol on a coloured tile other than the supplied app icons.
## Where it is used | Surface | What it shows | |---|---| | Documentation site | Horizontal lockup in the header (reversed in dark mode), indigo and orange accents, favicon and social image. | | Platform landing (`front/web`) | Horizontal lockup, indigo theme with an orange accent dot. | | Course Builder | The symbol on the rail. | | Admin | Horizontal lockup on sign-in and in the navigation, symbol when the navigation is collapsed. A tenant's own logo, when configured, replaces it. | | Tenant sites | A small "Built on ulams" mark with the symbol in the footer. Nothing else. | | Apps and API pages | Favicon, touch icon, PWA icons and the social image in the web app, docs, admin, the legacy front and the API's Swagger page. | ## Using the brand in code The assets are generated from one script, so every app has the same files: ```bash corepack yarn brand:build ``` The generator is [`front/docs/design/brand/build.mjs`](https://github.com/ulams-dev/ulams/blob/main/front/docs/design/brand/build.mjs). It writes the SVG masters to `front/docs/design/brand/svg/`, the PNG and ICO exports to `front/docs/design/brand/png/`, the logo geometry to `front/ui/src/brand/paths.ts`, and copies the icons into the `public` folders of the web app, the docs site, the admin, the legacy front and the API. Run it after changing the geometry or a colour in `build.mjs` and commit the result. In Astro components use the shared logo: ```astro --- import Logo from "@ulams/ui/brand/Logo.astro"; --- ``` It reads `--ulams-brand-indigo` and `--ulams-brand-orange`, so a dark panel can set `--ulams-brand-indigo: #fff` to get the reversed logo. In the admin and the legacy front, which are not Astro, reference the SVG files in their `public` folders. > **Trademark:** The name and the mark have not been through a trademark search yet. That check is recommended > before the public launch and is tracked as an owner action. --- # Code of conduct > The Contributor Covenant 2.1 code of conduct that applies to everyone taking part in the ulams project. Canonical page: https://ulams-dev.github.io/ulams/contributing/code-of-conduct/ ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mateusz@qunabu.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html [Mozilla CoC]: https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations --- # Contributing guide > How to contribute to ulams: issues, pull requests, branches, commits, tests, docs, decisions and the licence of contributions. Canonical page: https://ulams-dev.github.io/ulams/contributing/contributing-guide/ Thank you for helping build ulams, an AI-native, headless LMS. This guide covers how to report problems, propose changes and get a pull request merged. The project's working rules live in [`CLAUDE.md`](https://github.com/ulams-dev/ulams/blob/main/CLAUDE.md) (workflow and non-negotiables) and [`AGENTS.md`](https://github.com/ulams-dev/ulams/blob/main/AGENTS.md) (the practical map of the repository); they apply to people and to coding agents alike. Everyone taking part is expected to follow the [Code of conduct](https://ulams-dev.github.io/ulams/contributing/code-of-conduct/index.md). Security problems are never reported in public: see the [Security policy](https://ulams-dev.github.io/ulams/contributing/security-policy/index.md). ## Ways to contribute - **Report a bug** with the [bug report form](https://github.com/ulams-dev/ulams/issues/new?template=bug_report.yml). Say what you did, what you expected and what happened, and which app (API, admin, front, reference frontend, H5P or PDF service) and commit or image tag you used. - **Suggest a feature** with the [feature request form](https://github.com/ulams-dev/ulams/issues/new?template=feature_request.yml). Check the [roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md) first: the item may already be planned. - **Ask a question or discuss an idea** in [GitHub Discussions](https://github.com/ulams-dev/ulams/discussions), if they are enabled for the repository; otherwise open an issue. - **Improve the documentation**: the documentation site lives in [`front/docs-site`](https://github.com/ulams-dev/ulams/tree/main/front/docs-site). - **Send a pull request** for an open issue. For anything larger than a small fix, comment on the issue first so the work is not duplicated and the scope is agreed before you start. ## How changes are made ulams follows the workflow in [`CLAUDE.md`](https://github.com/ulams-dev/ulams/blob/main/CLAUDE.md): 1. **Explore**: read the relevant code, packages and tests. 2. **Plan**: for a milestone or any non-trivial change, write the plan in `docs/plans/phase-N.md` (goal, scope, design, new dependencies with justification, migrations, tests, risks, open questions) or in the issue. **The product owner approves the plan before implementation starts.** If the plan changes significantly during implementation, stop and say so in the pull request instead of improvising. 3. **Implement** in small commits, one concern per commit, with the tests in the same commit. 4. **Verify**: the full test suite of what you touched, linters, the docs coverage check, and accessibility checks for learner-facing UI. 5. **Update** [`docs/ROADMAP-TODO.md`](https://ulams-dev.github.io/ulams/roadmap/index.md) when your change completes or advances a roadmap item (tick an item only when it is implemented, tested and merged; never delete or reword items). The spec ([`docs/ROADMAP-PROMPT.md`](https://github.com/ulams-dev/ulams/blob/main/docs/ROADMAP-PROMPT.md)) is changed only with the product owner's approval. ## Branches and commits - Branch from `main` and name the branch `phase-N/short-description` (for example `phase-1/lti-deep-linking`), where `N` is the roadmap phase the work belongs to. - Use [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`, optionally with a scope (`feat(lti): …`). The pull request title follows the same format. - One concern per commit; tests go in the same commit as the code they cover. - No AI attribution anywhere: no `Co-Authored-By` trailers for AI tools, no "Generated with …" footers in commits or pull requests, no tool-named branch prefixes, no generated-by headers in files. ## What every pull request needs - **Tests.** New behaviour has tests; existing tests stay green. Mock the LLM in unit and feature tests (real-model runs only through the eval command). - **Tenant isolation.** Every new API endpoint has policies, Swagger annotations and a tenant isolation test. - **Accessibility.** Learner-facing UI meets WCAG 2.2 AA. - **No regressions in content formats.** H5P and SCORM behaviour stays unchanged. - **Documentation.** Every significant change updates the documentation site ([`front/docs-site`](https://github.com/ulams-dev/ulams/tree/main/front/docs-site)) in the same branch. The coverage check fails when a module, admin route, learner route or topic type has no page that documents it: ```bash corepack yarn workspace @ulams/docs coverage ``` - **A decision record when you made a decision.** Every decision gets an ADR in [`docs/decisions`](https://ulams-dev.github.io/ulams/decisions/index.md) (see below). The [pull request template](https://github.com/ulams-dev/ulams/blob/main/.github/pull_request_template.md) repeats this list as a checklist. ### Project rules that reviewers check - LMS entities are created and changed through the package repositories and services, never by writing tables directly. - Do not use, extend or depend on `escolalms/recommender`. - AI changes to course content are reviewable diffs the author approves, and every generated element cites its source fragments. Uploaded content is untrusted input. - No model names hardcoded outside config; every LLM call logs model, tokens and cost. - Styling in admin and front: CSS Modules and `var(--ulams-*)` custom properties only; no styled-components. - New modules are new packages in `api/packages/`, following an existing small package. - Every new dependency is justified in the plan or pull request: licence, maintenance, size and impact on self-hosting. ## Decisions (ADRs) Every decision gets an architecture decision record: anything architectural, a new dependency, a change to a licence boundary, the data model or a public API, or anything hard to reverse. Write it in [`docs/decisions`](https://ulams-dev.github.io/ulams/decisions/index.md) as `NNNN-short-title.md` with the next free number, following the existing records ([`docs/decisions/README.md`](https://ulams-dev.github.io/ulams/decisions/index.md)). A contributor proposes it with status **Proposed**; the product owner approves it, which changes the status to **Accepted**. The documentation site lists every ADR with its status automatically. More detail: the "Decisions and documentation" page in the Contributing section of the documentation site. ## Review - CI must be green. The `CI OK` job of [`ci.yml`](https://github.com/ulams-dev/ulams/blob/main/.github/workflows/ci.yml) sums up the JS and PHPUnit jobs; the docs build checks coverage and links. - A maintainer reviews every pull request. The product owner approves plans and ADRs; a pull request that depends on an unapproved plan or ADR waits for that approval. - Keep pull requests small and focused. Answer review comments with a new commit rather than a force-push while the review is in progress, so reviewers can see what changed. ## Running the checks locally Requirements: Docker, Node 22 (`.nvmrc`) or 24 and Yarn 1 via Corepack (`corepack enable`). Setup is in the [README](https://github.com/ulams-dev/ulams/blob/main/README.md#quick-start). ```bash corepack yarn install corepack yarn turbo run typecheck lint build test --filter= # admin, front, api-h5p, api-pdf, @ulams/web, @ulams/ui, @ulams/sdk corepack yarn test:api # PHPUnit inside the API container corepack yarn workspace @ulams/docs coverage # docs coverage check corepack yarn dev:docs # documentation site on http://localhost:4322 ``` To run a single PHPUnit suite, see [`AGENTS.md`](https://github.com/ulams-dev/ulams/blob/main/AGENTS.md#running-things). The pre-commit hook (Husky and lint-staged, [`.lintstagedrc.mjs`](https://github.com/ulams-dev/ulams/blob/main/.lintstagedrc.mjs)) formats staged admin and front files with each app's own Prettier and runs ESLint on admin; it does not replace the checks above. ## Licence of contributions Contributions are accepted under the licence of the files they change (inbound = outbound): by submitting a pull request you agree that your contribution is licensed under the licence that already covers those files. The nearest `LICENSE` file in a folder or its parents wins ([`LICENSING.md`](https://github.com/ulams-dev/ulams/blob/main/LICENSING.md) has the full table): | Path | Licence | |---|---| | Root files, `docs/`, `front/`, `admin/` | MIT ([`LICENSE`](https://github.com/ulams-dev/ulams/blob/main/LICENSE), [`admin/LICENSE`](https://github.com/ulams-dev/ulams/blob/main/admin/LICENSE)) | | `api/` (the Laravel application) | Apache-2.0 ([`api/LICENSE`](https://github.com/ulams-dev/ulams/blob/main/api/LICENSE)) | | `api/packages/*` | Each package's own `LICENSE` (MIT for nearly all of them) | | `api/pdf` | MIT ([`api/pdf/LICENSE`](https://github.com/ulams-dev/ulams/blob/main/api/pdf/LICENSE)) | | `api/h5p` | GPL-3.0-or-later ([`api/h5p/LICENSE`](https://github.com/ulams-dev/ulams/blob/main/api/h5p/LICENSE)) | | `admin/src/lib/markdown-editor` | BSD-3-Clause | A new package in `api/packages` gets an MIT `LICENSE` file. Imported code keeps its original copyright notices. **No GPL or AGPL code outside `api/h5p`.** Copyleft components run as separate programs reached only over HTTP, CLI or an iframe. Never copy or port code from `api/h5p` (or any GPL project) into other folders, and never import it from the API, admin or front. Check the licence of every new dependency before adding it. --- # Decisions and documentation > When a change needs an architecture decision record, the MADR template used in ulams, how ADRs are approved, and why docs ship with the code. Canonical page: https://ulams-dev.github.io/ulams/contributing/decisions-and-documentation/ Two rules keep ulams understandable as it grows: 1. **Every decision gets an ADR** (architecture decision record) in `docs/decisions`. 2. **Every significant change updates this documentation site in the same branch.** Both are checked in review, and the pull request template asks for them. ## When to write an ADR Write an ADR whenever a change involves a decision someone could later ask "why did we do it this way?" about. In particular, when the change: - is **architectural**: a new package, service or app, a new integration pattern, a change in how components talk to each other (for example ADR 0011, AG-UI events over SSE); - **adds a dependency**: a library, service, image or external API (the plan already has to justify its licence, maintenance, size and self-hosting impact; the ADR records the choice); - **changes a licence boundary**: anything that touches what is GPL and what is not, or how a copyleft component is isolated (ADR 0003, ADR 0013); - **changes the data model**: new entities, tenancy, how content or progress is stored; - **changes a public API**: REST endpoints, SDK surface, events, the component catalogue, CLI commands; - **is hard to reverse**: anything that would be expensive to undo once data, users or integrations depend on it. Choosing between options that the spec leaves open is a decision too. A product decision the product owner makes in chat goes into "Decisions made" in `docs/ROADMAP-TODO.md`; if it is architectural, it also gets an ADR. When in doubt, write a short one. A three-paragraph ADR costs little; a decision nobody can trace costs a lot. ## The template ADRs use the [MADR](https://adr.github.io/madr/) format, trimmed to the sections the existing records use. Copy the skeleton below, or start from a recent ADR such as 0012 (LTI) or 0009 (LLM layer). ```markdown # NNNN. Short title that states the decision - Status: Proposed - Date: YYYY-MM-DD ## Context and problem statement What forces are at play: the requirement (with the spec section), constraints such as tenancy, licensing or self-hosting, and the question to answer. ## Considered options | Option | Licence | Notes | |---|---|---| | **Chosen option** | MIT | Why it fits | | Alternative | ... | Why not | ## Decision What we do, concretely: packages, endpoints, data, configuration. Specific enough that a reviewer can check the code against it. ## Consequences What becomes easier, what becomes harder, follow-up work, risks and how to revisit the decision. ``` The site reads the `Status:` and `Date:` lines and the `# NNNN. Title` heading, so keep them in exactly this form. "Considered options" can be a table or a list; small decisions without real alternatives may skip it (ADR 0001 does). ## Numbering and files - File name: `docs/decisions/NNNN-short-title.md`, with the next free four-digit number and a kebab-case title. Numbers are never reused. - Add the record to the table in `docs/decisions/README.md` with its status. - Link the ADR from the plan (`docs/plans/phase-N.md`) and from the pull request. - docs - decisions - README.md the index table - 0001-monorepo-with-vendored-packages.md - … - 0013-adapt-build-worker.md - api/docs/adr/ API history before the monorepo - admin/docs/adr/ admin history before the monorepo - front/docs/adr/ old front history before the monorepo `docs/decisions` holds the project-wide decisions. The `docs/adr` folders inside `api`, `admin` and `front` hold retroactive records mined from each application's history before the monorepo; new decisions go in `docs/decisions`, even when they concern one application. ## Status and approval 1. **Proposed** (Proposed): the contributor writes the ADR, usually together with the plan, and opens it for review. Implementation that depends on it waits. 2. **Accepted** (Accepted): the product owner approves it. The status line becomes `- Status: Accepted (YYYY-MM-DD)` and the README table is updated. 3. **Superseded** (Superseded): a later ADR replaces it. The old record stays, its status becomes `Superseded by NNNN` with a link to the replacement, and the new record links back. Records are never deleted. Contributors propose; only the product owner accepts. ## ADRs on this site The [Decisions](https://ulams-dev.github.io/ulams/decisions/index.md) section is generated from the files on every build: each ADR becomes a page, and the overview table shows its number, title, status and date as written in the file. A new ADR appears there with its status badge as soon as it is merged; there is nothing to update on the site by hand. The per-application history records are listed there too. > **Tip:** The generated pages show an "Edit page" link that opens the ADR file on GitHub. Edit the ADR in > `docs/decisions`, never the generated page under `front/docs-site/src/content/docs/decisions`. ## Documentation ships with the code Every significant change updates this site in the same branch as the code: a new feature, a changed screen or flow, a new endpoint, package, admin route, learner route or topic type, new configuration, or a changed way to run, test or deploy something. Docs that arrive "later" usually never arrive. The [coverage check](https://ulams-dev.github.io/ulams/contributing/writing-docs/index.md#the-coverage-check) enforces the part that can be checked mechanically: every module in `api/packages` and every app, every admin route, every learner route and every topic type must be named by at least one written page. Adding a package or a route without a page fails the docs build. Reference pages (ADRs, the roadmap, package READMEs) are generated from the repository, so keeping a package README or an ADR current also keeps the site current. For the mechanics (where pages live, frontmatter, screenshots, links) see [Writing docs](https://ulams-dev.github.io/ulams/contributing/writing-docs/index.md). Progress on roadmap items is on the [Roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md) page, generated from `docs/ROADMAP-TODO.md`. --- # Security policy > How to report a security vulnerability in ulams privately, what to include, and how disclosure works. Canonical page: https://ulams-dev.github.io/ulams/contributing/security-policy/ ## Reporting a vulnerability **Do not report security vulnerabilities in public issues, discussions or pull requests.** Report them privately through GitHub's private vulnerability reporting: 1. Open the [ulams-dev/ulams repository](https://github.com/ulams-dev/ulams). 2. Go to the **Security** tab and choose **Report a vulnerability** (direct link: ). 3. Fill in the form. Only you and the maintainers can see the report. If the **Report a vulnerability** button is missing, private reporting has not been enabled yet; open a public issue that asks for a private contact **without any details of the vulnerability**, and a maintainer will reach out. ## What to include - The affected component: API (`api/`, and the package in `api/packages` if you know it), admin, learner front, reference frontend (`front/web`), H5P service (`api/h5p`), PDF service (`api/pdf`), a container image, or the documentation site. - The version: commit SHA, or the image name and tag (for example `ghcr.io/ulams-dev/api:sha-abc1234`). - The kind of issue (for example cross-tenant data access, authentication or authorization bypass, injection, prompt injection through uploaded content, SSRF, XSS) and its impact. - Step-by-step reproduction, a proof of concept if you have one, and the configuration needed (single tenant or multi-tenant, relevant environment variables, never real secrets). - Whether the issue is already public or known to others, and how you would like to be credited. ## Supported versions The images, the CLI and (from the Helm chart on) the chart share one version, `vX.Y.Z` (semantic versioning). Each release is published as image tags `X.Y.Z` and `X.Y`, and two channels move with releases: - `stable`: the newest release. - `lts`: the newest patch of a long-term support line. One minor line a year is declared LTS (from 1.0 on), listed in `.github/release-channels.json`, and gets security fixes for 12 months. `latest` and `sha-` keep meaning the `main` branch. | Version | Supported | |---|---| | The newest release (`stable`) | Yes | | LTS lines, for 12 months from their first release (`lts`) | Security fixes | | `main` and the `latest` images | Yes | | Older releases and image tags | No: upgrade to `stable` or the current `lts` | No release has been cut yet (the first one needs the owner's approval); until then only `main` and the `latest` images are supported. ## Patch policy Container images are scanned with Trivy on every pull request, on every publish and every night (`.github/workflows/ci.yml`, `publish.yml`, `nightly-security.yml`). Only vulnerabilities that have a fix available are gated. | Finding | Target | |---|---| | CRITICAL in a published image | fixed image published within 2 days | | HIGH in a published image | within 14 days | | Lower severity, or no fix available yet | with the next regular release; tracked, not gated | The clock starts when the nightly scan opens its `security` issue or when we learn of the problem from an advisory, whichever is first. A fix is a rebuilt image (the publish workflow pulls fresh base layers), a dependency update, or a documented exception in `.trivyignore.yaml` with a reason and an expiry date. Published images are signed with cosign (keyless, GitHub OIDC) and carry an SBOM; how to verify them is in the hardening guide ([operators documentation](https://github.com/ulams-dev/ulams/blob/main/front/docs-site/src/content/docs/operators/hardening.mdx)). A published image that fails the critical gate is not signed. ## Disclosure process 1. We aim to acknowledge the report within 5 working days and then confirm whether we can reproduce it. 2. We assess the severity and agree a fix timeline with you, keeping you updated in the private advisory. 3. The fix is developed in a private fork linked to the advisory and merged into `main`; new images are published. 4. We publish a GitHub security advisory (with a CVE when appropriate) once the fix is available, and credit you unless you prefer to stay anonymous. We ask you to give us a reasonable time to fix the issue before disclosing it publicly (90 days by default, or sooner once a fix is released), and not to access or modify data that is not yours, degrade the service for others or test against deployments you do not own. ## Scope notes - `api/h5p` bundles third-party H5P core and editor code; vulnerabilities in H5P itself are best reported upstream as well. We will still patch or pin our copy. - Infrastructure defaults in the development stack (SeaweedFS with the admin key from the compose file, MailHog, Adminer) are for local development and are not meant to be exposed in production. `api/SECURITY.md` points to this file; this policy covers the whole repository. --- # Translating the interface > Where the interface strings of the learner pages live, how the Polish and Chinese tables are kept in step with English, how to add or fix a translation, and the checks that fail when a key or placeholder is missing. Canonical page: https://ulams-dev.github.io/ulams/contributing/translating/ The learner pages of the reference frontend are available in English, Polish and Simplified Chinese. This page is for translators and for developers who add a string. ## Where the strings are Every table has the same shape in three languages and lives in `front/ui/src/lib`: | File | Used by | |---|---| | `player-strings.ts` | Lesson player, course page, quiz, finish page, progress and notice elements, media components | | `account-strings.ts` | Sign-in, the account page, "My tokens" | | `training-strings.ts` | Training, certificates, skills, the team view | | `tutor-strings.ts` | The course tutor panel | | `i18n.ts` | Catalogue components (landing, extra help, lesson view, reflection) | | `accessibility-strings.ts` | The accessibility statement | Which language a page uses is decided by [the default language setting](https://ulams-dev.github.io/ulams/operators/language/index.md) and the course language ([ADR 0106](https://ulams-dev.github.io/ulams/decisions/0106-learner-interface-language-follows-the-course/index.md)). The page sets ``; browser elements (``, ``, ``) read the closest `lang` attribute, so a card in another language translates itself. ## Rules - **Placeholders** such as `{n}` and `{title}` stay exactly as in English. Their position can change. - **Plurals** are objects with the forms the language needs: English `one` and `other`, Polish `one`, `few`, `many` and `other`, Chinese only `other`. The table picks the form with `Intl.PluralRules`. - **Names** (ulams, PDF, SCORM) stay as they are. API text (course titles, quiz questions, reasons) is never in these tables. - **No new English in a page.** A template or element that holds a visible literal fails the `hardcoded-strings` unit test in `front/web/tests/unit`. Add the string to a table instead. ## Add or fix a string 1. Change the English text in the table and add the key to the `PlayerStrings` (or the matching) interface. The compiler then points at the Polish and Chinese tables. 2. Write both translations in the same commit. 3. Run `corepack yarn workspace @ulams/ui test` and `corepack yarn workspace @ulams/web test`. The parity tests fail on a missing key, an empty text, a missing plural form or a different set of placeholders. 4. Look at the page in the language. The accessibility suite (`yarn workspace @ulams/web test:a11y`) opens the main screens in all three languages, light and dark, at desktop and 360 px width. ## Review New Polish and Chinese strings need a review by a native speaker before they count as final. List the new strings in the pull request so the reviewer can read them in one place. > **Note:** Not translated yet: interactive lessons, practice activities, the studio, certificate verification, > the CLI authorisation page and the legacy React app. They stay English and are tracked in the roadmap. --- # Writing docs > How the ulams documentation site works, how to add a page, what the coverage check enforces, and which pages are generated from the repository. Canonical page: https://ulams-dev.github.io/ulams/contributing/writing-docs/ This site is an [Astro Starlight](https://starlight.astro.build/) project in `front/docs-site` (workspace `@ulams/docs`). Most pages are written by hand; ADRs, the roadmap, the contributor files and the reference pages are generated from the repository on every run, so the site never holds a second copy of a document. ## Run it locally ```bash corepack yarn install corepack yarn dev:docs # http://localhost:4322 ``` `dev:docs` runs the `dev` script of `@ulams/docs`: first `sync` (regenerates the generated pages), then `astro dev` on port 4322. The site does not need the API stack. Other scripts: | Command | What it does | |---|---| | `corepack yarn workspace @ulams/docs sync` | Regenerates the generated pages only | | `corepack yarn workspace @ulams/docs coverage` | Runs the coverage check | | `corepack yarn workspace @ulams/docs coverage --report` | Also lists "Needs review" and "Coming" pages | | `corepack yarn workspace @ulams/docs typecheck` | `sync`, then `astro check` | | `corepack yarn workspace @ulams/docs build` | `sync`, coverage check, `astro build` with link validation | | `corepack yarn workspace @ulams/docs screenshots` | Captures UI screenshots (see below) | `DOCS_VALIDATE_LINKS=0` turns link validation off for a quick local build. ## Where pages live Pages are `.md` or `.mdx` files in `src/content/docs`. Each top-level folder is a sidebar section, listed in `astro.config.mjs`, and the sidebar inside a section is generated from the files. - front/docs-site - astro.config.mjs sidebar sections, link validation - scripts - sync-content.mjs runs the generators - generators/ one file per kind of generated page - coverage.mjs the coverage check - src - components - Screenshot.astro - assets - screens/ captured screenshots (.webp) - content/docs - getting-started/ - creators/ - learners/ - admin/ - developers/ - extending/ - operators/ - contributing/ - reference/ generated - decisions/ generated - roadmap.md generated ## Add a page 1. Create a file in the section folder, for example `src/content/docs/admin/certificates.mdx`. The URL follows the path: `/admin/certificates/`. Use `.mdx` when you need components, `.md` otherwise. 2. Add the frontmatter. `title` and `description` are required; the description is one sentence of 50 to 160 characters (it is the search-result and link-preview text). ```yaml --- title: Certificates description: Design certificate templates, bind them to course completion and check what learners receive. sidebar: order: 30 # position in the section, lower first modules: - templates-pdf # what this page documents, see the coverage check adminRoutes: - /configuration/templates/** --- ``` 3. Write the page. Import components at the top of an `.mdx` file: ```js import { Aside, Badge, Steps, Tabs, TabItem, FileTree } from "@astrojs/starlight/components"; ``` In `.mdx` prose, `{`, `}` and `<` start expressions and tags: escape them (`\{`, `\}`, `<`) or put them in inline code. 4. Run `corepack yarn workspace @ulams/docs coverage` and look at the page in `dev:docs`. A new section (a new top-level folder) also needs an entry in the `sidebar` list in `astro.config.mjs`. The section's `index.mdx` with `sidebar.order: 0` is its overview. ## Frontmatter fields Besides Starlight's own fields (`title`, `description`, `sidebar`, `tableOfContents`, ...), the content schema in `src/content.config.ts` adds these: | Field | Type | Meaning | |---|---|---| | `modules` | list of strings | Modules this page documents: folder names in `api/packages` (for example `tenancy`, `lti`) and the app keys `api`, `admin`, `front`, `web`, `sdk`, `ui`, `api-h5p`, `api-pdf`. | | `adminRoutes` | list of strings | Admin routes this page documents, as written in `admin/config/routes.ts` (for example `/users/groups`). A trailing `/**` matches the route and everything below it. | | `learnerRoutes` | list of strings | Learner routes of the reference frontend, derived from the file paths in `front/web/src/pages` (`index` dropped, so `courses/[id].astro` is `/courses/[id]`). `/**` works the same way. | | `topicTypes` | list of strings | Topic types this page documents, by class name as registered in a package service provider (for example `RichText`). | | `coming` | boolean | The feature is on the roadmap but not in the code yet. Shows a "Coming" badge under the title. | | `needsReview` | boolean or string | Documented from the code but not verified end to end. Shows a "Needs review" badge; a string is shown under the title as what to check. | | `generatedFrom` | string | Set only by the generators: the source file of a generated page. Never set it on a written page. | Set `coming` and `needsReview` honestly: they tell readers how far to trust a page, and the `--report` option lists them so they can be worked down. ## The coverage check `scripts/coverage.mjs` builds an inventory from the code and fails when any item is not named by at least one **written** page: - every folder in `api/packages` plus the eight app keys (`modules`); - every admin route in `admin/config/routes.ts`, except redirects, `/`, `*` and `/user` (`adminRoutes`); - every page file under `front/web/src/pages` (`learnerRoutes`); - every topic type class registered with `registerContentClass` or `registerContentClasses` in a package service provider (`topicTypes`). It also fails when a frontmatter entry matches nothing in the code (a renamed route or a removed package), when frontmatter is not valid YAML, and when a page has no description or one shorter than 20 characters. Generated pages do not count towards coverage, so a reference page cannot stand in for a missing guide. ```bash corepack yarn workspace @ulams/docs coverage # exit 1 on gaps corepack yarn workspace @ulams/docs coverage --report # plus "Needs review" and "Coming" lists ``` The check runs in `build` and `lint`, so the docs build in CI fails on gaps. When you add a package, an admin route, a learner page or a topic type, add or extend a page in the same branch (see [Decisions and documentation](https://ulams-dev.github.io/ulams/contributing/decisions-and-documentation/index.md)). ## Generated pages `scripts/sync-content.mjs` deletes and rewrites these on every `dev`, `build`, `typecheck` and `lint`. They are listed in `front/docs-site/.gitignore` and carry a "Generated from" badge. **Never edit a generated file**: your change is overwritten on the next run. Edit the source: | Pages | Source to edit | |---|---| | [Decisions](https://ulams-dev.github.io/ulams/decisions/index.md) | `docs/decisions/*.md` and `docs/decisions/README.md`; `api/docs/adr`, `admin/docs/adr`, `front/docs/adr` | | [Roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md) | `docs/ROADMAP-TODO.md` | | [Packages](https://ulams-dev.github.io/ulams/reference/packages/index.md) and the other reference pages | Package READMEs (`api/packages/*/README.md`) and the code itself: permissions, settings, environment variables, events, artisan commands, schedules, routes, topic types, the UI catalogue | | Contributing guide, Code of conduct, Security policy | `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md` at the repository root | The "Edit page" link on a generated page already points to its source file. Relative links in the sources are rewritten: links to another ADR or the roadmap become site links, everything else becomes a GitHub link, so write ordinary relative links in the source files. ## Blog posts The blog is part of the product landing (`ulams.app/blog/`, Polish at `/pl/blog/`), not of this site. Its posts live in `front/web/src/blog//` and are rendered by `/blog` and `/blog/[slug]` (and `/pl/blog`, `/pl/blog/[slug]`). To add a post: 1. Create `front/web/src/blog//` with `en.md`, `pl.md` (the body in Markdown, no headings above `##`, the same text in both languages) and `meta.json`. 2. In `meta.json` set `slug`, `date` (`YYYY-MM-DD`, not in the future) and `series` (`true` appends the closing sentence of the ten-day series). For each language (`en`, `pl`) give `title`, `description` (up to 300 characters), `tags`, and optionally `video`, `imagesHeading`, `imagesIntro`, `images` and `footer` (Markdown after the screenshots, for example related posts). `video` is `{ file, poster, width, height, caption }`; every image is `{ name, width, height, alt, caption }`. The Polish entry must be translated, including the captions and the alt texts. 3. Put the media in `front/web/public/blog//`: clips (`clip.mp4`, with a `poster.jpg`) and screenshots (`.webp`). Each file must stay under 2 MB, the CI check rejects bigger new files. Keep the file names the same in `meta.json`. 4. Link to other posts as `/blog//` in English and `/pl/blog//` in Polish. 5. Run `corepack yarn workspace @ulams/web test`: `tests/unit/blog.test.ts` checks that both languages exist, that every referenced file exists and that no file is left unused. The index and the sitemap list the new post without further changes, and the static export of the landing (`deploy/mydevil/cloudflare/landing-static.mjs`) crawls one page per post directory. Say what is real and what is a demo, as in the existing posts: no claims that are not in the code. ## Copy page and open in an AI assistant Every page has a **Copy page** button under its title and a menu with **View as Markdown**, **Open in Claude** and **Open in ChatGPT** (`src/components/PageActions.astro`, shown by the `PageTitle` override; not on the splash home). The button copies the Markdown source of the page, which `scripts/agent-files.mjs` publishes next to every page as `/index.md` (the same files `llms.txt` links to). The assistant links carry only the address of that Markdown page in the prompt; nothing is sent until the reader opens the link. Pages need no frontmatter for this. ## Screenshots Screens are `.webp` files in `src/assets/screens`, captured with: ```bash corepack yarn workspace @ulams/docs screenshots ``` The capture (`scripts/screenshots.mjs`, Playwright and sharp) opens a demo tenant: the admin panel at `http://coffee.admin.localhost` and the learner site at `http://coffee.app.localhost`, with the API at `http://coffee.localhost`. Demo mode must be on for that tenant ([Demo mode](https://ulams-dev.github.io/ulams/admin/demo-mode/index.md)): the admin panel then logs in as the tenant admin and the script logs in as the demo student, so no password is involved. Override the hosts with `DOCS_SHOTS_ADMIN`, `DOCS_SHOTS_LEARNER` and `DOCS_SHOTS_API`, and pass a name fragment to capture only some screens (`… screenshots admin-users`). Admin screens are named after their route in `admin/config/routes.ts` (`/users/list` is `admin-users-list`, course editor tabs are `admin-courses-list-course-`), learner screens after their page (`learner-learn-courseid`), and every topic type found in the demo course gets `learner-topic-`. The script only opens pages; start the stack first (see [Local development](https://ulams-dev.github.io/ulams/developers/local-development/index.md)). Show a screen with the `Screenshot` component: ```mdx import Screenshot from "../../../components/Screenshot.astro"; ``` `name` is the file name without `.webp`. `alt` is required: describe what the screen shows, not "screenshot". The component renders nothing while the file does not exist yet, so a page can reference a screen before it is captured. Images are resized and served responsively by Astro. ## Links - Link between pages with root-relative paths and a trailing slash: `/admin/tenants/`, not `../tenants` or `/admin/tenants`. When the site is published under a base path (GitHub Pages), the paths are prefixed automatically. - Link to code and files in the repository with full GitHub URLs (`https://github.com/ulams-dev/ulams/blob/main/...`). - `starlight-links-validator` checks every internal link, including `#anchors`, during `build`; a broken link fails the build. `/api/**` is excluded. > **Tip:** Headings become anchors in lowercase with hyphens: "The coverage check" is `#the-coverage-check`. ## Style - Write for the reader of the section: course authors and administrators get task-oriented pages without code; developers and operators get commands and file paths. - Describe what the code does today. Planned behaviour goes on a page marked `coming: true` or in an `Aside`, never mixed into the description of current behaviour. - English, short sentences, sentence-case headings. Code conventions are in [Coding standards](https://ulams-dev.github.io/ulams/developers/coding-standards/index.md); how to test what you document is in [Testing](https://ulams-dev.github.io/ulams/developers/testing/index.md). ## Build and publishing `.github/workflows/docs.yml` checks and builds the site on pull requests that touch `front/docs-site/**`, `docs/**` or the code the reference pages and the coverage check are made from (packages, routes, admin routes, front/web pages, the UI registry; see [Continuous integration](https://ulams-dev.github.io/ulams/developers/ci/index.md)), and on push to `main` builds it again and deploys it to GitHub Pages. The workflow sets `DOCS_SITE` and `DOCS_BASE` from `actions/configure-pages`, which `astro.config.mjs` reads; locally the site runs at the root. A pull request whose docs build fails (coverage gap, broken link, invalid frontmatter) is not merged. **Before you push** ```bash corepack yarn workspace @ulams/docs coverage corepack yarn workspace @ulams/docs typecheck ``` **Full local build** ```bash corepack yarn build:docs corepack yarn workspace @ulams/docs preview # http://localhost:4322 ``` --- # Content creators > How course authors and tutors build courses in ulams, from the course form to lessons, topics, quizzes, certificates and access. Canonical page: https://ulams-dev.github.io/ulams/creators/ This section is for course authors and tutors. It walks through the admin panel screens you use to build a course and explains what each topic type does for the learner. ## The authoring workflow 1. **Create the course** in **Courses → List → Create new**: title, descriptions, dates, status and authors. See [Create a course](https://ulams-dev.github.io/ulams/creators/create-a-course/index.md). 2. **Build the program**: lessons (which can be nested) and topics inside them. Each topic has one type: text, video, H5P, quiz and so on. See [Lessons and topics](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md). 3. **Prepare reusable content** where a topic needs it: H5P content, SCORM packages and LiaScript courses live in their own libraries under **Courses** and are picked from the topic form. 4. **Decide who gets in**: grant access to users and groups, handle access requests, attach a price, or make the course public. See [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md). 5. **Add a certificate** that is issued when a learner finishes the course. See [Certificates](https://ulams-dev.github.io/ulams/creators/certificates/index.md). 6. **Publish** by setting the status to Published. ## Where things are in the admin panel All authoring screens are under the **Courses** menu: | Menu item | Path | What it is for | |---|---|---| | List | `/courses/list` | Course list, create, import, export, clone; opens the course editor | | H5Ps | `/courses/h5ps` | H5P content library: create, edit, upload, export ([H5P](https://ulams-dev.github.io/ulams/creators/h5p/index.md)) | | LiaScript | `/courses/liascript` | LiaScript courses with versions ([LiaScript](https://ulams-dev.github.io/ulams/creators/liascript/index.md)) | | Interactive | `/courses/interactive` | Interactive package library: upload, versions, preview ([Interactive](https://ulams-dev.github.io/ulams/creators/interactive/index.md)) | | SCORMs | `/courses/scorms` | SCORM package library ([SCORM](https://ulams-dev.github.io/ulams/creators/scorm/index.md)) | | Categories | `/courses/categories` | Course categories (administrators) | | Webinars | `/courses/webinars/list` | Live sessions (not covered here) | | Access Requests | `/courses/access` | Learners' requests to join a course ([Access](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md)) | | Quiz Reports | `/courses/quiz-reports` | Quiz attempts and manual grading ([Quizzes](https://ulams-dev.github.io/ulams/creators/quizzes/index.md)) | External tools for the [external tool topic](https://ulams-dev.github.io/ulams/creators/external-tool/index.md) are registered by an administrator under **Integrations → LTI** (see [LTI](https://ulams-dev.github.io/ulams/admin/lti/index.md)), and certificate templates under **Configuration → Templates** (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)). > **Note:** Which menu items and tabs you see depends on your role's permissions and on a few global settings > (for example, a topic type can be switched off for the whole platform). If something described here is > missing, ask an administrator. The address `/courses/` (for example `/courses/list`) shows the > same course list. ## Guides in this section - [Create a course](https://ulams-dev.github.io/ulams/creators/create-a-course/index.md): The course form and every tab of the course editor. - [Lessons and topics](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md): The program editor, nesting, ordering and the fields every topic has. - [Quizzes (GIFT)](https://ulams-dev.github.io/ulams/creators/quizzes/index.md): Quiz topics, question types, import/export and quiz reports. - [GIFT syntax reference](https://ulams-dev.github.io/ulams/creators/gift-syntax/index.md): Every question type the grader understands, with examples. - [Certificates](https://ulams-dev.github.io/ulams/creators/certificates/index.md): PDF certificates issued when a learner finishes a course. - [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md): Status, dates, public courses, access, requests and products. - [Import and export](https://ulams-dev.github.io/ulams/creators/import-export/index.md): Move a course between installations as a ZIP file, or clone it. - [Build a course with AI](https://ulams-dev.github.io/ulams/creators/course-builder/index.md): Chat that drafts a cited course from your source for you to approve. - [See where learners struggle](https://ulams-dev.github.io/ulams/creators/course-insights/index.md): Progress, quiz results and the sections that confuse people, with small groups hidden. ### Topic types | Topic type | Guide | |---|---| | Rich text (Markdown) | [Rich text](https://ulams-dev.github.io/ulams/creators/rich-text/index.md) | | Video file, YouTube/Vimeo link (OEmbed) | [Video and embeds](https://ulams-dev.github.io/ulams/creators/video/index.md) | | Audio | [Audio](https://ulams-dev.github.io/ulams/creators/audio/index.md) | | Image | [Image](https://ulams-dev.github.io/ulams/creators/image/index.md) | | PDF | [PDF](https://ulams-dev.github.io/ulams/creators/pdf/index.md) | | H5P | [H5P](https://ulams-dev.github.io/ulams/creators/h5p/index.md) | | SCORM | [SCORM](https://ulams-dev.github.io/ulams/creators/scorm/index.md) | | cmi5 | [cmi5](https://ulams-dev.github.io/ulams/creators/cmi5/index.md) | | LiaScript | [LiaScript](https://ulams-dev.github.io/ulams/creators/liascript/index.md) | | Adapt | [Adapt](https://ulams-dev.github.io/ulams/creators/adapt/index.md) (uploaded as SCORM) | | External tool (LTI 1.3) | [External tool](https://ulams-dev.github.io/ulams/creators/external-tool/index.md) | | Project (file hand-in) | [Project](https://ulams-dev.github.io/ulams/creators/project/index.md) | | Quiz (GIFT) | [Quizzes](https://ulams-dev.github.io/ulams/creators/quizzes/index.md) | What learners see when they open these topics is described in the [learner guide](https://ulams-dev.github.io/ulams/learners/index.md). --- # Access, prices and publishing > Control who sees and opens a course with its status, dates and public flag, grant access to users and groups, handle access requests, invite by e-mail and sell it. Canonical page: https://ulams-dev.github.io/ulams/creators/access-and-publishing/ Two questions decide what a learner can do with a course: **can they see it** (the catalogue and the course page) and **can they open it** (the lessons). Status and visibility answer the first; access answers the second. ## Course status Set the status on the course's **Attributes** tab. | Status | Effect | |---|---| | Draft | Only in the admin panel. Learners cannot see or open it. | | Published | Visible in the catalogue; people with access can take it. Publishing sends the "course published" event. | | `published_unactivated` | Counts as published, and a daily job switches it to Published once **Active from** has passed (and **Active to** has not). In the English admin it is currently labelled "Opublikowany nieaktywny". | | Archived | Hidden from learners; set it back to Published to reopen the course. | Whether a published course shows up for people who are not signed in depends on the platform's visibility setting (`platform_visibility`, set by an administrator). With `public` (the default) new courses are listed for everyone; with `registered`, new courses are only visible to people who have access to them. ### Public courses When an administrator enables the **Is public** switch for course forms, you can mark a course as public on the **Attributes** tab. A course that is both public and published can be opened by anyone, without an account and without being granted access. ### Free preview topics Topics marked **Able to preview** open for everyone who can see the course, so learners can try it before they get access. See [Lessons and topics](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md#fields-every-topic-has). ## Give access to users and groups 1. Open the course editor's **Access** tab (`/courses/list//access`). 2. Add people under **Users** and whole groups under **Groups**. 3. Click **Submit**. The lists you submit replace the previous ones. Removing a user or a group takes their access away. Adding and removing access sends the course assigned/unassigned notifications, which an administrator can turn into e-mails in [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md). *Screenshot: The Access tab with users and groups* ## Access requests Learners can ask for access to a course and add a message. The requests appear in **Courses → Access Requests** (`/courses/access`) with the course, the learner, the date, the status (pending or approved) and the extra data the learner sent. - **Approve** grants the learner access to the course. - **Delete** removes the request. People with the approval permission are notified about new requests. An administrator can switch on automatic approval in the settings (`auto_accept_access_request`), which grants access as soon as a request arrives; use it for free courses that only require a sign-up. *Screenshot: Access Requests with pending and approved requests* The request button is part of the legacy learner app; the reference front does not offer it yet. ## Invite people without an account The **Users Attached without Account** tab (`/courses/list//user_submission`) takes e-mail addresses of people who do not have an account yet. Each person receives an e-mail with instructions; once they create an account with that address, they get access to the course. The invitation e-mail uses a notification template that an administrator has to set up; see [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md). ## Prices and products To sell a course, open its **Product** tab (shown with the sales permission). It is the same product form as **Sales → Products**: name, price and tax, whether the product can be purchased, limits per user and in total, related products and the product's media, categories and tags. Learners who buy the product get access to the course once the payment is confirmed. > **Note:** The product and payment screens are described in the [administrator guide](https://ulams-dev.github.io/ulams/admin/index.md). Commerce is planned > to move to a separate service later ([roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md)); the LMS keeps deciding who has access. --- # Adapt Learning courses > Use courses built with the Adapt Learning framework by uploading their SCORM export, or keep the JSON source in ulams and build it into a SCORM package. Canonical page: https://ulams-dev.github.io/ulams/creators/adapt/ [Adapt Learning](https://www.adaptlearning.org) builds responsive e-learning courses. ulams supports Adapt in two ways ("paths"); only the first is ready for authors today. ## Path A: upload the SCORM export (works today) 1. In the Adapt authoring tool or framework, build the course with the **spoor** extension (`adapt-contrib-spoor`), which exports it as a SCORM package. 2. Upload the `.zip` in **Courses → SCORMs**. ulams recognises Adapt packages from their files and labels them **Adapt** in the **Authoring tool** column. 3. Put the package's SCO in a lesson with a **SCORM** topic, or use it as the whole course. From there it behaves exactly like any other SCORM package: same upload checks, same player, same completion tracking. See [SCORM packages](https://ulams-dev.github.io/ulams/creators/scorm/index.md). ## Path B: Adapt JSON sources Path B keeps the Adapt course source itself in ulams, as versioned JSON (`course`, `config`, `contentObjects`, `articles`, `blocks`, `components`), and builds it into a SCORM package with a separate build service ([ADR 0013](https://ulams-dev.github.io/ulams/decisions/0013-adapt-build-worker/index.md)). The built package goes through Path A, so there is still no separate Adapt topic type. It is a feature flag, **off by default**. An operator turns it on with `ADAPT_SOURCE_ENABLED=true` and starts the build service (see [Configuration](#configuration)). While it is off, **Courses → Adapt** shows a notice that Adapt sources are not enabled. You need the `adapt_manage` permission (given to `admin`). ### The Adapt library **Courses → Adapt** (`/courses/adapt`) lists sources with their title, **status**, current version, the version last built and the SCORM package it produced. | Status | Meaning | |---|---| | `draft` | Saved, not built yet, or changed since the last build | | `building` | A build is queued or running. The list and the editor refresh every 3 seconds | | `built` | The built version was imported as a SCORM package | | `failed` | The build failed. The error is shown in the row and in the editor | 1. **New Adapt source**: paste the JSON or upload a `.json` file, and optionally give a title (it defaults to the course title). The structure is checked first; errors are listed with their path, for example `/components/3/_component`. 2. Open the source with **Edit** to change the JSON. **Save as new version** (with an optional change note) keeps the previous versions; open an older one with **Open** in the version list to start from it. 3. **Build** turns the current version into a SCORM package. The editor asks you to save changes first. 4. When the status is `built`, the editor shows the package number. Add a **SCORM** topic to a lesson and select that package (see [SCORM packages](https://ulams-dev.github.io/ulams/creators/scorm/index.md)). Deleting a source does not delete the SCORM package that was built from it. > **Note:** The version list comes from `GET /api/admin/adapt/{id}/versions`; the other endpoints are listed in > [API endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## Configuration For operators. Path A needs none of this. | Variable | Default | Meaning | |---|---|---| | `ADAPT_SOURCE_ENABLED` | `false` | Turns Path B on | | `ADAPT_BUILDER_URL` | `http://adapt-builder:8080` | Where the API reaches the build service | | `ADAPT_BUILDER_TOKEN` | none | Shared secret for calls to the build service; must match the service | | `ADAPT_BUILDER_TIMEOUT` | `300` | Seconds the API waits for one build call | | `ADAPT_MAX_SOURCE_KB` | `4096` | Largest source JSON accepted | | `ADAPT_QUEUE_CONNECTION`, `ADAPT_QUEUE` | `-builder`, `builder` | Where the build job runs | The build runs as a job on the builder queue (job timeout 900 s, `retry_after` above it), so a worker for that queue must be running: see [Queues and the scheduler](https://ulams-dev.github.io/ulams/operators/queues-and-scheduler/index.md). The build service is a separate GPL-3.0 program in `api/adapt-builder` (about 30 to 90 seconds of CPU per build). In the development stack start it with `docker compose --profile adapt up -d adapt-builder` from `api/`. Its image is not among the images published to GHCR, so a production install builds it from `api/adapt-builder` (see its README) and runs it where only the API can reach it. --- # Audio topics > Add a narration, podcast or music clip to a lesson with an audio topic that accepts MP3 and OGG files. Canonical page: https://ulams-dev.github.io/ulams/creators/audio/ An audio topic (`Audio`) plays one uploaded sound file. 1. In the program, add a topic and choose **Audio**. 2. Click **Click to upload** and choose an **MP3** or **OGG** file (these are the formats the server accepts), or pick one from the file browser. 3. The upload saves the topic and shows a player so you can check the file. Set the title and the [common fields](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md#fields-every-topic-has) and save. Use the topic's **Description** (Open editor) for a transcript; the reference front shows it below the player. ## Completion The reference front does not complete an audio topic by itself: the learner presses **Mark as complete**. --- # Certificates > How a course issues a PDF certificate when a learner finishes it, how to pick the certificate template for a course, and where to download issued certificates. Canonical page: https://ulams-dev.github.io/ulams/creators/certificates/ ulams issues a PDF certificate automatically when a learner **finishes a course**, that is, when every active topic of the course is complete. The certificate is made from a PDF template designed in the admin panel and rendered by the platform's PDF service. ## How a course gets its certificate When a learner finishes a course, ulams looks for a PDF template for the "course finished" event: 1. the template **assigned to this course** in its **Certificates** tab, if there is one; 2. otherwise the **default** template for that event, if one exists. New installations get a default certificate (A4 landscape with a QR code). The certificate is stored together with the template as it was at that moment, so later changes to the template do not change certificates already issued. ## Pick the template for a course 1. Make sure the template exists. Certificate templates are created and designed by someone with template permissions in **Configuration → Templates** (see [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md)): a PDF template for the course-finished event, designed in the visual pdfme designer. 2. Open the course editor's **Certificates** tab (`/courses/list//certificates`). 3. Select one or more templates in the selector. Below the selector, each selected template lists the **Generated PDFs**: one row per learner who received the certificate, with **Download** per certificate and **Download all PDFs** as a zip. *Screenshot: The Certificates tab with the template selector and generated PDFs* > **Note:** The Certificates tab is hidden when an administrator turns certificates off for the platform > (setting `disable-Certificates`) or when your role lacks the permission. ## What a certificate can show In the designer, a field named after a variable is filled with its value, and variables typed into fixed text (`Issued by @VarAppName`) are replaced in place. The course-finished event provides, among others: | Variable | Value | |---|---| | `@VarUserName` | The learner's name | | `@VarCourseTitle`, `@VarCourseSubtitle`, `@VarCourseId` | The course | | `@VarCourseActiveFrom`, `@VarCourseActiveTo` | The course dates | | `@VarCourseCategories`, `@VarCourseCategoriesWithBreadcrumbs` | The course categories | | `@VarContinuousCertNumber`, `@VarAnnualCertNumber` | Running certificate numbers | | `@VarCertificateId`, `@VarCertificateVerifyUrl` | A unique ID and a verification address (encoded as a QR code in the default template) | | `@VarAppName`, `@VarToday` | The platform name and the date | The designer lists the full set for the event. A course-finished template must contain `@VarCourseTitle` in its title section to be valid. The QR code opens the public verification page at `/certificates/verify/` on the academy's learner site; see [Certificates (admin)](https://ulams-dev.github.io/ulams/admin/certificates/index.md#verification-page). ## Learners In the legacy learner app, learners download the PDF from the course finish page and from their profile's course list. The reference front shows the issued certificate on the course finish page (`/learn//finish`) with a PDF download and a verification link, and lists every certificate on `/account/training`; a labelled preview appears only while the course is unfinished. See the [learner guide](https://ulams-dev.github.io/ulams/learners/index.md). --- # cmi5 packages > What cmi5 support exists today, how cmi5 packages and assignable units are uploaded through the API, and what is still missing for authors and learners. Canonical page: https://ulams-dev.github.io/ulams/creators/cmi5/ [cmi5](https://aicc.github.io/CMI-5_Spec_Current/) is the xAPI profile for launching tracked learning content from an LMS. A cmi5 package is a zip with a `cmi5.xml` course structure and one or more **assignable units** (AUs). ulams can store cmi5 packages, has a cmi5 topic type and includes its own xAPI learning record store (LRS) for the statements the content sends. > **Set up through the API for now:** There is no cmi5 screen in the admin panel and cmi5 is not offered when you add a topic. An > administrator or developer uploads the package and creates the topic through the API. Learners > launch cmi5 activities in the course player like any other topic. ## What exists today | Piece | Where | |---|---| | Upload a cmi5 zip; it is checked by the upload guard (zip only, 512 MB by default, safe extraction) and its AUs are read from `cmi5.xml` | `POST /api/admin/cmi5` (field `file`) | | List and delete uploaded packages | `GET /api/admin/cmi5`, `DELETE /api/admin/cmi5/{id}` (deleting needs the `cmi5_delete` permission, admins only) | | Topic type `Cmi5Au` whose `value` is the ID of one AU | created through the topics API | | Launch an AU (the player page, or with `?format=json` the launch URL) | `GET /api/cmi5/player/{auId}`; learners have the `cmi5_read` permission | | Exchange the one-time launch token for the AU's LRS session token | `POST /api/cmi5/fetch?token=...` (public; the launch token is the credential) | | Launch parameters for a course (endpoint, fetch URL, actor, registration) | `GET /api/cmi5/courses/{id}` | | Statements received for cmi5 content | `GET /api/admin/cmi5/statements` | | The xAPI LRS the content talks to | `/trax/api//xapi/std` | The full endpoint list is in the [API endpoints reference](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md). ## How a learner launch works 1. Upload the cmi5 zip; ulams stores the package on the cmi5 disk (`CMI5_DISK`, which follows `SCORM_DISK`: the tenant bucket in production) and creates one record per AU. 2. Add a topic of type cmi5 for an AU. 3. When an enrolled learner opens the topic, the front asks the API for a launch and frames the AU on the tenant [content origin](https://ulams-dev.github.io/ulams/operators/content-origin/index.md) (`.content./cmi5/...`) in a sandboxed frame, so the package code never runs on the app or API origin. 4. The launch URL carries the cmi5 `endpoint`, `fetch`, `actor`, `registration` and `activityId` (`GET /api/cmi5/courses/{id}` or the launch URL of `GET /api/cmi5/player/{auId}`). The `fetch` URL holds a **one-time launch token**, not the learner's access token: 64 random characters, stored only as a hash, and valid for **10 minutes** until the AU first uses it. The AU posts to the `fetch` URL (`POST /api/cmi5/fetch?token=...`, public, 60 requests a minute) and gets `{"auth-token": ...}`, an **LRS-only session token**, valid for `CMI5_SESSION_MINUTES` (default 120) counted from that first fetch. That token works only on the built-in LRS (`/trax/api//xapi/std`), only for that registration, and every other API endpoint rejects it. An AU that fetches again within the session gets the same token; a token that is unknown, malformed or expired gets a 401 with the cmi5 error body. 5. The AU sends its xAPI statements to the LRS. A `completed` or `passed` statement completes the topic for the learner, and the usual lesson and course completion, certificates and events follow. The AU runs on the content origin and calls `fetch` and the LRS from there, so the reverse proxy must answer those two paths with `Access-Control-Allow-Origin: *` and without cookies. The development Caddyfile and the production example have a `@cmi5` block for it; if you write your own proxy configuration, copy that block (see [Content origin](https://ulams-dev.github.io/ulams/operators/content-origin/index.md)). The design is in [ADR 0046](https://ulams-dev.github.io/ulams/decisions/0046-cmi5-content-origin-and-launch-token/index.md). ### Packages uploaded before this change Older installs stored cmi5 packages on the API's local disk. After switching `CMI5_DISK` to the bucket, copy them with `php artisan cmi5:move-to-bucket` (add `--domain=` for one tenant). The command is safe to run again and leaves the originals in place. --- # Code exercises > Give learners files to edit and tests to run in JavaScript or TypeScript, right in the lesson, in an isolated browser sandbox, with practice attempts recorded for you. Canonical page: https://ulams-dev.github.io/ulams/creators/code-exercises/ A **code exercise** topic gives the learner a few files to change and a set of tests to run. The learner edits the code in the lesson, presses **Run tests** and sees which tests pass and why the others fail. The code runs in the learner's browser, in a sandbox that has no network and cannot reach the lesson page or the learner's account. JavaScript and TypeScript are supported. > **A run is practice, not a grade:** The learner's browser runs the tests and reports the result, so the result is stored as an **unverified > practice attempt**. It moves the learner's progress (the topic completes by the rule you choose) and shows > up in the teacher report, but it **never counts towards a certificate or a compliance path**. Hidden tests > and verified grading arrive with the server runner; for now every test is visible to the learner. ## Create an exercise 1. In the course editor, add a topic and choose **Code exercise**. 2. Pick the **language**, write the **task** in Markdown and add the **starter files** the learner will edit. 3. Add the **visible tests**. A test file imports the learner's files with relative paths and uses the tiny built-in test API (see below). The editor lists problems with your files while you type. 4. Choose when the topic completes and how long a run may take, then save. **Preview in the learner site** opens the lesson without recording anything. ## Writing tests There is nothing to install. Test files get these globals: ```js import { sum } from "./sum.js"; describe("sum", () => { test("adds two numbers", () => expect(sum(1, 2)).toBe(3)); test("adds negative numbers", () => expect(sum(-1, -2)).toBe(-3)); }); ``` - `test(name, fn)` (or `it`), `describe(name, fn)`, `beforeEach(fn)`, `afterEach(fn)`; a test may be `async`. - `expect(value)` with `toBe`, `toEqual`, `toStrictEqual`, `toBeTruthy`, `toBeFalsy`, `toBeNull`, `toBeUndefined`, `toBeDefined`, `toBeNaN`, `toBeGreaterThan(OrEqual)`, `toBeLessThan(OrEqual)`, `toBeCloseTo`, `toContain`, `toContainEqual`, `toHaveLength`, `toMatch`, `toBeInstanceOf`, `toHaveProperty`, `toThrow`, and `.not`, `.resolves`, `.rejects`. - A failed `expect` shows as **Failed** with its message ("Expected 3, received 0"); any other thrown error shows as **Error**. `console.log` output is shown to the learner (cut at 8 KB). - Files can import each other with relative paths (`./sum.js`, `./lib/util`, `./math` for `math.ts` or `math/index.ts`). TypeScript is compiled by esbuild and **not type-checked**. A package name, a URL or a path outside the exercise is a build error: an exercise can only import its own files. ## Settings | Setting | What it does | |---|---| | Stop a run after | 500 ms to 30 s, default 5 s. A run that takes longer is stopped and the learner is told to look for a loop that never ends. | | The topic completes | after a **passing run**, with the percentage of passing tests that counts (default 100), or after **any run**. | ## Limits At most 20 starter files and 10 test files, 64 KB each and 256 KB together. Paths are relative, made of letters, digits, `_`, `-` and `.` with `/` between folders; no `..`, hidden names or absolute paths. JavaScript exercises may contain `.js`, `.mjs`, `.json`, `.txt` and `.md` files, TypeScript ones also `.ts`; test files are `.js`/`.mjs`, or `.ts` in TypeScript exercises. Everything is checked when you save, by the API, because exercises can also arrive through imports and the command line. ## From the command line ```sh ulams topics create-code-exercise --lesson 12 --title "Make sum add" \ --files @starter.json --tests @tests.json --text @task.md --json ``` `starter.json` and `tests.json` are lists of `{ "path": "...", "content": "..." }`. The same command is an MCP tool for agents. Course exports (`.ulam`) carry exercises as plain JSON and the import validates them again. ## What learners and teachers see Learners edit the files in plain text areas (nothing traps the keyboard), run the tests with a button or Ctrl+Enter, and see each test's result and message. Their earlier attempts are listed in the lesson. Teachers get every learner's attempts for an exercise from `GET /api/admin/code-exercises/topics/{topic}/attempts`, and the learner-insights module records a `code.attempt_finished` signal for each run, so repeated failures show up as "struggling" like repeated failed quiz attempts do. ## How it is kept safe The code never runs on your server or in the lesson page. It is bundled and run inside two nested frames on the academy's content origin, with an isolated origin, a content security policy without network access or `eval`, and a time limit; a hostile or broken exercise cannot reach the learner's session, the lesson page or the network, and an endless loop is stopped. Runs start only when the learner presses the button. Details for developers are in [the interactive bridge](https://ulams-dev.github.io/ulams/developers/interactive-bridge/index.md#code-exercises) and [ADR 0170](https://ulams-dev.github.io/ulams/decisions/0170-code-exercise-runners/index.md). --- # Build a course with AI > Turn a Markdown, PDF or DOCX source into a cited course in your academy through an interview, an approved outline and approved generation, then refine it by chatting. Canonical page: https://ulams-dev.github.io/ulams/creators/course-builder/ The Course Builder turns your own material into a course in your academy. You stay in charge: the assistant proposes, you approve every change, and every lesson cites the passage of your source it comes from. ## Before you start - You need a **tutor** or **admin** account. In the admin, open **Courses → Build with AI**, or use the **Build a course with AI** card on the course list. The builder opens in the web app at `/studio`. - Have one source document ready: **Markdown, PDF or DOCX**, up to 20 MB (PDF up to 300 pages). Text-based PDFs work best; scanned PDFs without text cannot be read. ## 1. Upload your source Start a new course and drop the file on the page (or **Browse files**). The builder splits it into sections, each with a stable id such as `frg_7p1w…`, and shows them in the source card. Citations point to these sections. The upload is read as **data only**: text in the document can never change what the assistant does, even if it looks like an instruction. ## 2. Answer the interview The assistant asks six short questions, one card at a time: who the course is for, the level, total length and lesson length, tone, assessments (a quiz after each lesson, a final test) and the language. Some cards are fixed and need no AI: **who the course is for** (one course for everyone, or extra versions by level and role, see [course variants](https://ulams-dev.github.io/ulams/creators/course-versions-and-variants/index.md)), **price** (free or paid, with an optional amount; you confirm it again before publishing) and, if you may change the site's look, **theme** (a card per preset with a live preview, and an optional accent colour that is adjusted when it would be hard to read, WCAG AA). Each card says **why** it asks. - Pick an answer and press **Continue**, or press **Decide for me** to accept the suggested default. - **Decide the rest for me** fills every open question at once. - The **Course brief** panel shows your answers; fields the assistant chose are marked "decided for you". Press **Edit** on any row to change it with the same control the interview used, then **Save**. Changing the audience, level, length, tone, assessments or language after the outline marks the outline and lessons as out of date (nothing is regenerated until you ask); changing the price or theme does not. ## 3. Review the outline and the learning objectives The outline appears as a proposal: modules, lessons with their length, measurable learning objectives and amber **citation chips**. Select a chip to read the source passage. - **Edit** an objective inline, then **Approve outline & generate**. - Choose each lesson's **format** (see below) before you approve. - Or write what you want changed and press **Request changes**; you get a new proposal with the differences marked (added, changed, removed). Nothing is generated before you approve the outline. ### Lesson formats Every lesson is **rich text** unless you choose otherwise in the outline. The other formats are only offered when your academy can create them: | Format | What learners get | Offered when | |---|---|---| | Rich text | Formatted text and a list of the sections it draws on | always | | LiaScript | An interactive lesson with two or three questions inside the text that they answer as they read (single choice, multiple choice or a short answer) and see the explanation at once | LiaScript is available (it is by default) | | Lesson with an H5P activity | The lesson text followed by one activity: fill in the blanks, drag the words or flash cards | the H5P libraries Blanks, Drag the Words and Dialog Cards are installed | | Lesson with an interactive | The lesson text followed by one of the interactive packages in your library, played between the steps the builder picks, with a short cited text beside it | your library holds at least one [interactive package](https://ulams-dev.github.io/ulams/creators/interactive/index.md) | The builder never writes LiaScript, H5P or interactive code. For a LiaScript lesson it writes the questions and our code lays them out in the LiaScript syntax; for an H5P activity it fills a small form of its own (sentences with blanks, words, cards) that our code turns into the H5P content; for an interactive it only chooses a package from your library and the steps. **Every question, blank and card cites the passage it comes from**, answers have to appear in that passage, and the activity is a diff you approve like every other change. An interactive package is never created or edited by the builder (it is software someone uploaded and answers for). After the lessons are written you see the extra parts in the lesson preview (**Self-check 1**, the activity, each with its citations); you can ask the assistant to change a self-check like any other question. You can switch a written lesson back to rich text in the outline editor; the LiaScript document or H5P content is removed when you apply. Another format is written together with the lesson, so choose it in the outline before generating. ## 4. Watch the lessons being written The progress card shows the stages (lessons, grounding check, interactive elements, quizzes, metadata) and each lesson with its citations, questions and cost. The running AI cost is shown at the top. - A **grounding check** compares every lesson with the passages it cites; claims it cannot find are rewritten once, and anything left is **flagged** for you. - If one lesson fails, press **Retry** on that lesson. The rest of the course is kept. - You can close the tab; generation continues and the conversation is there when you come back. ## 5. Apply to your academy The apply card lists what will be created (course, lessons, topics, quiz questions, landing page) and any warnings. Press **Apply to my academy**. The course is created **unpublished**, through the same services the admin uses. If you picked a theme, the apply writes it to the site settings, but only when you are allowed to change the site (the `settings_manage` permission). Otherwise the theme is skipped with a note and the course is applied anyway; an admin can pick the theme in Settings. ## 6. Preview and discuss each element Press **Preview and discuss** on the success page (or in the workspace) to see the course the way a learner will, and talk to the assistant about any part of it. The page at `/studio/s//preview` shows the same course page, lesson player and landing page learners get, built from the current version of your course, with the chat in a panel on the right (**Hide chat** collapses it). - **Select an element.** Hover a part of the page (the course title, a module, a lesson's title, a paragraph, a quiz question, a landing section) and press **Discuss**; with the keyboard, Tab to the **Discuss** button and press Enter. The element is outlined and the chat is now about it. **Esc** in the panel, or **Back to the preview**, returns you to the element. - **See the sources.** The panel lists the source passages the element cites; select one to read it. - **Ask, then approve.** Type what you want ("make the distractors less obvious"). The proposed change appears in the panel as a **diff** with its citations. Nothing changes until you press **Approve**; **Reject** keeps the current version. - **See it change.** After you approve, that element is re-rendered in place and highlighted for a moment, and the course in your academy is updated. **Undo** and **Redo** work from the preview too. - **Pages.** Switch between the **Course page**, the **Landing page** and the **Lessons** (the lesson player has the program tree, the quizzes and the final test). Quiz questions show the correct answers so you can discuss them. - **Landing sections** (headline, outcomes, syllabus, questions) belong to the course: discussing one changes the course title, subtitle or description. Objectives and the FAQ change with the lessons. The preview never records progress or quiz attempts. The studio's Preview as learner (below) is the plain page without the chat. ## 7. Refine any element by chatting Open the **Workspace**. Select a lesson or a quiz question in the curriculum tree, then type what you want ("make the distractors less obvious", "shorter, with an example"). The assistant proposes the change as a **diff**; **Approve** applies it to the course, **Reject** keeps the current version. After you approve, the card reads "Approved; applying to the course…" until the course in your academy has caught up with the approved version, then "Approved and applied". The **Course overview** link appears at the same moment. - **Undo** and **Redo** move between versions and update the course. - **Version history** lists every version; **Restore** brings an old one back as a new version. - **Sources** (under the tree) lists every section of your sources with how many elements of the course cite it. Sections nothing cites are marked **Not cited yet**; **Show only uncovered sections** lists just those, so you can see what the course leaves out. Under a section, **Show elements** jumps to each lesson, paragraph or question that cites it (an objective jumps to its lesson). When you select an element in the tree, the sections it rests on are highlighted. Select a section's name to read the passage. ### Give me options Select an element, describe the change and press **Give me 2 options** (or write "give me options" in the message). The builder makes two proposals, one model call each, so it costs about twice a normal edit (the button says so). They appear side by side as word-level diffs with their citations. **Use Option A** (or B) approves it and rejects the other; **Keep the current text** rejects both. Nothing changes until you choose. ### Edit the structure **Edit the structure** (above the Sources panel) lists modules and lessons. Drag a lesson or module to a new place, or use the buttons: **Move up**, **Move down**, **Move to previous module**, **Move to next module** (every action has a button, so the keyboard works without dragging). **Rename** edits the title in place, **Remove** asks before it deletes, and **Add a lesson** needs a title, a learning objective and the source section the lesson is based on (a new lesson has no text yet; ask the assistant to write it). A lesson keeps its objectives, citations, text and quiz when you move it. Every change is saved at once as a new version (no approval needed), re-applied to your academy, and can be undone. ## 8. Preview as a learner On the success page, **Preview as learner** opens the course the way learners will see it, even while it is still unpublished: the course page at `/preview/courses/` and every lesson under it (`/preview/courses//`). A yellow banner says **Preview: not published** and links back to the studio. - Only a signed-in author (a tutor of the course, or an admin) can open it. Learners, anonymous visitors and authors of other academies get the normal "not found" page. - It is a preview, not a learner session: progress is **not** recorded, **Mark as complete** is hidden, and quizzes show a note instead of starting an attempt, so nothing is saved. - The page is private (`Cache-Control: private, no-store`) and marked `noindex`. - Once the course is published, the success page offers **View as learner**, which goes to the public course page. The preview keeps working and shows **Preview: published**. The landing page preview links its call to action to the same preview. ## 9. Publish The success page opens with the **publish summary**: the address the course will have, its price and theme, its size, and two lists. - **Fix before publishing** (blocking): the course is not applied yet, the latest version has not been applied, someone edited an element in the admin after the last apply and applying would overwrite it, the generated landing page is not valid, or the course is paid but has no confirmed price. **Publish course** stays disabled until these are gone. - **Review** (warnings): elements without a source citation, lessons flagged by the grounding check, lessons much longer than your brief asked for, an accent colour that had to be adjusted to stay readable, and accessibility problems in the generated text (a heading level that jumps, a link without text, an image without alternative text, a table without a header row). Tick **I have read the warnings** to publish anyway; the decision is yours. **Publish course** publishes the course, shows its generated landing page as the public course page, and for a paid course makes its product purchasable (see [Pricing](https://ulams-dev.github.io/ulams/creators/pricing/index.md)). The page is built from the course's own content and replaces the standard course page; if it is ever not valid, learners see the standard page. The success page also links to the course form in the admin, the learner preview and the landing preview. ### Publish on a new site Platform operators (people with the `platform_admin` permission, on an installation that sets `TENANCY_NEW_SITES=true`) can give a course its own site. Press **Edit** on the **Site** row of the Course brief and choose **A new site**, with a short name (letters, digits and dashes). On the success page, **Create the site and move this course** then: 1. creates the site (its own database, storage, theme and accounts; this takes a few minutes and the page shows the progress), 2. moves your session to it: the brief, the latest version, your sources and all their passages, so every citation still points to the same passage, 3. creates your account in the new site as an administrator and e-mails you an invitation. Then **Continue in the new site** and finish there: apply the course, pick the theme, publish. Nothing is applied or published on the new site before you do, and the course in the original site is not touched. Everyone else publishes into the current site. ## 10. Keep the course in sync with its sources Once the course exists, the **Sources** page (in the left navigation) shows each source of the course: its name and type, how it is connected (**Upload**, **Git repository** or **Web page**), a status (**Up to date** or **New version available**), the revision your course reflects (**In your course**) and the latest one. - **Upload a new version**: drop the updated Markdown, PDF or DOCX file on the source. We keep it as a new **revision** and compare it with the previous one. If the file is the same as the latest revision, nothing is added and you are told so. If the file is rejected, the message says why and nothing changes. - The **revision timeline** lists every revision, newest first, with its origin, time, status and what changed ("3 changed, 1 removed, 2 added, 1 moved"). Select a revision to see its changes. - Each **changed passage** shows the section, whether it was changed, moved, removed or added, how large the change is and why it may matter (for example "a number changed"), with the old and new text. Removed words are marked with a minus sign and added words with a plus sign, so the difference does not depend on colour. - **Cosmetic changes** (spacing, punctuation) are hidden by default; use **Show N cosmetic changes** to see them. Uploading a new version does not change your course. The course keeps reading from the revision it reflects until you accept updates. ## 11. See what is out of date When a source changes, the course is marked **stale** until you decide what to do with the change. The marks always use words and an icon, never colour alone: - In the **session list** each course shows **In sync**, **Stale · 3 days** (how long ago the source changed) or **Updates dismissed**. Select it to open the update. - In the **workspace** a banner at the top says how many elements are out of date and links to the review. In the course tree, lessons and questions carry **Update pending**, **Answer may be wrong** or **Source removed**, and the affected passages are highlighted with a note such as "Based on §3.2 Ratios, changed 3 days ago". - Staleness works without AI: it only needs the source to have changed. ## 12. Review an update **Updates** (in the left navigation) lists every update proposal for the course, newest first, with the source revisions it compares, its status, how many elements and quiz answers it touches, how many items you decided, and its cost. Open one to review it. Nothing in the course changes until you accept changes and apply them. - The **source changes** are on the left, with the old and new text of every changed passage. - The **proposed changes** are in the middle, grouped by lesson. Each item says why it changes, shows the old and new text with removed and added words marked in words as well as colour, and cites the passages it relies on. **Accept** and **Reject** are toggle buttons; **Undo my decision** takes a decision back. After you decide, focus moves to the next undecided item and a screen reader announces the decision. - **Ask for changes** lets you write what should be different; the assistant writes a new version of that one element (up to three times per item). Without AI you edit the element in the workspace. - Warnings are explicit: **Possibly unsupported** (a claim the source does not back), **Answer may be wrong** (the source changed where an answer comes from) and **Answer changed** (the correct answer is different now; learners' earlier scores stay on record). - Quiet changes are shown too: **Citation update** (only the references moved), **No change needed** (the assistant found nothing to change), **Removal** (the source no longer covers it), **New in the source** (a section no lesson covers yet) and **Update by hand**. - On **New in the source**, **Suggest a lesson** asks the assistant for a lesson based on that section. It appears as **Suggested lesson**: the module it goes into, its title, objectives and text, all citing the section, and any claim the source does not back is flagged. Accept it to add the lesson to the course when you apply, reject it to leave the course as it is, or ask for changes (up to three times). A suggested lesson has no quiz yet; ask the assistant for one in the workspace. When the new section was the only change, the update was settled as **No impact**; suggesting a lesson reopens it for review. Without AI, add the lesson in the workspace. - An item you edited in the workspace after the analysis is marked **Conflict** or **Edited after the analysis**. Ask for a new version of it, or reject it. **Accept all** accepts every undecided update, removal, no-change item and suggested lesson. **Reject all** keeps your course as it is and marks the new source revision as reviewed, so the same changes are not proposed again; the page asks you to confirm first. When the estimated AI cost is above the automatic limit, the proposal waits with an **Analyse (about $0.42)** button and asks you to confirm. While the analysis runs you see its progress per lesson. If a lesson fails, **Retry this group** runs only that part again. If the AI budget is used up or AI is turned off, the changed elements are listed for you to update by hand in the workspace. The bar at the bottom shows how many changes are accepted. **Apply N accepted changes** creates a new version of the course (named "Source update r1 → r2" in the version history) and keeps what learners have done. If you edited elements after the analysis, the apply stops and lists them; if elements were edited in the admin after the last apply, you confirm **Overwrite and apply**. ## 13. What learners see after an update Applying an update never changes what a learner has done: completion, scores and attempts stay as they are, and nobody is graded again. Learners are told what is different: - a lesson with a **major** change shows learners who completed or started it "Updated since you completed it" with the note you wrote and a **Mark as reviewed** button; - a quiz question whose **correct answer changed** shows "One question was corrected. Your previous score stays on record. Retake it to update your result." and gives each learner one extra attempt; - a removed lesson that a learner had completed stays in their history as "Retired lesson, no longer part of the course"; - a lesson added after a learner finished the course shows "New since you finished" on the course page, and their course completion is kept. Optionally the course page can also show "The source of this lesson changed on …; an update is under review". That marker is off by default. You see this before you apply, on the review page, in the **Learners** panel under the summary: - **What learners will see** counts the learners each rule reaches, in words ("12 learners will see an "updated since you completed it" notice", "3 learners get one extra attempt for the corrected question") and always ends with "Completion and past scores stay as they are." After the update is applied the same panel is in the past tense. - **Note for learners: what changed** is the text under "Updated since you completed it". It starts as the reasons of the major changes. Edit it (plain text, up to 500 characters; it is never interpreted as formatting) and select **Save the note**, or **Use the suggested note** to start again. If you change it and then apply, the note is saved first; if it cannot be saved, nothing is applied. - **Learner notices for this source** has two switches, also on the **Sources** page. **Tell learners when a lesson they completed is updated** (on by default) controls the "Updated since you completed it", "New since you finished" and retired-lesson notices; the notice for a corrected quiz question and the extra attempt are always sent. **Show that an update is under review** (off by default) controls the marker on the course page. A switch is saved as soon as you change it. ## 14. See who decided what **Audit** (in the left navigation) is the trail of everything that happened to the course and its sources: a source was connected or changed, a new revision was found, an update proposal was created, analysed, accepted, rejected or applied, and learner notices were sent. It is written by the system in the same step as the change, it can only grow, and nobody can edit or delete an entry. - The table shows **when**, **what** (in words, with the action code under it), **who** (a person, the system or an agent) and a one-line summary, newest first, 25 to a page. - **Details** on a row opens the full record: the source revision, the course versions it moved between (for example "v3 to v4"), the number of AI calls, what was recorded, and the hash of the entry with the hash of the one before it. - **Filters**: an action group (connections, source revisions, update proposals, decisions on changes, learner progress, learner notices), who acted, and a date range. They apply when you select **Apply filters**; **Clear filters** shows everything again. - The bar at the top says **Chain verified: N entries checked, none has been changed**. Each entry carries a hash of the previous one, so a changed or removed entry breaks the chain. If it does, the bar names the first broken entry and why. **Check the chain again** repeats the check; it covers the whole academy's trail, not only this course. - **Export CSV** and **Export JSON** download the trail with the filters you set (all pages, not only the one on screen), for audits and compliance reviews. Spreadsheet cells that would start a formula are neutralised. ## 15. Connect a repository or web pages Instead of a file you can follow a **Git repository** or a set of **web pages**. The course then keeps reading from the source on its own: a new commit or a changed page becomes a new revision, and the revision becomes a reviewable update (sections 8 to 10). Nothing in the course changes until you approve it. On **New course**, next to the upload area, you find **Connect a repository** and **Add web pages**. **Connect a repository** (GitHub, GitLab, Gitea and Forgejo, and any other Git server your admin has turned on): - **Where does it live?** and, for Gitea, Forgejo and a self-hosted GitLab, the **server address** (for example `https://git.example.com`). - **Repository** as `owner/name`. You can paste the address of the repository; we keep the `owner/name` part. For **Another server (read with git)**, write the full address starting with `https://`, for example `https://git.example.com/team/docs.git`; it must be reachable from the internet and must not contain a user name or password (use the token). That server cannot tell us about pushes by itself, so the course follows it on the schedule you choose. - **Branch**: leave it empty for the default branch. - **Folders and files to read**: one pattern per line, for example `docs/**/*.md`. Empty means every Markdown file. - **Access token** (optional). Public repositories work without one, but GitHub then allows only 60 requests an hour. A token with read access lifts the limit and opens private repositories. It is stored for the checks and is **never shown again**: the Sources page only says "Token set" and takes a replacement. **Add web pages**: one address per line, up to 20, all on the same site and all starting with `https://`. The optional **main content selector** is a CSS selector (for example `main` or `article`) for the part of the page to read; without it we read the main content of the page. **Connect Google Drive or Notion** (shown when your admin turned them on): choose **Google Drive file or folder** or **Notion page**, paste its address and press **Sign in and connect**. You sign in at Google or Notion with read-only access and come back to the studio, which finishes the connection; your password and the access tokens are never shown to the studio or to anyone else. Share the file, folder or page with the account you signed in with (for Notion, pick the page in the sign-in). A Google Docs file is read as text, a folder as its Google Docs, text, Word and PDF files, and a Notion page can include the pages under it (three levels, 100 pages). Images, embeds and files inside pages are not read. These sources have no webhook: they are checked on the schedule you choose. If Google or Notion stops accepting the saved sign-in, the status shows **Error** with "Connect your account again"; sign in again from the Sources page. For **Notion** you can skip the sign-in: create an internal integration in Notion, share the page with it and paste its token in **Integration token (optional)**. The field is masked, the token is sent once with the connection, stored encrypted for the checks and never shown again. This also works on an installation without a Notion OAuth client. Press the button. The form says it is checking, reads the files or pages, shows revision 1 as the source of a new course and continues into the interview as for an uploaded file. If the source is refused, you see the reason as the server gave it (for example that the repository was not found, that no file matches your paths, or that a page address points to a private network) and nothing is created: change the field and try again. ### What is checked and when On the **Sources** page a connected source shows what it reads from (host, repository and branch, or the pages), its status, when it was last checked and when it is checked next. - **Status** is **Active**, **Paused** or **Error**, always as text with an icon. After repeated failures the status shows the last error, for example a branch that no longer exists or a token that expired. - **Check for changes** sets the schedule: every hour, every day, every week, or only when you check. Hourly is the fastest schedule; the installation also caps the number of checks per source per day. - **Check now** asks for a check at once. The page says the check is queued and refreshes the card and the revision list when it finishes. A paused source has to be resumed first. - **Pause checking** stops scheduled checks, webhooks and manual checks until you press **Resume checking**. - A check that finds the same content as before adds no revision. ### Webhooks (Git) A webhook lets your Git host tell us at once when someone pushes, so the update does not wait for the next scheduled check. It is optional; the schedule keeps working without it. The connection shows the **Webhook URL** with a copy button. Create the webhook on your host: - **GitHub**: repository **Settings**, **Webhooks**, **Add webhook**. Payload URL: the webhook URL. Content type: `application/json`. Secret: the webhook secret. Events: **Just the push event**. - **GitLab**: project **Settings**, **Webhooks**. URL: the webhook URL. **Secret token**: the webhook secret. Trigger: **Push events**. - **Gitea and Forgejo**: repository **Settings**, **Webhooks**, **Add webhook**. Target URL: the webhook URL. Content type: `application/json`. Secret: the webhook secret. Trigger on **Push events**. The **webhook secret** is shown **once**: right after you connect the repository, and again each time you select **Rotate secret**. Copy it before you leave the page. Rotating makes the old secret stop working immediately, so the page asks you to confirm and reminds you to update the webhook on your host. Deliveries with a wrong signature are refused, and a burst of pushes is merged into one check (the default wait is ten minutes; an admin can change it). ### Limits - Git: up to 500 files, 1 MB per file and 20 MB in total; up to 20 path patterns. Narrow the paths if the repository is larger. - Web pages: up to 20 pages of one site, 5 MB per page. Only public `https` pages that return HTML or text can be read; a page that needs a login, a page on a private network address or a page that redirects to another site is refused. - An installation can restrict which hosts sources may use. If yours does, the refusal names the allowed hosts. - Uploaded sources have no schedule and nothing to check: a new version appears when you upload it. ## Tips - Keyboard: every card works with Tab, Space and Enter; new cards take the focus and are announced to screen readers. - The assistant only writes what your source supports. If you ask for something the source does not cover, it will say so instead of inventing it. - Each course has an AI budget (USD 5 by default), and the academy has a monthly one. When one is reached the step stops with "Budget reached" and nothing you already have is lost; ask an admin to raise it ([settings](https://ulams-dev.github.io/ulams/admin/course-builder/index.md)), then press **Retry**. The running cost is shown at the top of the workspace. - If a step fails, **Retry** repeats only that step. - Once learners use the course, the **Insights** item shows where they struggle: [See where learners struggle](https://ulams-dev.github.io/ulams/creators/course-insights/index.md). - Prefer a terminal or an agent? Every step above is also a command, see [Build courses from the command line](https://ulams-dev.github.io/ulams/developers/cli-builder/index.md); developers can use the [Course Builder API](https://ulams-dev.github.io/ulams/developers/course-builder-api/index.md). --- # See where learners struggle > Open the Insights page of any course to see progress, completion, quiz results, who needs support and the sections that confuse people, with groups under 10 learners hidden, and ask for an AI-proposed improvement of a section learners struggle with. Canonical page: https://ulams-dev.github.io/ulams/creators/course-insights/ The **Insights** page shows how learners are doing in one of your courses: where they progress, where they get stuck and whether the extra help worked. It works for **any course you author**, whether or not you built it with the Course Builder, and every figure is an aggregate. You see people by name only if an administrator gave you the permission (see [Individual learners](#individual-learners)). ## Before you start - An administrator has to switch **Learner Insights** on for the academy ([settings](https://ulams-dev.github.io/ulams/admin/learner-insights/index.md)). It is off by default and records nothing while it is off. When it is off the page says so and shows nothing. - You need to be an **author of the course**, or hold the Learner Insights permission. Anyone else gets a message that explains this. - Figures start to appear once learners have used the course. A new course shows an empty state. ## Open the page - In the studio, open the course and choose **Insights** in the left rail. From the Course Builder this is the **Insights** item of a session that has a course. - In the admin, open the course and choose the **Insights** tab. It shows a short summary (completion, who needs support and the five sections that confuse people most) and **Open full insights** takes you to this page. - The address is `/studio/courses//insights`. Use **Period** to switch between the last 7, 30 and 90 days. The page reads the same in English, Polish and Simplified Chinese: it follows your browser language, or add `?lang=pl` or `?lang=zh` to the address, or use the language links at the top. ## What you see | Section | What it tells you | |---|---| | Progress and completion | How many learners are enrolled, how many were active in the period, how many finished and the completion rate. | | Quiz performance | Finished attempts, the pass rate and the average score of all quizzes of the course together. | | Who needs support | How many learners are on track, struggling or at risk of dropping out. | | Sections that confuse people | Every section ranked by the share of its active learners who struggled, with the share who got extra help, the share who recovered afterwards and the main reasons. | | Personal help and nudges | How much extra help was shown and rated, how many reminders were sent and opened, and how many learners recovered afterwards. | | Learners who are struggling or at risk | Individual data, only for people who are allowed to see it. | Every rate is written as a number, for example "41%". The small bar next to it is only a picture of the same number, so nothing depends on colour. A rate that says **Not enough data** has too few cases behind it to be meaningful. ## The reasons A section's reasons say what kind of difficulty learners had there. They come from fixed rules, never from anything a learner typed: - **Repeated failed attempts**: several wrong answers on a quiz question. - **Takes much longer than most**: a lesson that takes learners far longer than the median. - **Left open while working elsewhere**: a lesson learners open and then drop. - **Replays or revisits**: learners go back to a video or lesson several times. - **Inactive for days** and **Several hard parts** describe a learner rather than a section. Use them to decide what to improve: a question with repeated failures may need a clearer stem, a slow lesson may be too long. ## Propose an improvement A row of **Sections that confuse people** has a **Propose an improvement** button when the section is a lesson or a quiz question that you built with the Course Builder. It asks the AI for a clearer version of that section, based on how learners did, and gives you the result as a normal proposal to review. Nothing in the course changes until you accept and apply it. 1. Choose **Propose an improvement** on the row. A panel opens under the table with **Why this was proposed** (the numbers the AI will see) and the **estimated cost**. Nothing has been sent or created yet. 2. Check the numbers, then choose **Create the proposal**. The AI reads the section, the source passages it cites and the numbers, and writes a new version. Choose **Cancel** to stop. 3. Open **Review the proposal**. It is the same review screen as for a source update, with the evidence card at the top instead of the source changes: you see the text before and after as a diff, the passages every changed block cites, and you accept or reject each change before you apply anything. Applying creates a new course version; learners keep their progress and are told about changed lessons the usual way. What the proposal is built from: - **Numbers about a group, never a person.** The share who struggled, were offered help, recovered after it and found it useful, the most common reasons and, for a quiz question, the share of learners who picked each wrong answer. Wrong answers chosen by fewer than 5 learners are grouped as "other". A section needs at least the minimum group size of active learners (10 by default) before you can propose anything for it, and this is checked on the server. - **Citations.** Every changed block cites passages of your source material, the AI may only cite passages it was given, and a check compares each new text with the passages it cites. If it cannot produce a grounded change, the item stays as it was with the note "The AI could not propose a grounded change; edit it yourself". A section that cites no source passage cannot be improved this way. - **No change of answers.** An improvement may clarify a question, its options and its explanation but never changes which answer is correct. Who can propose: the author of the course and anyone with the permission `living_course_review`. A course can have at most **3** such proposals a day (`LIVING_COURSE_INSIGHTS_PROPOSALS_PER_DAY`); asking again for a section that already has an open proposal opens that one instead. The cost counts against the course's monthly AI budget. The button is hidden when AI is switched off. ## Privacy: small groups are hidden Groups smaller than **10 learners** are hidden. This is decided by the server, not by the page: the figures are never sent, so there is nothing to find in the page source. In practice: - A course with fewer than 10 enrolled learners shows only an explanation. - A section with fewer than 10 active learners in the period shows **Hidden: fewer than 10 learners** and no figures. - A recovery rate appears once at least 10 cases are closed. An administrator can change the minimum (`LEARNER_INSIGHTS_MIN_GROUP_SIZE`). The page always states the number in use. ## Individual learners The list of learners who are struggling or at risk, with the reasons and since when, is shown only to: - people with the permission `learner_insights_view_individuals` (administrators by default), and - authors of the course, when the academy turned on `learner_insights.instructors_see_individuals` (off by default). Everyone else sees a sentence explaining why the list is hidden; the aggregates stay. **Show activity** next to a learner opens that learner's recorded activity (what they opened, answered and finished, newest first). That view is for administrators only. Use this to reach out and help, not to rank people. Learners can switch recording off in their own settings, and then nothing about them appears here. ## Good to know - Insights show what happened, not why a learner did something. A struggling learner is not a failing learner, and a status never changes grades, access or certificates. - Nothing on this page is sent to an AI provider on its own. Only when you ask for an improvement does the AI receive the numbers of that one section (see above), never a learner's name, address, answers or history. - The page is built for keyboards and screen readers: tables have captions and headers, wide tables scroll sideways and take the keyboard focus, and changes are announced. See also: [Learner Insights settings](https://ulams-dev.github.io/ulams/admin/learner-insights/index.md) for administrators, and [Reports and analytics](https://ulams-dev.github.io/ulams/admin/reports-and-analytics/index.md). --- # How a course was produced > The Production page of the studio shows how long each stage of a course took, what the model calls cost and how much of what the AI wrote you kept, from the academy's own recorded runs. Canonical page: https://ulams-dev.github.io/ulams/creators/course-production/ Open a course you built with the Course Builder and choose **Production** in the studio navigation (`/studio/courses//production`). The page answers three questions about that one course, in English, Polish or Chinese (the language links at the top). - **How long did it take?** Every stage the Course Builder ran (the outline, the lessons, the grounding check, interactive elements, quizzes, metadata, the apply step, element edits by chat and updates from sources) with its time. The totals separate **generation time** (what the machine did while you waited) from **interview time** (you answering questions) and **model time** (the summed time of the model calls, which is longer because lessons are written in parallel). A stage says how it was measured: start to finish, whole run only (builds older than 30 days), or did not finish normally. - **What did it cost?** The model calls that made and changed the course (build cost, including variants) and those that kept it up to date (maintenance cost: proposals from sources and from learner insights), with the number of calls and how many failed. Failed calls are included because they were paid for. Tutoring and personal help for learners are not part of producing a course and are not counted. - **What became of what the AI wrote?** The modules, lessons, blocks and quiz questions the AI wrote, split into those you kept as written, those the AI revised on your request, those an author edited and those from before this was recorded (shown as unknown, never guessed). Elements an author wrote from scratch are listed apart. The split is a bar with the same numbers in a table. **Author time** shows "Not recorded" unless your administrator turns review time on; it is never shown as zero. **Download CSV** and **Download JSON** save the figures of this course with the same columns as the administrator's These are your academy's own measurements. The page does not compare the course with other courses, other academies or any industry figure. The page is read by the author of the course and by administrators; another author's course answers that it belongs to someone else. --- # Course versions and variants > Variants of one course for different levels and roles, drafted together by the Course Builder from the same cited sources and reviewed as a diff against the base course. Numbered course versions with a comparison screen for any two of them. Canonical page: https://ulams-dev.github.io/ulams/creators/course-versions-and-variants/ > **What is built and what is coming:** **Built:** course variants in the Course Builder (the interview question, one outline and one generation run > per audience from the same sources, each variant reviewed as a diff against the base, each approved variant > created as its own course and grouped with the base as a family); numbered course releases and a screen that compares > any two versions, a variant included; the **routing of learners between variants**: the learner's own choice, an assignment by an > administrator or a rule, the optional placement check, hints to switch, one entitlement for the whole family, progress carried over between variants and > mandatory training that accepts any variant; the **learner screens** for variants (the picker on the course page, the hint to switch and the optional placement check, see [Choosing your version](https://ulams-dev.github.io/ulams/learners/course-versions/index.md)); a source update that reaches every variant as its own reviewable proposal (one analysis for all, shared elements take the base's patch at no cost); and certificates that name the variant. **Coming:** rebasing a variant on a newer base. Progress is tracked in the [roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md) > (Phase 3.1 and Phase 4.4); the design is in `docs/plans/course-versions-and-variants.md` and ADR 0192. Two related features answer two questions authors ask about AI-built courses: **"what exactly changed since last time?"** and **"why does everybody get the same course?"** ## What you can do today These parts already work and the planned features build on them: - **Releases** list every version of a course that learners got, newest first, with what started it, who approved it and what changed. Open **Versions** in the studio (`/studio/courses//versions`), or run `ulams course releases `. - **Compare** any two versions or releases on one screen. Open **Versions**, choose **Compare with previous** on a release, or tick any two releases and choose **Compare the two selected**. Turn on **Show all versions** to also pick proposals, rejected or replaced versions and the versions of a variant. The **Compare versions** screen (`/studio/courses//compare`) shows a summary, what learners would notice, the quiz answers that changed and the changed elements as a tree (added, removed, changed, moved and reordered, each marked by a word and a symbol), with the word-level text changes inline or side by side, the passages behind every citation that changed and the quiz impact of the element you select. **Compare the base course with a variant** opens the latest version of each. It works with the keyboard and a screen reader, in English, Polish and Chinese, and with AI switched off. The same comparison is available from the command line and for an AI agent: `ulams course compare --from --to `. - The [Course Builder](https://ulams-dev.github.io/ulams/creators/course-builder/index.md) keeps every version of a course. **Version history** lists them, **Undo**, **Redo** and **Restore** move between them, and every AI change is shown as a diff you approve or reject. - [Living Course](https://ulams-dev.github.io/ulams/creators/course-builder/index.md#10-keep-the-course-in-sync-with-its-sources) proposes cited updates when a source changes, reviewed as one diff. - Course-as-code (`ulams course diff`, `pull`, `push`) compares a course folder with the server, element by element ([worked example](https://ulams-dev.github.io/ulams/creators/git-sync-worked-example/index.md)). - The interview can ask for **extra versions of the course by level and role** (below). What is still missing: the version list and the compare screen cover courses made with the Course Builder only; courses you built by hand get them once they are adopted. ## Course versions with a visual diff > **Partly built:** The version list, the comparison of any two versions and the compare screen are built (see above). The rest of this section describes the > planned behaviour so you can comment on it before it is built. ### The problem A course changes for many reasons: you edit a lesson, the assistant rewrites a paragraph, a source update is accepted, a colleague pushes from Git. Each change is reviewed on its own, but later nobody can answer "what did learners see in March, and what is different now?" without reading both versions. ### Planned behaviour - **A version for every change that reaches learners.** When an approved change is applied (your edit, a chat edit, an accepted Living Course update, a course-as-code push or an improvement from learner insights), the course gets a new numbered version. Each version records what triggered it, which source revisions it was written from, who approved it and when. - **A version list per course** in the studio, newest first, with a one-line summary of each version ("3 lessons changed, 1 quiz answer changed, 5 citations updated"). - **Compare any two versions.** Pick two versions (not only neighbours) and the studio shows: - the course tree with modules, lessons and elements marked as added, removed, moved or changed; - word-level changes inside text, side by side or inline; - citations that were added, removed or now point to a newer revision of the source, with the passage text; - quiz changes: question, options, explanation and the correct answer, with a warning when a changed answer means learners will be asked to re-attempt (the existing progress rules decide that, past scores never change). - **The same comparison everywhere.** The studio, the `ulams` CLI and the MCP server use one diff, so an agent and an author see the same changes. - **Accessible by design.** Added and removed content is marked with text and icons as well as colour, and the comparison works with the keyboard and a screen reader. ## Course variants by level and role Every learner used to get the same course: the expert waded through the basics and the beginner got lost in the middle. Building separate courses by hand means separate sources, separate citations and separate updates that drift apart. A **variant** is a branch of one course instead of a copy: it shares the sources and the citations of the base course and becomes its own course in your academy once you approve it. ### Ask for variants in the interview The interview has a card **Who is this course for?** with chips: **One course for everyone** (the default; nothing extra is drafted and nothing extra costs), **Beginner version**, **Intermediate version** and **Expert version**. Type roles in the box, separated by commas (for example `developer, support`), to add roles. Levels only give one variant per level, roles only one per role, and both together give every level for every role. The card states what each extra version costs about before you choose, and **Decide for me** keeps one course for everyone. The course you approve first is the **base**, for the audience and level you answered in the interview. Each audience you add is an extra variant, up to **6** per course (`COURSE_BUILDER_MAX_VARIANTS`, set by the operator; `0` removes the card). More are refused with the number to remove. ### What happens next 1. **The base first.** You review the outline, approve it, review the lessons and apply the base course as usual. A variant is drafted from the approved base, so nothing is drafted before that. 2. **One outline per audience.** After the first apply the builder drafts a plan for each variant from the base course, the audience and an index of the source (not the whole source again): for every lesson it keeps, condenses, deepens or skips it, and it may add lessons the audience needs when the source supports them. You review each as the same outline comparison as for the base, against the base outline, with the reason for every change. **Request changes** with a comment drafts it again; approve it to start writing. 3. **Only what changed is written.** Kept lessons are copied with their text, quiz and citations and cost no model call. Condensed, deepened and added lessons are written again for the audience, and the final test is written again when any lesson changed. Every block still cites the source passages it rests on, passes the same grounding check and quiz support check as the base, and a lesson that fails can be retried on its own. Each model call is logged with the variant it belongs to, so cost per variant is visible, and the session budget stops all variants together. 4. **Review as a diff against the base.** Each finished variant shows how many lessons are kept, rewritten, added and skipped, and every changed text with word-level marks. Added and removed content is marked with text and icons, not only colour. 5. **Approve one by one.** Approving a variant creates it as its **own unpublished course** (its title carries the audience), through the same domain services as the base. A variant you have not approved is never created. Rejecting one creates nothing. 6. **A family in the catalogue.** The variant courses are grouped with the base course as a family and hidden from the public catalogue, so the family shows once, as the base course. Publishing the base course publishes the approved variants with it. You can also add a variant later: the studio and the API accept a level and a role for a course that is already applied, and **Retire** removes a variant from the cap (its course is kept). ### From the command line and the API ``` ulams course variants list --json ulams course variants add --level expert --role developer --start --json ulams course variants update --label "Expert, developer" ulams course variants retire --yes ``` The endpoints are in the [Course Builder API](https://ulams-dev.github.io/ulams/developers/course-builder-api/index.md) (`sessions/{session}/variants`, `variants/{variant}`). Review a variant with `GET versions/{version}/diff?against=`: it is the same element diff the builder uses everywhere. ### Learners and variants Learners are routed to a variant by their own choice, by an administrator or by a rule, never silently. The endpoints are in the [Course variants API](https://ulams-dev.github.io/ulams/developers/course-variants-api/index.md). - **The picker.** The default course and every published variant of the family, each with its label, level, role and a line on who it is for, for anyone who can see the course page. The base course is one of the choices, usually labelled "Intermediate". - **Choosing and switching.** A learner who has access to the course picks a variant and can switch later. Switching opens the other course for them, keeps the old course and its progress, and **carries completion over** for lessons that are the same in both variants. Quizzes are taken again in the new variant. - **Assigned by your organisation.** An administrator can put learners or whole user groups in a variant, and **assignment rules** do the same by attribute (for example `department` equals `Sales`). A rule only routes learners who already have access and have no variant yet; it never enrols anyone and never overrides a learner's own choice or an administrator's assignment. A learner may change an assigned variant unless an administrator **locks** the course. - **The placement check** (optional, off by default). A short set of questions made of the quiz questions the family already has, cited and tied to objectives, scored by code. It only advises: the result suggests a variant with its reason and the learner confirms it or picks another. Nothing is generated for it and nothing about the learner leaves the server. - **A hint to switch.** If the variant looks too hard (struggling in the first two modules) or too easy (every quiz passed first time in the first two modules and under half the usual time), the learner sees a dismissible hint with the reasons. At most one per week, never an automatic switch, and dismissing it stops hints for that course. It needs Learner Insights. - **One purchase, all variants.** One entitlement for any course of the family opens every variant: sell or assign the default course, and learners can use any variant. A refund or an expiry ends all of them, and the learner's progress is kept. - **Mandatory training.** An obligation on the course is fulfilled by finishing any variant, unless an administrator **pins** one; then the learner is given the pinned variant and only it counts. ### What learners see A learner of a course with variants finds **Choose your version** on the course page: every published variant with its level, role, duration and who it is for, the version they are in, and **Switch to this version**. Switching keeps the old course and its progress and carries completed lessons over when they are the same in both variants; quizzes are taken again. Where an administrator turned the placement check on, an enrolled learner can take it (advisory only: it suggests a variant and the learner chooses), and a transparent hint can suggest an easier or more advanced variant, never switching on its own. A learner whose organisation assigned a variant sees **Assigned by your organisation**, with the rule name, and cannot change it when the course is locked. The screens work with the keyboard and a screen reader, without JavaScript, in English, Polish and Chinese: see [Choosing your version](https://ulams-dev.github.io/ulams/learners/course-versions/index.md). ### Updates when a source changes When a source of a course with variants changes, Living Course (see [the Git sync example](https://ulams-dev.github.io/ulams/creators/git-sync-worked-example/index.md)) makes one update proposal for the base course and one for each variant, together. A variant gets its own proposal because it can cite passages the base does not, and because it is its own course. The element you did not change in a variant takes the base course's proposed edit without a new analysis (the item says "Same change as in the base course; no extra analysis was needed."), so it costs nothing extra. Only the elements you changed in the variant are analysed for it. On the update list and at the top of the review screen a text badge names the course a proposal is for: the variant's name, or "Base course". On the review screen, "Versions of this update" lists every proposal of the group with its status and how many items are decided and undecided; choose one to review it. Each proposal is still decided and applied on its own, and the base course is untouched when you apply a variant's proposal. Next to Accept, an item whose edit is the same in other versions has **Accept in all versions**. It accepts the item here and the identical edit (same element, same text before and after) in the other versions that have not decided it yet, and says how many: "Accepted here and in 2 other versions". Edits that differ stay for you to decide in their own version. Applying a variant's proposal does not mark the source revision as reviewed; only the base proposal does. **Certificates name the variant.** Each variant course has its own certificate template (its title already carries the variant), a template can print the variant with `@VarCourseVariant`, and the public verification record of a certificate shows it. ### What is not built yet - **Rebasing a variant on a newer base**, and improvements from learner insights for a variant (they propose for the base course). - **Chat edits on a variant.** The element chat edits the base course. ## Decisions behind it The plan's open questions were settled with the recommended defaults. A variant is its own LMS course, so progress, completion, quizzes, H5P and SCORM work exactly as in any course. The cap is 6 variants per course and the operator can change it. The base course is itself an audience learners can pick. Mandatory training will accept any variant unless an administrator pins one, and a learner may change a variant an administrator assigned unless the course locks it; both are built with the routing endpoints. The decision record is ADR 0192 and the full list is section 18 of the plan. --- # Create a course > Create a course in the admin panel and work through the course editor tabs, from attributes and media to access, certificates and statistics. Canonical page: https://ulams-dev.github.io/ulams/creators/create-a-course/ ## The course list Open **Courses → List** (`/courses/list`). The table can be filtered by title, status, category, tag, author and active state, and each row has these actions: - **Edit** opens the course editor. - **Delete** removes the course after a confirmation. - **Export** downloads the course as a ZIP file (needs the export permission). See [Import and export](https://ulams-dev.github.io/ulams/creators/import-export/index.md). - **Clone** creates a copy of the course (needs the clone permission). Above the table are **Create new** and, with the import permission, **Import file** (a course ZIP). *Screenshot: The course list with filters, the Create new button and row actions* ## Create the course 1. Click **Create new**. The form opens at `/courses/list/new` with only the **Attributes** tab. 2. Fill in at least **Title** and **Status** (both required) and save. 3. A dialog offers **Create modules**, which takes you to the **Program** tab to add lessons, or **Go to course page**, which stays on the attributes. All other tabs appear once the course exists. *Screenshot: The course editor with its tabs* ## Attributes tab | Field | What it does | |---|---| | Title (required), Subtitle | Shown in the catalogue and on the course page. | | Summary, Description | Rich text, stored as Markdown. Type `/` in the editor for blocks: upload an image, audio, video or PDF, link, checklist, bulleted and ordered lists, table, quote, code block, math (LaTeX), headings. | | Active from, Active to | Dates the course is active. **Active to** can only be set after **Active from**, and must be later. | | Duration | Free text such as "3 hours". | | Hours to complete | A number. | | Level, Language | Free-text level and the course language (from the platform's languages). | | Status (required) | Draft, Published, Archived or `published_unactivated`. See [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md#course-status). | | Target group | Free text, for example "Baristas". | | Author / Tutor | One or more users shown as the course authors. | | Is public | Only shown when an administrator enables it in the settings. A public, published course can be opened by anyone, without an account. | | Additional fields | A JSON editor for extra course fields defined by the platform. | *Screenshot: The Attributes tab of the course editor* > **Caution:** When a course is Published and its **Active from** date has passed, the editor opens locked with the > warning "This record is already in progress". Confirm the warning to unlock editing; changes then > affect learners who are in the middle of the course. ## The other tabs Each tab has its own address, `/courses/list//`. | Tab (key) | Purpose | |---|---| | Product (`product`) | Turn the course into a product with a price. Shown only with the sales permission. See [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md#prices-and-products). | | Media (`media`) | Course image, promo video and poster. Upload a large enough original: the learner screens request resized variants from the deployment's [image service](https://ulams-dev.github.io/ulams/operators/image-service/index.md) (Cloudflare Image Transformations, sharp, or the original file), never wider than the original. | | Categories & Tags (`categories`) | Pick categories from the tree and type tags. | | Program (`program`) | Lessons and topics. See [Lessons and topics](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md). | | SCORM (`scorm`) | Use one SCORM package as the whole course. See [SCORM](https://ulams-dev.github.io/ulams/creators/scorm/index.md#a-whole-course-from-one-package). | | Access (`access`) | Users and groups with access. See [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md#give-access-to-users-and-groups). | | Certificates (`certificates`) | Certificate templates for this course and the certificates issued. See [Certificates](https://ulams-dev.github.io/ulams/creators/certificates/index.md). | | Questionnaires (`questionnaires`) | Attach a questionnaire (survey) to the course. | | Statistics (`statistics`) | Progress and time per learner, completion dates, charts. | | Users Attached without Account (`user_submission`) | Invite people by e-mail before they have an account. See [Access, prices and publishing](https://ulams-dev.github.io/ulams/creators/access-and-publishing/index.md#invite-people-without-an-account). | | User projects (`user_projects`) | Files learners handed in for [project topics](https://ulams-dev.github.io/ulams/creators/project/index.md). | An administrator can hide the Statistics, Users Attached without Account and User projects tabs platform-wide in the settings. *Screenshot: The Media tab with image, video and poster uploads* *Screenshot: The Statistics tab with per-learner progress* ## Where learners see it The course page in the learner front is `/courses/` and lists the lessons and topics; topics marked as free preview open without access. See the [learner guide](https://ulams-dev.github.io/ulams/learners/index.md). --- # External tool topics (LTI) > Launch an external LTI 1.3 tool inside a lesson, pick content from the tool with deep linking, and receive the learner's score back in ulams. Canonical page: https://ulams-dev.github.io/ulams/creators/external-tool/ An **External tool** topic (`LtiLink`) opens a tool from another provider inside the lesson using LTI 1.3: a coding sandbox, a virtual lab, a publisher's exercise set. The tool knows who the learner is without a second login and can send a score back to ulams. > **Note:** Before you can add such a topic, an administrator registers the tool under **Integrations → LTI**. > See [LTI](https://ulams-dev.github.io/ulams/admin/lti/index.md). Without a registered, enabled tool the topic form shows "No external tools are > registered yet" with a link to register one. ## Add an external tool topic 1. In the program, add a topic and choose **External tool (LTI)**. 2. Choose the **External tool** from the registered, enabled tools. 3. Optionally enter a **Link inside the tool** to open a specific resource instead of the tool's default launch URL (shown as the placeholder). 4. Optionally add **Custom parameters**, one `key=value` per line. They are sent to the tool with every launch. 5. Choose how it opens: **In the page** (inside the lesson) or **New window**. 6. Set the **Maximum score** the tool's grades are measured against (default 100). 7. Save the topic. ## Pick content from the tool (deep linking) If the tool supports LTI Deep Linking, the form shows **Pick content from the tool**: 1. Choose the tool and click **Pick content from the tool**. The tool opens in a pop-up window. 2. Select one or more items in the tool and confirm. The tool adds **one topic per selected item** to the lesson ("2 items added to the lesson") and the program reloads. If you started from a new, empty topic, you can delete it afterwards. ## What learners get When the learner opens the topic, ulams signs them in to the tool (OIDC launch, single-use and short-lived). With **In the page** the tool runs in a frame in the lesson; with **New window** the learner gets a button that opens it. > **Tip:** Some tools refuse to run inside a frame or need cookies that browsers block in frames. If the tool does > not load in the page, switch the topic to **New window**. ## Scores and completion Tools that support LTI Assignment and Grade Services (AGS) send scores to ulams. Scores are stored without overwriting earlier ones. When the tool reports the activity as **Completed** or the grade as **Fully graded**, ulams completes the topic for the learner. Learners can also use **Mark as complete** in the reference front. A course export stores the tool's ID and the topic settings, not the tool registration. On another installation the tool has to be registered there, and the topic may need to be pointed at it again. See [Import and export](https://ulams-dev.github.io/ulams/creators/import-export/index.md#what-is-included). --- # GIFT syntax reference > The GIFT question syntax that ulams quizzes understand, with an example, grading rules and pitfalls for each of the eight supported question types. Canonical page: https://ulams-dev.github.io/ulams/creators/gift-syntax/ ulams stores every quiz question as one [GIFT](https://docs.moodle.org/en/GIFT_format) string. You need this page when you write questions in a spreadsheet for **Import questions** (column **Question**), or when you want to know exactly how a question is graded. The question editor in the admin panel writes valid GIFT for you. > **Note:** ulams supports a subset of Moodle's GIFT. One GIFT string is one question: there is no blank-line > separation of several questions, no `$CATEGORY:`, and no question-level weights. The points of a > question are a separate **Score** field (column **Score** in the import file). ## Building blocks | Syntax | Meaning | |---|---| | `::Title::` | Optional question title at the start. It is removed from the text learners see. | | `{ ... }` | The answer block. Its contents decide the question type. | | `=` | A correct answer (or, in matching, the start of a pair). | | `~` | A wrong answer (or, with a percentage, a weighted answer). | | `#` | Feedback for the answer it follows, or the start of a numerical answer. | | `%50%` | A percentage of the question's score for that answer. | | `->` | Separates the two sides of a matching pair. | | `// comment` | A comment line, removed before the question is shown or graded. | | `\~ \= \# \{ \} \:` | A literal `~`, `=`, `#`, `{`, `}` or `:` in question or answer text. | **Missing word.** If text follows the answer block, learners see the block replaced by a blank: `The grinder sits {=before ~after} the scale.` is shown as "The grinder sits _____ the scale." ## How the type is detected The type comes from the answer block, checked in this order; the first rule that matches wins: 1. No `{` and `}` at all → **Description**. 2. Empty block `{}` → **Essay**. 3. Block starts with `#` → **Numerical**. 4. Block contains `~%` → **Multiple choice with multiple right answers**. 5. Block contains both `~` and `=` → **Multiple choice**. 6. Block contains `=` and `->` → **Matching**. 7. Block contains `=` and no `~` → **Short answers**. 8. Block contains `T`, `F`, `TRUE` or `FALSE` → **True/False**. Anything else is rejected as an unknown type. ## Multiple choice (one right answer) ```text ::Grind size::Which grind suits a French press?{ =Coarse#Right: coarse grounds stay behind the mesh. ~Fine#Too fine: it clogs the filter and over-extracts. ~Extra fine#That is for Turkish coffee. } ``` - Exactly one answer starts with `=`; the others start with `~`. - Full score for the correct answer, 0 for any other. Feedback after `#` is returned with the answer. ## Multiple choice with multiple right answers ```text Which of these are brewing methods?{ ~%50%Pour-over ~%50%AeroPress ~%-50%Roasting ~%-50%Grinding } ``` - Every answer starts with `~%%`. Positive percentages add up to the full score (normally 100 in total); negative ones subtract. - The learner's score is the question score times the sum of the percentages of the answers they ticked, capped at the full score. The result is not floored at zero, so negative percentages can give a negative score. - An answer written with `=` counts as 100 %. ## True/False ```text Espresso is brewed under pressure.{T} ``` ```text Lighter roasts always contain less caffeine.{FALSE#It depends on how you measure: by weight or by volume.} ``` - Use `T` or `TRUE` for true, `F` or `FALSE` for false, in **capital letters**. Lowercase `{true}` is not recognised. - Feedback can follow `#`. ## Short answers ```text What is the name of the crema-forming coffee drink made under pressure?{ =espresso#Correct. =Espresso =%50%ristretto#A ristretto is a short espresso: half the points. } ``` - One or more accepted answers, each starting with `=` (no `~`). - The learner's answer must **match one accepted answer exactly**, including capital letters. List each spelling you accept. - `=%50%answer` gives that percentage of the score for that answer. - Do not use `->` in an answer; it would make the question a matching question. ## Matching ```text Match each drink with its base:{ =Latte -> Espresso and steamed milk =Americano -> Espresso and hot water =Cold brew -> Coffee steeped in cold water } ``` - Each pair starts with `=` and uses `->` between the item and its match. - Both columns are shown shuffled. - All-or-nothing: the full score only if every pair is right, otherwise 0. ## Numerical ```text How many grams of coffee for 250 ml of water at a 1\:16 ratio?{#15.6:0.5} ``` | Form | Accepted answers | |---|---| | `{#15}` | exactly 15 | | `{#15.6:0.5}` | 15.6 plus or minus 0.5 (15.1 to 16.1) | | `{#14..17}` | anything from 14 to 17 | - Full score inside the range, otherwise 0. - Only one numerical answer per question. Moodle's form with several weighted numerical answers (`{# =%100%15 =%50%14}`) is not supported. - The editor in the admin panel always writes the `value:margin` form. ## Essay ```text Describe how you would adjust your espresso if it tastes sour.{} ``` - An empty answer block. The learner writes free text. - Not graded automatically: the attempt gets 0 for it until a tutor enters a score in [Quiz Reports](https://ulams-dev.github.io/ulams/creators/quizzes/index.md#quiz-reports). ## Description ```text The next three questions are about milk texturing. ``` - No answer block. Shown as text between questions, with no answer and no score. ## Pitfalls - **Double slashes.** `//` starts a comment up to the end of the line, wherever it appears. A URL such as `https://example.com` followed by a line break loses everything after `https:`. Keep URLs at the end of a single-line question, or avoid them. - **Special characters.** Escape `~ = # { } :` with a backslash when they are part of the text, for example `Ratio 1\:16`. The admin editor does this for you. - **Formats.** Moodle's `[html]`, `[markdown]` and `[plain]` markers are not interpreted by the grader and may show up as text. Write plain text. --- # Keep a course in sync with a Git repository: a worked example > A real run of Living Course on a small runbook repository, from the commit to the reviewed proposal, the suggested lesson and the applied update, with the actual requests, counts and limits. Canonical page: https://ulams-dev.github.io/ulams/creators/git-sync-worked-example/ This page follows one example from the first commit to an applied update, using output recorded from a real run of the code, not written by hand. The example is the one used in the Living Course posts: a runbook says "escalate after 10 minutes", a commit changes it to 15, and the course has to follow. Read [Build a course with AI](https://ulams-dev.github.io/ulams/creators/course-builder/index.md) first for the screens, and [Living Course settings](https://ulams-dev.github.io/ulams/admin/living-course/index.md) for how an admin turns the Git connectors on. > **What was real and what was scripted:** **Real:** the `git` command, a real Git repository with two commits, the `git-cli` connector, the > database, the revision and fragment diff, the impact analysis, the proposal, the decisions, the apply > and the audit trail. **Scripted:** the AI. The run used the built-in fake driver, which answers from the > source text with fixed rules, so the wording of lessons, quiz options and "reasons" below is mechanical > and says nothing about real model quality. **Not exercised:** a hosted Git server over https (the > repository was a local one, read through the connector's test-only `file://` mode), the Studio screens > (no screenshots were taken), and the Google Drive and Notion APIs. See [What this does not > prove](#what-this-does-not-prove). ## The setup A repository with one file, `docs/runbook.md`, and a README that must not become course content. Version 1 has four sections (Escalation, Severity levels, Communication, Rollback). The sentence that matters: ```text If you have not found the cause within 10 minutes of acknowledging a severity 1 alert, escalate to the secondary on-call engineer. [...] ``` Commit `c2f3d0c` is "Add the on-call runbook". The run used a throwaway PostgreSQL container and the living-course test harness on a laptop; nothing touched a running stack. ## 1. Connect the repository The author connects the repository to a new course session. The request, with the access token shown as the placeholder it was in the run: ```http POST /api/admin/living-course/sessions/{session}/sources/connect ``` ```json { "connector": "git-cli", "config": { "url": "file:///tmp/runbooks-repo", "branch": "main", "paths": ["docs/**/*.md"] }, "secrets": { "token": "tok_example_not_a_real_token" }, "schedule": "daily" } ``` The answer (trimmed) is `201`: the connection is `active`, `secretsSet` lists `token` and `webhook_secret` (values are never returned again), and the source has **1 revision, 8 fragments, 328 tokens**. Only `docs/runbook.md` was read: the `paths` filter left the README out. The webhook secret is shown once in the real answer and left out here. Connecting took **186 ms** (`git clone`, listing and reading the file, building the fragments). ## 2. Build the course The course was built the usual way, with the fake driver: the interview (60 minutes, 10-minute lessons, a quiz), an approved outline, approved generation and apply. The result: | | | |---|---| | Modules, lessons | 1, 3 | | Learning objectives | 4 | | Text blocks | 6 | | Quiz questions | 5 | | Model calls (fake) | 12 | The three lessons cite fragments of the source: lesson 1.2 "When to escalate" cites `frg_ehil42efdkl7` (§1.1 of the runbook), which holds the "10 minutes" sentence. Its first quiz question has the 10-minute statement as the correct option. Building took about 2.3 seconds in total. ## 3. The commit Commit `cb70b95`, "Escalate after 15 minutes, add the post-incident review", changes two things: - "10 minutes" becomes "15 minutes" in §1.1; - a new section "After the incident / Post-incident review" is added at the end. The author presses **Check now** (`POST /api/admin/living-course/connections/{connection}/check`, `202 queued`). The connector first asks the server for the head commit (`git ls-remote`): it differs from the stored one, so it clones, reads the file and stores **revision 2** (9 fragments, 384 tokens). The whole check, including the analysis below, took **541 ms**. ## 4. What changed, without a model Change detection is deterministic. The revision's `counts` are `changed: 1, added: 1`, and the changed fragment is classified `substantive` with the signal `number` (similarity 0.864). The word diff the studio shows is this, as returned by `GET /api/admin/living-course/revisions/{revision}/changes`: ```json "wordDiff": [ ["=", "If you have not found the cause within"], ["-", " 10"], ["+", " 15"], ["=", " minutes of acknowledging a severity 1 alert, escalate to the secondary on-call engineer. [...]"] ] ``` ## 5. What the course needs: the proposal The citations are the index: five elements of lesson 1.2 cite the changed fragment. The proposal (`GET /api/admin/living-course/proposals/{proposal}`) has these counts: | | | |---|---| | Items | 6 | | Elements to review | 5 (2 blocks, 2 quiz questions, 1 objective) | | Marked "changes the meaning" | 5 | | Quiz answers to check | 2 | | Uncovered new sections | 1 | | Analysis calls | 1 update call and 1 grounding check, both fake | One analysis call covers a whole lesson (the "group"). Its results, per item: | Item | Kind | Class | |---|---|---| | Lesson 1.2, objective 1 | no change needed | none | | Lesson 1.2, block 1 and block 2 | update | major | | Lesson 1.2, Q1 and Q2 | update | answer changed | | §5.1 Post-incident review | new in the source | not covered | The first block, as the author reviews it (`before` and `after`; the ids and the citation stay): ```json "before": { "markdown": "If you have not found the cause within 10 minutes of acknowledging a severity 1 alert, ...", "citations": ["frg_ehil42efdkl7"] }, "after": { "markdown": "If you have not found the cause within 15 minutes of acknowledging a severity 1 alert, ...", "citations": ["frg_ehil42efdkl7"] } ``` The first quiz question gets the same treatment: the correct option moves from "within 10 minutes" to "within 15 minutes" and its explanation follows. Because the *correct answer* changed, the item is marked `answer_changed` and `answerCheck: true`: the author is asked to look at it, and learners' earlier scores stay on record. Every item cites `runbook.md §1.1 When to escalate`, so each claim in the proposal can be checked against the passage in the new revision. Nothing in the course had changed at this point: every item was `pending`. ## 6. A section no lesson covers The new "Post-incident review" section is not cited by any lesson, so it appears as an *uncovered* item. The author presses **Suggest a lesson**: ```http POST /api/admin/living-course/proposals/{proposal}/items/{item}/suggest-lesson ``` The answer (`200`, **42 ms**) turns the item into `new_lesson`, still `pending`. Its `after` holds the module it would go into and a full lesson with one objective and one block whose text is the section's own sentences (the fake driver copies; a real model writes). Every part cites the new fragment `frg_tzj4fbuloihy`. The lesson has no quiz yet. ## 7. Decide and apply In the run, all six items were accepted with **Accept all** (`decisions: { accepted: 6 }`) and the proposal was applied (`POST .../apply`, `202`, **353 ms**). A real author would normally open the items one by one, and could reject any of them: a rejected item changes nothing. | | Before | After | |---|---|---| | Lessons | 3 | 4 (the suggested one) | | Minutes | 60 | 65 | | Objectives | 4 | 5 | | Text blocks | 6 | 7 | | Quiz questions | 5 | 5 | The apply went through the Course Builder's domain services as a new course version (kind `update`), the source revision 2 became the live source, and the audit trail records who accepted what against which revision. Learners who had finished the course would see "New since you finished" for the new lesson and a notice for the lesson whose text changed; the run had no learners. ## The numbers | Step | Time on a laptop, local repository | |---|---| | Connect, clone and read revision 1 | 186 ms | | Interview, outline | 179 ms | | Generate and apply the course | 2.1 s | | Check, revision 2 and the whole analysis | 541 ms | | Suggest a lesson | 42 ms | | Apply the update | 353 ms | The cost meter showed **19,588 micro-dollars (about $0.02)** for the update (analysis 15,525, the suggested lesson about 4,000). That is the fake driver's token counts multiplied by the price table in the configuration: **no model was called and nothing was billed.** With a real model the figure would be real money, capped per proposal and per month by `LIVING_COURSE_PROPOSAL_COST_USD` and `LIVING_COURSE_SOURCE_MONTHLY_USD`. The analysis estimate shown before running was 35,650. ## What this does not prove - **Real model quality.** The fake driver rewrites a sentence by copying source text. The wording of the lessons, the quiz distractors ("A short guide for the engineer on call.") and the reasons are mechanical. Whether a real model proposes good updates, and how often the grounding check flags a claim, is measured by the eval command, not by this run. - **A hosted Git server.** The repository was local. The https path (address checks, pinned address, no redirects, token header) is covered by tests with a recording fake `git`, but this run did not clone from GitHub, GitLab, Gitea or a self-hosted server. - **Google Drive and Notion.** They were not part of this run. Their connectors are tested only against scripted servers; the live Google and Notion APIs and their sign-in were never called. - **The Studio screens.** No screenshots were taken. The data above is what the screens show. - **Scale and timing.** The repository is one file of 1.8 KB. The timings say the pipeline has no hidden cost for a small source; they do not predict a large one. ## Try it yourself With the stack running, connect a repository from **New course**, then commit a change and press **Check now**. For a hosted server, an admin first adds `git-cli` to `LIVING_COURSE_CONNECTORS` on an image that ships `git` ([Living Course settings](https://ulams-dev.github.io/ulams/admin/living-course/index.md)). The endpoints are listed in [Living Course internals](https://ulams-dev.github.io/ulams/developers/living-course/index.md). --- # H5P content > Create, upload, preview and export interactive H5P content in the admin library and use it in H5P topics, with completion reported by xAPI. Canonical page: https://ulams-dev.github.io/ulams/creators/h5p/ [H5P](https://h5p.org) is interactive HTML5 content: interactive videos, drag and drop, flashcards, course presentations and many more content types. In ulams, H5P content lives in a library under **Courses → H5Ps** and is placed in lessons with **H5P** topics. The same content can be used in several topics. The H5P editor and player are provided by a separate H5P service and shown inside the admin and the learner front in a frame (see [ADR 0003](https://ulams-dev.github.io/ulams/decisions/0003-h5p-as-isolated-gpl-service/index.md)); the reference front loads the player through its own `/h5p/...` proxy. For you this only means that the editor looks like the standard H5P editor. ## The H5P library **Courses → H5Ps** (`/courses/h5ps`) lists all H5P content with its title and content type (library). Each row has: - **Edit** (`/courses/h5ps/`): opens the content in the H5P editor; - **Delete**; - **Preview** (`/courses/h5ps/preview/`): plays the content as a learner would see it; - **Export**: downloads the content as an `.h5p` file. The toolbar has: - **New**: create content in the editor (`/courses/h5ps/new`); - an upload field for an existing **`.h5p`** file (exported from ulams, Lumi, Moodle or h5p.com); - **Remove unused**: deletes every H5P content that no topic uses, after a confirmation; - **Libraries** (with the permission): the H5P content types installed on the platform. Installing and updating them is an administrator task, see [H5P libraries](https://ulams-dev.github.io/ulams/admin/h5p-libraries/index.md). *Screenshot: The H5P library with upload, Remove unused and New buttons* ## Create content 1. Click **New**. 2. In the H5P editor, choose a content type (only the installed ones are offered), fill it in and save. 3. The address changes to the new content's ID; use **Preview** to try it. *Screenshot: The H5P editor inside the admin panel* ## Use content in a lesson 1. In the program, add a topic and choose **H5P**. 2. Either click **Create new** and build the content in the editor shown below, or pick existing content under **or reuse existing**. 3. Save the topic. Editing content from a topic changes it everywhere it is used. ## Completion and progress The H5P content reports what the learner does as xAPI statements. In the reference front the topic completes when the content sends a completing statement (for example, the learner finishes an interactive exercise), or with **Mark as complete**. H5P keeps the learner's state, so they can continue where they left off. The reference front loads and saves that state for the logged-in learner through its own `/h5p` route, which adds the session on the server; the H5P frame never holds the learner's API token. > **Note:** Content types without a "completed" event (for example a plain accordion) never complete the topic by > themselves; learners then use **Mark as complete**. --- # Image topics > Show a diagram, infographic or photo as a lesson topic, and give it alternative text and a caption through the topic summary. Canonical page: https://ulams-dev.github.io/ulams/creators/image/ An image topic (`Image`) shows one uploaded image. 1. In the program, add a topic and choose **Image**. 2. Click **Click to upload** and choose an image file. The server accepts the usual image formats (JPEG, PNG, GIF, BMP, WebP) and SVG. 3. The upload saves the topic and shows a preview. 4. Open **Description → Open editor** and write a **Summary** that describes the image, then save. > **Tip:** In the reference front the topic **Summary** is the image's alternative text and its caption. Without > a summary the topic title is used as the alternative text, which rarely describes the picture. Write a > summary for every image so screen-reader users get the same information. SVG files are stored so that opening their address downloads them instead of running scripts inside them; they still display normally as images. ## Completion An image topic completes when the learner reaches the end of the page, or with **Mark as complete**. --- # Import, export and clone courses > Export a course as a ZIP file, import it on another ulams installation, or clone it, and what each content type carries across. Canonical page: https://ulams-dev.github.io/ulams/creators/import-export/ All three actions are on **Courses → List** and need their own permissions, so you may not see all of them. ## Export a course 1. Find the course in **Courses → List**. 2. Click the **Export** button in its row. With the "export authored" permission you can export only courses you are an author of. 3. ulams builds a ZIP file and the browser downloads it when it is ready ("File exported successfully"). The ZIP contains a `content.json` with the course, its lessons and topics, and the files they use. Large courses with many videos take a while to build and download. ## Import a course 1. In **Courses → List**, click **Import file**. 2. Choose a course ZIP exported from ulams. 3. When "Course imported successfully" appears, the course is in the list as a new course with a new ID. The import is checked like every other package upload: a real zip of at most 1 GB by default, at most 10 000 files, no paths that escape the archive, no zip bombs, and an antivirus scan when the operator has enabled one. File paths inside `content.json` are only resolved inside the archive. > **Caution:** Check the imported course before you publish it, in particular its status, dates, access and price: > access lists, products and prices are not part of the export. ## Clone a course Click **Clone** in a course's row to create a copy on the same installation. Cloning runs in the background; refresh the list if the copy does not appear at once. ## What is included | Content | Export and import | |---|---| | Course attributes, image, video, poster, categories, tags | Included | | Lessons, nested lessons, topic settings, topic file resources | Included | | Rich text (with its embedded files), audio, video, image, PDF, OEmbed | Included, files are re-uploaded | | H5P | Included: the H5P content is packed and re-created on import | | SCORM | Included: the package is packed and re-uploaded, and the topic points to the same SCO | | Quiz | Quiz settings and questions are exported; check the questions after import | | Project | Topic settings are exported; learners' submissions are not | | LiaScript | Only the ID, title and version of the LiaScript course; the document itself is not exported yet | | External tool (LTI) | The tool's ID and the topic settings; the tool must be registered on the target | | Learner data (progress, attempts, certificates) | Not included | --- # Interactive lessons > Put your own JavaScript on a lesson, a 3D scene, a map or a small simulation, as a zip package with a manifest that plays in a sandbox, reports progress and shows a text version. Canonical page: https://ulams-dev.github.io/ulams/creators/interactive/ An **Interactive** topic plays a web app that you wrote: a 3D scene, a map with charts, a small mathematical toy. You upload it once as a **package** (a zip file) and use it in as many topics as you like. Each topic can open the package at its own **step**, play it **inline** or as the **background of the page**, and complete when the learner reaches the end of the step range. > **You answer for the code:** A package is code that runs in your learners' browsers. ulams runs it in a sandbox with no access to > the learner's account, and checks the upload, but you are responsible for what it contains and for > its licence. ## What a package is A zip file with, at its root: - `index.html`, the entry file (the manifest may name another); - the files it loads: scripts, styles, images, fonts, data, models, audio, video; - **`ulams-interactive.json`**, the manifest. ```json { "id": "gravity", "title": { "en": "Gravity: a guided solar system" }, "version": "1.4.0", "entry": "index.html", "licence": "MIT", "attribution": "© 2026 The authors", "source": { "url": "https://example.com/gravity", "ref": "v1.4.0" }, "locales": ["en"], "defaultLocale": "en", "bridge": 1, "capabilities": { "steps": true, "reducedMotion": true, "score": false, "background": true }, "requires": ["webgl"], "network": [], "steps": [ { "id": "what-is-gravity", "title": { "en": "What is gravity?" }, "text": { "en": "Two bodies, Sun and Earth, with equal and opposite force arrows." }, "poster": "posters/what-is-gravity.webp" } ], "a11y": { "keyboard": "Tab reaches all buttons; the 3D view itself is pointer-only." } } ``` ### Manifest reference | Field | Required | Rules | |---|---|---| | `id` | yes | `a-z`, digits and `-`, 2 to 40 characters. A new version of a package must keep it | | `title` | yes | Text per locale; must include `defaultLocale` | | `version` | yes | Your own version string | | `entry` | no | An `.html` file in the zip; default `index.html` | | `licence` | yes | An SPDX id: `MIT`, `Apache-2.0`, `BSD-2-Clause`, `BSD-3-Clause`, `ISC`, `GPL-3.0-only`, `GPL-3.0-or-later`, `CC-BY-4.0`, `CC-BY-SA-4.0`, `CC0-1.0` or `LicenseRef-Proprietary` | | `attribution`, `source` | no | Shown to learners under "About this interactive" | | `locales`, `defaultLocale` | yes | Language codes such as `en`, `pl` | | `bridge` | yes | `1`: the protocol version | | `capabilities` | no | `steps`, `reducedMotion`, `score`, `background`: what the package supports | | `requires` | no | `["webgl"]`: the lesson shows the poster and the text when the browser has no WebGL | | `network` | no | Exact `https://host[:port]` origins the package may call; see [Limits and the CSP](#limits-and-the-csp) | | `steps` | yes | 1 to 200 steps: `id`, `title` and `text` per locale, and an optional `poster` image in the zip | | `showcase` | no | The loop of a landing hero: `steps` (1 to 12 step ids) and an optional `poster` image in the zip; see [As the hero of a landing page](#as-the-hero-of-a-landing-page) | | `a11y` | no | Notes on keyboard use and alternatives | Every step needs a `text` in **every** locale: it is the text alternative that learners with a screen reader, reduced motion or no WebGL read instead of the scene. The upload is refused when one is missing. The JSON Schema is `api/packages/interactive/resources/schemas/ulams-interactive/v1.json`. ## Talk to the lesson page with the bridge The package learns which step to open, and tells the page which step it is on and when it is done, with the small [`@ulams/interactive-bridge`](https://ulams-dev.github.io/ulams/developers/interactive-bridge/index.md) library (MIT, no dependencies, one file under 3 KB). Copy `dist/interactive-bridge.js` into your package: ```js import { connect } from "./vendor/interactive-bridge.js"; const bridge = connect({ steps: ["what-is-gravity", "inertia"], capabilities: { steps: true, reducedMotion: true }, onInit(init) { /* init.locale, init.theme, init.reducedMotion, init.startStep, init.chrome */ }, onGoToStep(step) { /* show that step */ }, }); bridge.stepChanged("inertia"); // the learner moved to another step bridge.complete(); // the learner finished bridge.score(8, 10); // a result, for the on_score rule bridge.resize(document.documentElement.scrollHeight); ``` Without a parent page (you open `index.html` on its own) every call does nothing, so you can develop the package in a normal browser tab. > **Things a package cannot do:** It runs in an opaque origin: no cookies, no `localStorage` or IndexedDB (guard those calls with > `try/catch`), no requests to the learner site or to the API, no forms, no top-level navigation. > State that must survive goes through the bridge. ## Upload and use a package 1. Open **Courses → Interactive** (`/courses/interactive`) and click **Upload package**. 2. Choose the `.zip`. The package appears with its manifest, steps and licence. If the manifest lists `network` origins, the screen shows them and the upload is accepted only after you tick the confirmation box. 3. To change the package, open it and **Upload new version**. Versions are immutable: a new upload never changes a topic that already plays an older version. 4. In the course editor add an **Interactive** topic and pick the package. ### Topic settings | Setting | Meaning | |---|---| | **Package** and **Version** | The package, pinned to a version. New topics pin the current version. Choose **Follow latest** to play every new upload automatically | | **Start step**, **End step** | The range this topic plays. One package can back many topics, each at its own steps | | **Completion** | `on_range_end` (default): the learner reaches the end step, or the package sends `complete`. `on_complete`: only `complete`. `on_score`: a `score` of at least the **pass score** (a percentage). `on_open`: opening the topic is enough (for packages that do not use the bridge) | | **Display** | **Inline**: the text above and the frame below at the chosen **height**. **Background**: the package fills the page and the text floats over it in a card | | **Text** | Your own explanation, in Markdown | A step outside the range is recorded but never completes the topic. Saving fails when a chosen step does not exist in the played version. ## What learners get - A **text version** of every step in the topic's range, in a disclosure under the frame, and the licence, attribution and source link under "About this interactive". - In **background** mode a stepper (Previous, Next), **Explore freely** to hide the card and use the scene (a **Back to the lesson** button or Escape brings it back) and spoken step changes for screen readers. - With **reduced motion** turned on in the system, and a package that does not say it supports it, the poster of the step is shown instead of the live frame, with a button to play it anyway. - When WebGL is missing, or the package does not answer within 10 seconds, the poster and the text. ## As the hero of a landing page The landing pages of the free demo academies (`gravity`, `poland`, `ulam`) can open with the course's own interactive. The reference frontend asks the public, throttled endpoint `GET /api/interactive/showcase`, which returns the launch data of the first interactive topic of the first public course, with no sign-in and no progress recorded. The hero is not the lesson player: it is a decorative, self-running loop, with no step text and no controls. A tenant without such a topic answers 404 and the hero shows a drawn scene instead. To make a package look good there, add a `showcase` to the manifest and support `init.showcase` in the package: ```json "showcase": { "steps": ["diagonals", "primes"], "poster": "posters/showcase.webp" } ``` - `steps` is the loop, in order, one step every nine seconds. Pick the steps that look best on their own. - `poster` is the still the page paints first, and the only picture shown under reduced motion. Render it from the package with the same view the hero shows (the demo packages use `?ulams-poster&ulams-showcase#`). Without a `showcase`, the hero loops the first four steps and shows the poster of the first. - With `init.showcase` the package hides its text and controls, takes no focus and moves slowly by itself; the page moves it between the steps with `goToStep`. The hero never delays the page: the still is an image of fixed size, the frame starts only after the page has loaded and the browser is idle, it runs only while it is on screen and the tab is visible, and a package that fails or does not answer leaves the still. The picture is hidden from screen readers and has a text alternative. A small link ("Try it") goes to the lesson, and a button stops the motion. ## Limits and the CSP - The upload goes through the upload guard: at most `UPLOADS_INTERACTIVE_MAX_MB` (50 MB by default), zip entry and ratio limits, no path tricks, no symbolic links. - Only these file types are accepted: `html htm js mjs css json map txt md svg png jpg jpeg webp avif gif ico woff woff2 ttf otf mp3 ogg wav mp4 webm glb gltf bin wasm csv tsv geojson topojson xml`. `.php`, `.phar`, `.htaccess`, `.svgz` and dotfiles are always refused. - Files are served from the tenant [content origin](https://ulams-dev.github.io/ulams/operators/content-origin/index.md), and each version gets its own Content-Security-Policy from the API: scripts and styles from the package only, no `eval`, no frames, no forms, `connect-src 'self'`. - A manifest `network` list adds origins to `connect-src` **only** when the tenant setting `ulams_interactive.allow_network` is on (it is off by default) ([Settings](https://ulams-dev.github.io/ulams/admin/settings/index.md)). - The whole topic type can be switched off per tenant with `ulams_interactive.enabled`. - Progress and scores reach ulams through the learner's own session. The package never receives a token. ## Create topics from the command line ```bash ulams topics create-interactive --lesson 12 --title "Too slow" --file gravity.zip \ --start-step too-slow --end-step too-slow --display background --json ``` `--file` uploads a new package; `--package ` uses an existing one (add `--version` to pin another version, or `--follow-latest`). A manifest that lists `network` origins needs `--accept-network`, the command-line form of the confirmation box in the admin. The MCP tool `topics_create_interactive` does the same. See [CLI](https://ulams-dev.github.io/ulams/developers/cli/index.md). ## Example packages The repository ships ready-made packages in `demo-content/` (MIT for the code, CC BY 4.0 for course text), which the demo academies use. They are also the best templates for your own. | Package | What it shows | Steps | |---|---|---| | `gravity` | A Three.js solar system with a guided tour; built with Vite, so it bundles the bridge from source | 44, English and Polish; a poster per step | | `poland` | A map and charts of public statistics, plain JavaScript with no build; loads its data with `fetch`, so it holds `ready` back with `whenReady` | 40, English and Polish; a poster per step; honours reduced motion | | `ulam/spiral` | A small inline interactive: whole numbers on a square spiral with the primes marked; plain ES modules with a shared step card, keyboard navigation of a canvas, no animation | 4, English; completes when the last step is visited | | `ulam/automaton` | Elementary cellular automata, Conway's Life and the Schrandt-Ulam growth rule (OEIS A170896) from one cell; a canvas editable with the arrow keys; Play is replaced by Step and Run to the end under reduced motion | 5, English; completes when three different steps were visited | | `ulam/lwow-map` | A journey on a map: the shared map engine (Mercator, great-circle legs) drawn into an element, a schematic inset, every stop also a button in a list; completes at the end of the topic's range | 7, English; the notes of each stop cite the fact sheet | | `ulam/scottish-book` | Notebook-style cards from `data/problems.json` (shown as text, never as markup), a filter, a guess per card that sends `score`; the topic completes with `on_score` and a pass percentage | 10, English; nine sourced problem cards, a guess on four of them | | `ulam/monte-carlo` | Throw seeded random points to estimate π; a log-log chart with a data table; completes from what the learner does (10,000 throws), not from the step | 4, English | Build one and use it in a lesson (the posters are rendered with Chromium, so it needs `npx playwright install chromium` once): ```bash yarn workspace @ulams/demo-gravity package ulams topics create-interactive --lesson 12 --title "Too slow" \ --file demo-content/gravity/release/gravity-ulams-1.0.0.zip \ --start-step too-slow --end-step too-slow --display background --json # a package with no build step is zipped as it is node demo-content/scripts/pack.mjs demo-content/poland ulams topics create-interactive --lesson 12 --title "Gas" --file demo-content/poland/release/poland-ulams.zip \ --start-step gas --end-step gas --display background --json ``` What the gravity package teaches about writing your own: guard every storage call, load fonts and textures from the package (the CSP allows nothing else), keep the step ids stable, send `stepChanged` for every step and never `complete` when the topic plays only a range, and declare `reducedMotion: false` honestly so learners who ask for less motion get the poster. ## Licences Choose the SPDX id that matches your code. The licence travels with the package, is shown to learners and is kept in course exports. Platform code is MIT; the bridge is MIT, so packages under any licence may include it. --- # Layouts > Build a lesson from learning components, such as timelines, flip cards, steps and practice activities, by writing a JSON document that is checked against the approved component set. Canonical page: https://ulams-dev.github.io/ulams/creators/layout/ A **Layout** topic is a lesson body built from learning components instead of prose: a timeline of events, flip cards for recall, a numbered process, a callout, a code listing, a comparison table or a practice activity. You describe the layout as a JSON list. Learners see the components in the lesson page; any other client sees a Markdown version you write next to it. > **Hand-written for now:** The AI course builder will compose layouts for you later. Until then you write the JSON yourself, with > the editor checking it as you type, or generate it with a script and create the topic from the > command line. ## The components A layout may use only these nine components. Each one has a closed set of properties, listed in the [component catalogue](https://ulams-dev.github.io/ulams/catalogue/index.md). | Component | Use it for | |---|---| | `Timeline` | events or stages in order, optionally marked done, current or upcoming | | `FlipCards` | a term or question on the front and the answer behind a button | | `Steps` | a process in two to five numbered steps | | `Callout` | a tip, a warning or a key idea | | `CodeBlock` | a code listing with a copy button (it does not run the code) | | `ComparisonTable` | products in columns and features in rows, every cell with a source | | `PracticeActivity` | scaffolded practice: a toolbox, challenges of rising level, tiered hints and a worked solution | | `H5PFrame`, `LiaScriptLesson` | existing H5P or LiaScript content inside the layout | Practice must use `PracticeActivity`: it requires an intro, a toolbox and at least one challenge, shows the hints one at a time and keeps the worked solution hidden until the learner has made an attempt. ## The document ```json [ { "component": "Timeline", "props": { "title": "How coffee reached Europe", "items": [ { "label": "c. 1450", "title": "Sufi monasteries in Yemen roast and brew coffee", "status": "done" }, { "label": "1650", "title": "Oxford opens the first English coffeehouse", "status": "current" } ] } }, { "component": "FlipCards", "id": "recall", "props": { "title": "Recall", "cards": [{ "front": "Why grind finer?", "back": "A finer grind exposes more surface, so more dissolves." }] } }, { "component": "PracticeActivity", "props": { "intro": "Dial in a pour-over.", "toolbox": [{ "label": "Brew ratio chart" }], "challenges": [ { "id": "c1", "level": 1, "prompt": "The cup tastes sour and thin. Which single change should you try first?", "hints": [{ "tier": "nudge", "text": "What does sourness tell you about how much dissolved?" }], "options": [ { "label": "Grind finer", "correct": true, "feedback": "More surface, more extraction." }, { "label": "Use cooler water", "correct": false, "feedback": "Cooler water dissolves less." } ], "workedSolution": "Sour and thin points to under-extraction. Grind one step finer and brew again." } ] } } ] ``` - The document is a **list of nodes**, one to 80. A node has a `component`, its `props` and, optionally, an `id` (letters, digits, dashes and underscores, up to 40) for links within the page. - Nodes cannot contain other nodes. - Links (`src`, `href`) must be relative, `#anchors`, `https://`, `mailto:` or `tel:`. `javascript:` and `data:` links are rejected. - Give each `PracticeActivity` and `FlipCards` its own `id` when a layout holds more than one, so the page has no duplicate ids. ## Create a layout topic 1. Open the course editor, hover the lesson and click **+**, then choose **Layout**. 2. Paste or write the JSON. Below the editor you see either "The document is valid" or the list of problems, each with the node and the property it concerns (`/2/props/items`). **Add a component** appends a starting point, and **Start from an example** fills an empty editor. 3. Write the **Markdown fallback**. It is required. It is shown to clients that do not render layouts and when the document cannot be rendered. Leave hints and worked solutions out of it: text cannot hold them back. 4. Click **Save**. The API validates the document again and answers with the same list of problems if something is wrong. 5. Use **Preview in the learner site** (after the first save) to see the lesson as a learner does, without recording any progress. From the command line: ```bash ulams topics create-layout --lesson 12 --title "Coffee through time" \ --document @layout.json --fallback @layout.md --json ``` `--document` takes a JSON or YAML list, inline or as `@path`. See [the CLI](https://ulams-dev.github.io/ulams/developers/cli/index.md); the same command is the MCP tool `topics_create_layout`. ## What learners get - The components render in order inside the lesson. Flip cards, code listings and practice activities use a small script each; the others need none. Every component is keyboard and screen reader friendly. - The topic completes when the learner has scrolled to the end and spent a few seconds on the page. If the layout holds a **practice activity**, the first checked answer (or "I have tried it" on an open task) completes it instead, and "Mark as complete" always works. - If a stored document no longer fits the catalogue, for example after a component changed, the lesson shows the Markdown fallback instead of a broken page. ## Export, import and cloning A layout is plain JSON, so it travels with the course export and import and with a topic clone. The --- # Lessons and topics > Build a course program in the admin panel with nested lessons and topics, reorder them by drag and drop, and set the fields every topic shares. Canonical page: https://ulams-dev.github.io/ulams/creators/lessons-and-topics/ A course is a tree: **lessons** contain topics and, optionally, other lessons. A **topic** is one learning item with exactly one type (text, video, quiz and so on). Build the tree in the course editor's **Program** tab (`/courses/list//program`). *Screenshot: The Program tab: the lesson tree on the left, the topic editor in the middle and topic settings on the right* ## Add a lesson 1. Open the **Program** tab and click **Add new lesson**. 2. Fill in **Title** (required), **Summary**, **Duration** and **Active?**. Optionally set **Active from** and **Active to** to limit when the lesson is available, and a **Parent lesson** to nest it. 3. Click **Create**. To add a lesson inside another lesson, hover the parent lesson, click the **+** button (**Add new topic**) and choose the lesson icon at the top of the list. ## Add a topic 1. Hover the lesson and click **+** (**Add new topic**). 2. Pick a type: Rich text, OEmbed, Audio, Video, H5P, Image, PDF, SCORM, LiaScript, Interactive, Layout, External tool (LTI), Project or Quiz. 3. Fill in the type-specific content in the middle column and the common fields in the right column. 4. Click **Save**. Only the types that are installed and not switched off appear in the list. An administrator can switch off any type platform-wide in the settings (`disableTopicType-`). Two content formats have no entry in this menu: [cmi5](https://ulams-dev.github.io/ulams/creators/cmi5/index.md) (no admin form yet) and [Adapt](https://ulams-dev.github.io/ulams/creators/adapt/index.md) (uploaded as a SCORM package). For file types (audio, video, image, PDF) the upload itself saves the topic. Quiz and project topics can be saved without content; questions are added after the first save. ### Fields every topic has | Field | Effect | |---|---| | Title (required) | Shown in the program and in the player. | | Duration | Free text, for example "5 min"; the reference front converts it to minutes for the course outline. | | Parent lesson | Moves the topic to another lesson. | | Description → **Open editor** | Three Markdown fields: **Introduction**, **Description** and **Summary**. The reference front shows the description below the topic content. | | Active? | Inactive topics are not part of the course. A course is finished when every **active** topic is complete. | | Able to preview | A free preview: the topic opens on the course page for people without access to the course. | | Can be omitted (`can_skip`) | In the legacy learner app, lets the learner move to the next topic without completing types that otherwise block the **Next** button; moving on marks the topic complete. The reference front does not use it. New topics start with it switched on. | | JSON Metadata | Extra data for rendering. Video processing writes its status here, and the reference front reads video chapters from it (see [Video](https://ulams-dev.github.io/ulams/creators/video/index.md#chapters)). Leave it alone unless a guide tells you otherwise. | Below the common fields of a saved topic is **File resources**: files attached to the topic that learners can download. The bottom bar has **Cancel**, **Clone** (copies a saved topic), **Save** and **Delete**. > **Caution:** Delete acts immediately. There is no undo for deleted topics or lessons. ## Reorder and nest Drag lessons and topics in the tree to change their order or move them to another lesson. The new order is saved straight away. A lesson that has not been created yet cannot be moved. Administrators can limit nesting with two settings: the maximum depth of nested lessons (`maxLessonsNestingInProgram`) and the minimum depth at which topics may sit (`minTopicNestingInProgram`). A move that breaks these limits is refused with a message. ## Completion The platform records a status per topic and learner. When every active topic of the course is complete, the course is marked finished: this is what issues a [certificate](https://ulams-dev.github.io/ulams/creators/certificates/index.md) and the "course finished" notifications. In the reference front a learner with access can always press **Mark as complete**. In addition: - text-like topics (rich text, image, PDF, embeds) complete when the reader scrolls to the end of the content, after a few seconds on the page; - a video completes when it plays to the end, an H5P topic when the content reports completion, and a quiz when the learner passes it; - a layout completes when the reader scrolls to the end, or with the first checked answer of its practice activity ([Layouts](https://ulams-dev.github.io/ulams/creators/layout/index.md)); - SCORM, LiaScript, Interactive and external-tool topics are completed by the platform when the content or the tool reports completion (details on their pages). Each topic type page lists the specifics. ## Preview your course There is no separate preview mode in the admin panel. To check what learners see, open the course in the learner front (`/courses/`, then `/learn//`) with an account that has access to the course. See the [learner guide](https://ulams-dev.github.io/ulams/learners/index.md). --- # LiaScript courses > Write interactive courses in LiaScript Markdown in the admin editor, keep every change as a version with diff and restore, and play them in lessons. Canonical page: https://ulams-dev.github.io/ulams/creators/liascript/ [LiaScript](https://liascript.github.io) is a Markdown dialect for interactive courses: quizzes, surveys, animations, code you can run, text-to-speech, all written as text. In ulams a LiaScript course is a versioned Markdown document (plus its images and other assets) that you play in a lesson with a **LiaScript** topic. ## The LiaScript library **Courses → LiaScript** (`/courses/liascript`) lists LiaScript courses with their title and current version, with **Edit** and **Delete** per row. Deleting removes the course with all its versions and assets. *Screenshot: The LiaScript list with the New LiaScript course button* ### Create a LiaScript course 1. Click **New LiaScript course**. 2. Enter a **Title**, or leave it empty to take it from the first heading of the Markdown. 3. Either click **Create** to start with an empty document, or **Upload .md or .zip**: - a `.md` file becomes the first version; - a `.zip` must have `README.md` at its root; the other files in it (images, audio) become the version's assets and keep working with relative links such as `![](img/grinder.png)`. 4. The editor opens. Uploads are limited to 128 MB by default and go through the same checks as SCORM packages (no paths that escape the folder, no symbolic links, no zip bombs). ## Edit and version The editor (`/courses/liascript/`) has the **Markdown source** on the left and **Versions** on the right. - **Save as new version** stores the text as a new version; add an optional note in **What changed**. Nothing is overwritten: every save, upload and restore adds a version. - **Show** on a version compares it with the current text, line by line (removed lines in red, added in green). - **Restore** makes an old version current by copying it into a new version ("Restored from v3"). - A text-only save keeps the assets of the previous version. The editor warns when the Markdown uses remote `import:` macros. They would load code from another site and are blocked by the player's security policy, so copy what you need into the document instead. *Screenshot: The LiaScript editor with the Markdown source and the version list* > **Note:** There is no live preview of unsaved text yet. To check a version, save it and open a LiaScript topic > that uses the course in the learner front. ## Use it in a lesson 1. In the program, add a topic and choose **LiaScript**. 2. Pick the course in **LiaScript course**; the list shows each course with its current version. Use **Edit the course** to jump to the editor, or **New LiaScript course** to create one. 3. Save the topic. The topic always plays the **current** version, so a new saved version reaches learners immediately. ## Playback and completion The learner front asks ulams to launch the topic; ulams publishes the player and the current version on the tenant's content origin and opens it in the lesson. The player reports slide position and status back to ulams. The topic completes when the learner reaches the **last section** of the course (each heading outside code blocks is a section) or when LiaScript reports the course as completed or passed. > **Caution:** Playback needs the LiaScript player build on the server and a content origin. Without them the > learner sees an explanation instead of the course; ask your operator. Course export does not include the LiaScript document itself yet; see [Import and export](https://ulams-dev.github.io/ulams/creators/import-export/index.md#what-is-included). --- # PDF topics > Add slides, handouts or a reading as a PDF topic that learners read in the lesson player and that you preview page by page in the admin. Canonical page: https://ulams-dev.github.io/ulams/creators/pdf/ A PDF topic (`PDF`) shows one uploaded PDF document inside the lesson. 1. In the program, add a topic and choose **PDF**. 2. Click **Click to upload** and choose a `.pdf` file (only PDF is accepted). 3. The upload saves the topic and shows a preview with page navigation, so you can check the file. 4. Set the title and the [common fields](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md#fields-every-topic-has) and save. To offer a file for download next to other content instead, attach it to any topic under **File resources** (see [Lessons and topics](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md#fields-every-topic-has)). ## Completion A PDF topic completes when the learner reaches the end of the page, or with **Mark as complete**. --- # Pricing a course built with AI > Choose free or paid in the Course Builder interview, confirm the price before publishing, and what happens in the cart when you apply and publish. Canonical page: https://ulams-dev.github.io/ulams/creators/pricing/ The Course Builder asks one fixed question about price: **free or paid**. It never sells anything on its own: a product is created only for a paid course with a price you confirmed, and it stays hidden until you publish. ## Choose free or paid - **Free** (the default): learners enrol without paying. No product is created. - **Paid**: type the price in the currency of your shop (set in the payments settings). If you leave it empty, the assistant suggests a starting price once your course is drafted, with a short reason. A suggestion is only a suggestion: it is marked **suggested** and it is not used until you press **Use this price** or type your own in the **Course brief** panel. You can change the price at any time with **Edit** on the **Price** row of the brief. Changing the price does not make the outline or the lessons out of date. ## What happens when you apply and publish 1. **Apply to my academy** creates the course unpublished. For a paid course with a confirmed price it also creates a **product** for the course in **Sales → Products**, not yet purchasable. 2. If the shop cannot sell the price (for example a currency other than the shop's), the course is still applied and the apply notes tell you the product was not created. 3. **Publish course** publishes the course and makes its product purchasable. Learners who buy it get access after the payment is confirmed, as for any product. > **Note:** Switching a course back to free and applying again hides the product. Existing buyers keep their access. ## For developers The builder talks to commerce through the `CommerceProvider` interface of the `commerce` package; the built-in cart is the default adapter and a Sylius adapter is planned. See the [commerce package](https://ulams-dev.github.io/ulams/developers/api-packages/index.md#commerce). --- # Project topics > Let learners hand in files with a project topic, notify tutors about new submissions, and review, download or delete the files in the course editor. Canonical page: https://ulams-dev.github.io/ulams/creators/project/ A **Project** topic is an assignment: learners upload a file with their solution, and tutors review the submissions. ## Add a project topic 1. In the program, add a topic and choose **Project**. 2. Describe the task in the topic's **Description** (Open editor): what to do, what to hand in, in which format. 3. In **Users to notify**, pick the people who should get a notification when someone uploads a solution, usually the course tutors. 4. Save the topic. > **Note:** The notification is sent by e-mail through the "project solution created" template. An administrator > has to set up that template; see [Notifications](https://ulams-dev.github.io/ulams/admin/notifications/index.md) and [Templates](https://ulams-dev.github.io/ulams/admin/templates/index.md). ## Review submissions Open the course editor's **User projects** tab (`/courses/list//user_projects`). The table lists every uploaded file with the topic, the learner and the upload date, with **Download** and **Delete**. *Screenshot: The User projects tab listing uploaded solutions* Learners can upload a file of any type, and can see and delete their own submissions. The upload form exists in the legacy learner app; the reference front does not offer the upload yet. The API also stores a grade and written feedback per submission (`/api/admin/topic-project-solutions`), but the admin panel does not show these fields yet. ## Completion A project topic is not completed automatically when a file is uploaded. In the reference front the learner presses **Mark as complete**. --- # Quizzes > Build quiz topics with eight GIFT question types, set attempts, time limit and pass score, import and export questions, and grade answers in quiz reports. Canonical page: https://ulams-dev.github.io/ulams/creators/quizzes/ A **Quiz** topic (`GiftQuiz`) is a test with its own attempts, time limit and pass score. Each question is stored in the [GIFT format](https://ulams-dev.github.io/ulams/creators/gift-syntax/index.md) from Moodle, but you do not have to write GIFT: the question editor builds it from a form. ## Create a quiz 1. In the program, add a topic and choose **Quiz**. 2. Set the quiz options: - **Max attempts**: how many attempts a learner gets. Empty means unlimited. - **Max execution time**: the time limit of one attempt, in minutes. The server enforces the deadline itself (answers after it are rejected), on every queue driver, including `sync`. - **Min pass score**: the score needed to pass, in percent (0 to 100). 3. **Save the topic.** Questions can only be added after the first save; until then the form says "Create this Topic before adding questions". 4. Click **Add new question**, choose the type, fill in the form and the **Score** (points for the question), and submit. Repeat for each question. *Screenshot: A quiz topic with its options and the question table* ### Question types | Type in the editor | What the learner does | Graded | |---|---|---| | Multiple choice | Picks one answer | Automatically: full score for the right answer, otherwise 0 | | Multiple choice with multiple right answers | Picks several answers | Automatically: each answer carries a percentage of the score | | True & False | Picks true or false | Automatically | | Short answers | Types a word or phrase | Automatically, exact match with one of the accepted answers (case-sensitive) | | Matching | Matches items of two lists | Automatically, all pairs right or 0 | | Numerical question | Types a number | Automatically, with an error margin | | Essay | Writes a free answer | **Manually** by a tutor in Quiz Reports | | Description | Nothing: text shown between questions | Not graded, no score | Answers can carry feedback that is shown to the learner. The exact rules, including partial credit, are in the [GIFT syntax reference](https://ulams-dev.github.io/ulams/creators/gift-syntax/index.md). ### Manage questions The question table shows each question's type and text: - drag the handle in the **Sort** column to change the order; - **Edit** opens the question in the form; - **Delete** removes it at once. ### Import and export questions - **Export** opens a list of the quiz's questions; select the ones you want and confirm to download them as an `.xlsx` file with the columns **Question** (GIFT text), **Type** and **Score**. - **Import questions** uploads such an `.xlsx` file into this quiz. Every row needs a **Question** in GIFT format and a whole-number **Score** of 0 or more; the type is detected from the GIFT text. A file exported from one quiz can be imported into another, which is the quickest way to copy questions. > **Caution:** The import runs as one transaction: if any row is missing a field or has GIFT text whose type cannot be > recognised, the import fails and no question from the file is added. Check imported questions in the > table before learners start the quiz. ### Randomising the order Quizzes have a **randomize order** option: when it is on, both the questions and the answer options are shuffled per attempt (the same attempt keeps its order after a refresh). The admin form does not show this switch yet; it can be set through the API (`randomize_order` on `/api/admin/gift-quizes/{id}`). Matching questions always shuffle their two columns. ## What happens during an attempt - Starting the quiz opens an attempt; an unfinished attempt is resumed instead of starting a new one. - When **Max attempts** is used up, no new attempt can be started. - An attempt closes automatically when its time is up. Without **Max execution time** it closes after the platform default, the **max_quiz_time** setting (`ulams_gift_quiz.max_quiz_time`, in minutes, editable by admins in the settings; 120 when nobody set it). - Results are shown when the attempt ends. In the reference front, passing the quiz completes the topic. ## Quiz reports **Courses → Quiz Reports** (`/courses/quiz-reports`) lists every attempt. Filter by date range, course and student. Each row shows the quiz, the student, the result and maximum score, the start and end time (or "uncompleted"). *Screenshot: Quiz Reports with filters and the list of attempts* Open **Details** (`/courses/quiz-reports/`) to see every question with the learner's answer. To grade an essay, or to correct any automatic score, open the question, click the edit button and enter the learner's score. The attempt's total is updated with it. *Screenshot: Quiz report details with the questions and answers of one attempt* --- # Rich text topics > Write lesson text in the Markdown editor of a rich text topic, with headings, lists, tables, code, math and embedded media. Canonical page: https://ulams-dev.github.io/ulams/creators/rich-text/ A rich text topic (`RichText`) holds one Markdown document. Use it for reading material, explanations and instructions. ## Write the text 1. In the program, add a topic and choose **RichText**. 2. Write in the editor. It is a WYSIWYG editor that stores plain Markdown, and Markdown shortcuts work as you type (`#` for a heading, `-` for a list, `>` for a quote). 3. Type `/` on an empty line for the block menu: - **Upload image, audio, video, PDF**: uploads the file to the course's folder and inserts it. - **Link note**: a link (shortcut `[[`). - Checkbox list, bulleted list, ordered list, table, quote, code block. - **Math**: a LaTeX formula. - Big, medium and small headings. 4. Save the topic. The same editor is used for course summaries and descriptions and for a topic's introduction, description and summary. *Screenshot: A rich text topic open in the program editor* ## What learners see The reference front renders the Markdown as formatted text. If the text starts with a heading equal to the topic title, that heading is dropped so the title is not shown twice. ## Completion In the reference front, a rich text topic completes when the learner scrolls to the end of the text (after a few seconds on the page), or with **Mark as complete**. See the [learner guide](https://ulams-dev.github.io/ulams/learners/index.md). --- # SCORM packages > Upload SCORM 1.2 and 2004 packages to the SCORM library, preview them, and use them as lesson topics or as a whole course. Canonical page: https://ulams-dev.github.io/ulams/creators/scorm/ SCORM packages made in authoring tools (Articulate, iSpring, Adapt, Captivate and others) are uploaded once to the **SCORM library** and then used in courses. ulams accepts **SCORM 1.2** and **SCORM 2004** packages. Each package contains one or more SCOs (sharable content objects); a topic plays one SCO. ## Upload a package 1. Open **Courses → SCORMs** (`/courses/scorms`). 2. In **New Scorm**, choose the package `.zip` file (the zip that contains `imsmanifest.xml`). 3. When the upload succeeds, the package appears in the table with its SCORM version, and its SCOs as buttons. Uploaded packages are checked before anything is extracted: - the file must be a real zip, at most 512 MB by default (operators can change the limit); - at most 5000 files, no paths that escape the package folder, no symbolic links, no suspicious compression (zip bombs); - an antivirus scan when the operator has enabled one. A rejected upload shows the reason, for example `zip_slip`, `too_large` or `infected`. The **Authoring tool** column shows **Adapt** for packages exported from Adapt Learning (see [Adapt](https://ulams-dev.github.io/ulams/creators/adapt/index.md)). *Screenshot: The SCORM library with the upload field, versions and SCO buttons* ## Preview Click a SCO button in the table to play it at `/courses/scorms/preview/`. Use this to check a package before you put it in a course. *Screenshot: A SCORM package playing in the admin preview* ## Use a SCO as a topic 1. In the program, add a topic and choose **SCORM**. 2. Pick the SCO from the list. SCOs are grouped by package (`: `) and the list can be searched. 3. Save the topic. You can mix SCORM topics with any other topic types in the same lesson. The package must already be in the library; uploading from the topic form is not available. ## A whole course from one package The course editor's **SCORM** tab (`/courses/list//scorm`) lets you pick one SCO for the course itself, for courses that are just one SCORM presentation. Use **Clear selection** to remove it. ## Playback and completion The player runs the package with a SCORM runtime and saves the learner's progress (bookmark, score, status). When the operator has configured a content origin, packages play from a separate, per-tenant address with a strict security policy, so their scripts cannot reach the learner's session. When the package reports completion, ulams completes the topics that use that SCO. Learners can also press **Mark as complete** in the reference front. > **Caution:** Check where a package is used before you delete it from the library: topics and courses that point to > its SCOs can no longer play it. --- # Style profiles > Upload your organisation's style guide and the Course Builder reads it into a cited style profile (theme, voice, terminology, banned phrases, reading level, components, image rules) that an admin approves as a diff. Canonical page: https://ulams-dev.github.io/ulams/creators/style-profiles/ > **What is built:** Reading a style guide into a style profile with every value citing its passage; the **Style** screen of the studio > (`/studio/style`) to review, edit, approve, check a course against and restyle a course for a profile, in English, Polish > and Chinese; handing the theme part to the admin theme screen as a diff; the approved profile in the prompt of every course > the builder drafts, chosen per Course Brief; the style check in the publish summary, where a banned phrase blocks publishing > only when the profile says so; restyle proposals through Living Course; the eval command; the API and `ulams style-profiles`. > **Not built yet:** a profile per entry point (it arrives with entry points), and a profile picker inside the brief panel > (set it with the API or `ulams builder brief set`). Progress is tracked in the [roadmap](https://ulams-dev.github.io/ulams/roadmap/index.md); the design is in > `docs/plans/style-guide-course-design.md` and ADR 0196. A style guide is a document. A **style profile** is what the builder can use from it: typed values that an admin approved, each one pointing at the passage of the guide it came from. The raw guide never reaches the model that writes your lessons. ## How a profile is made 1. **Upload a style guide** (Markdown, PDF or DOCX). The file is read like any other source, as untrusted input. 2. **One model call proposes the values.** The call is logged like every other (model, tokens, cost). Values that do not fit the schema, name something unknown, carry a link or markup, or cite no passage of the guide are dropped, and the response lists what was dropped in `warnings`. A style guide that says "ignore your instructions" can at most produce a value that is dropped. 3. **Review the proposal.** `GET` on a profile shows the values, the passages they cite (so a reviewer who did not upload the guide can read them) and the diff against the approved profile. 4. **Edit if needed.** Values you add by hand have no citation and are marked as yours. 5. **An admin approves it.** Approving replaces the approved profile of its scope; the old one stays as superseded. Nothing changes in an existing course or theme when a profile is approved. Without AI on the installation, or when the model cannot read the guide, the profile starts empty with a warning and you fill it in by hand. ## What a profile holds | Part | Content | |---|---| | `theme` | theme preset, accent and secondary colour (six digit hex, with a warning when the accent is too weak on the preset), font family names (system or self-hosted fonts only; web-font URLs are ignored), logo file id | | `voice` | person (`you`, `we`, `neutral`), formality 1 to 5, longest sentence in words | | `readingLevel` | a CEFR level (A1 to C2) or `grade-1` to `grade-16` per language | | `terminology` | the term to use and the terms to avoid, product names with exact casing | | `banned` | phrases never to use, and `blocking`: whether a banned phrase blocks publishing (your decision, never the model's) | | `components` | preferred and disallowed layout components, which must exist in the page catalogue | | `imagery` | alt text required, decorative images allowed, no text in images | | `examples` | up to three short approved example paragraphs | The JSON Schema is `api/packages/course-builder/resources/schemas/style-profile/v1.json`. ## In the studio Open **Style** in the studio rail (`/studio/style`). 1. **Upload a style guide** (Markdown, PDF or DOCX) and, if you like, name the profile. The proposal opens below the list. 2. **Read what was dropped.** The *Dropped from the proposal* list says which values did not fit and why. 3. **Check the changes.** *Changes against the approved profile* marks every value *Added*, *Changed* or *Removed* with a word and a symbol, never by colour alone. Each value has a button for the passage of the guide it cites; it opens the text inline, so a reviewer who did not upload the guide can read it. 4. **Edit a suggestion.** Remove a value with its **×** button, set the person, the formality (1 to 5) and the longest sentence, switch on *A banned phrase blocks publishing*, or edit all values as JSON. Invalid values are dropped when you save and listed again. 5. **Approve it** (admins). An approved profile is read-only; **Create a revision** copies it into a new suggestion to change a rule. 6. **Theme.** If the profile has a preset or an accent, *Review the theme in settings* opens the admin theme screen with the profile in the link. The screen shows the preset and accent as the same diff it shows for an imported brand, with the contrast report, and changes the academy's theme only when an admin approves that diff. The page works with the keyboard and a screen reader, at 320 px wide and with AI switched off. ## How a course uses the profile When the builder drafts anything for a course (outline, lessons, quizzes, metadata, chat edits, variants) it adds the approved profile to the cached block with the Course Brief, as typed data: - the voice, reading level, terminology, banned phrases, component preferences, image rules and examples; - **not** the citations (they point into the style guide, not into your course's sources), **not** the theme (colours and fonts shape the site, not the sentences), **not** the blocking switch, and **never** the text of the style guide. The profile is advisory: the instruction that comes with it says it never overrides the output schema, the citation rules or the facts of the source. Which profile is used: 1. the profile the Course Brief names (`styleProfileId`, Course Brief v4), if it is still approved; 2. otherwise the academy's approved profile; 3. otherwise none, and prompts are exactly what they were before. The brief panel shows a **Style** row with the profile that will be used (*Academy default: Northwind* when the brief names none). Name a profile with `PUT .../sessions/{session}/brief` (`{"styleProfileId": ""}`, `null` for the academy default) or `ulams builder brief set --style-profile-id ` (`none` clears it). Only an approved profile is accepted. Changing the profile after the outline marks the outline and lessons stale, like any other brief change that shapes the writing; nothing is regenerated silently. To keep more than one profile in use (for example an expert track beside the academy default), propose it with `--scope brief` (`scopeType: brief`, named by `scopeId`). Approving a brief profile replaces only the approved profile of the same name, never the academy default. ## The style check The check is deterministic: no model is called, nothing is rewritten, and it cannot grade anyone or decide who gets access. It reports; you decide. It runs on the course that is about to be published (and on each approved variant), against the profile the brief names, else the academy's, and its findings appear in the **publish summary** next to the other checks. Every finding names the style guide passage it comes from. | Rule | Looks at | Result | |---|---|---| | Banned phrases | lessons, quiz questions, final test, the course's title and description | **blocks publishing** when the profile's *A banned phrase blocks publishing* switch is on, otherwise a warning | | Terminology | the same text: a term to avoid, or a product name in the wrong casing | warning | | Components | the landing page: a component the profile does not allow | warning | | Images | Markdown images without alternative text, when the profile requires it | warning | | Reading level | each lesson, per language: English by the Flesch-Kincaid grade, Polish by the Pisarek index, Chinese by sentence length in characters | hint | | Sentence length | each lesson, when more than a fifth of the sentences are longer than the profile's target | hint | Matching is on whole words and phrases, ignoring case (a name with capitals must match its casing exactly); a Polish or other inflected form is a different word. The readability formulas are approximate, and short texts (under three sentences or 30 words) are not judged, so reading level and sentence length are **hints only**: they are listed on the check result (`hints`, and `facts.style.hints` of the publish check) and never need acknowledging or block anything. Image rules about text inside images and decorative images cannot be checked from the text and are not. Warnings must be acknowledged before publishing, like the other warnings. To see what a *suggested* profile would flag before approving it, check a course against it: in the studio, open the profile and use **Check a course against this profile**, or run `ulams style-profiles check --course `. ## Restyle a course that already exists Changing a profile does not change courses by itself. For a course that was made before, open the approved profile in the studio and use **Restyle a course for this profile**: enter the course id, read what a restyle would rewrite and what it would cost, and create the proposal. It opens on the Living Course review screen, where you accept or reject each rewrite as a diff and apply the ones you want. It rewrites banned phrases, terms to avoid and product-name casing only, never the correct answer of a quiz question, and nothing reaches the course before you apply it. Details and limits: [Living Course, Restyle for a style profile](https://ulams-dev.github.io/ulams/admin/living-course/index.md#restyle-for-a-style-profile). From the command line: `ulams living restyle --confirm-estimate`. ## Measuring it `php artisan course-builder:eval-style` reads a short original style guide (`resources/fixtures/style-guide.md`), scores the extraction against what the guide says (recall per rule and the share of values that cite a passage), writes a course from a source with the approved profile and reports how often each rule is followed, with the cost of every call. It runs on the fake driver by default and with `--live` on the real model, capped by `COURSE_BUILDER_EVAL_MONTHLY_USD`. It never touches the academy's approved profile. Reading level and sentence length are reported but not scored. ## From the command line ```bash ulams style-profiles propose --file ./style-guide.md # read and cite; returns a suggested profile with its warnings ulams style-profiles get --json # values, cited passages, diff against the approved profile ulams style-profiles edit --values @changes.json # fix a value (invalid ones are dropped and reported) ulams style-profiles approve # admins; replaces the approved profile of the scope ulams style-profiles propose --from --profile '{"terminology":[{"use":"participant","avoid":["learner"]}]}' ulams style-profiles propose --file ./expert-guide.md --scope brief --name "Expert track" # a named alternative a brief can pick ulams builder brief set --style-profile-id # none: back to the academy default ulams style-profiles check --course 12 # blocking, warnings and hints, with the guide passages ulams style-profiles list --status approved ulams style-profiles delete --yes # a suggestion or a superseded profile, never the approved one ``` To change a rule of the approved profile, propose a revision with `--from`, review its diff and approve it. ## Who can do what Anyone who can use the Course Builder can list and read profiles and propose one; the creator of a suggestion or an admin edits or deletes it; only an admin approves, because an approved profile will shape every course drafted afterwards. Profiles belong to the whole academy (tenant), and an id from another tenant never resolves. The endpoints are under `/api/admin/course-builder/style-profiles` and use the `builder` scope of a scoped token (`builder:read` to read, `builder:write` to propose, edit, approve and delete). --- # Video and embeds > Add video to a lesson by uploading a file that is converted to HLS streaming, or by embedding a YouTube or Vimeo link with an OEmbed topic. Canonical page: https://ulams-dev.github.io/ulams/creators/video/ There are two ways to put a video in a lesson: - a **Video** topic: you upload the file and ulams streams it; - an **OEmbed** topic: you paste a link to a video hosted elsewhere (YouTube, Vimeo). ## Upload a video file 1. In the program, add a topic and choose **Video**. 2. Click **Click to upload** and choose a file, or pick one already uploaded from the file browser. The server accepts MP4, OGG, WebM and MOV. 3. The upload saves the topic. Set the title and the other [common fields](https://ulams-dev.github.io/ulams/creators/lessons-and-topics/index.md#fields-every-topic-has) and save again. ### HLS processing After the upload, the platform converts the video to HLS (HTTP Live Streaming) in the background with `ffmpeg`, in several bitrates, so learners get a stream that adapts to their connection. While it runs the topic shows **Encoding progress** with a progress bar, which refreshes on its own. The status is stored in the topic's **JSON Metadata** under `ffmpeg`: - `"state": "coding"` with a `percentage` while converting; - `"state": "finished"` with the `path` of the HLS playlist; - `"state": "error"` with a `message` when it failed (for example, a file that `ffmpeg` cannot read). > **Caution:** By default learners get **no video** until processing has finished: the player only receives the HLS > stream. If you need the topic available right away, ask an administrator to enable > `non_strict_value`, which serves the original file until the stream is ready. Administrators control processing in **Configuration → Settings**, group `ulams_video`: | Setting | Effect | |---|---| | `enable` | Turns HLS conversion on or off. When off, learners get the original file. | | `non_strict_value` | Serve the original file until conversion has finished. | | `bitrates` | List of renditions, each with `kiloBitrate` (quality) and an optional `scale` such as `640:480` (resolution; a wrong ratio distorts the picture). Defaults: 250, 500 and 1000 kbit/s. | Operators set the defaults with the environment variables `VIDEO_PROCESSING_ENABLE`, `VIDEO_NON_STRICT_VALUE` and `VIDEO_DISK` (see [Environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md)). Conversion runs on the long-job queue, so a queue worker must be running for it to start. ### Chapters The reference front shows chapters for a video when the topic's **JSON Metadata** contains a `chapters` list, each with a start `time` in seconds and a `title`: ```json { "ffmpeg": { "state": "finished", "path": "course/1/topic/7/video/hls.m3u8" }, "chapters": [ { "time": 0, "title": "Why grind size matters" }, { "time": 95, "title": "Dialling in espresso" } ] } ``` Keep the existing `ffmpeg` entry when you edit the JSON; it is how the player finds the stream. ### Completion In the reference front a video topic completes when the video plays to the end, or with **Mark as complete**. ## Embed a YouTube or Vimeo video (OEmbed) 1. Add a topic and choose **OEmbed**. 2. Paste the page URL of the video, for example `https://www.youtube.com/watch?v=...` or `https://vimeo.com/...`. 3. Click **Preview** to check the embed, then save. The admin preview understands links from YouTube (including Shorts and `youtu.be`), Vimeo, SoundCloud, Flickr, Reddit, Twitter and GIPHY. The reference front plays YouTube links through `youtube-nocookie.com` and Vimeo links through the Vimeo player; any other URL is shown as a link card. An embed completes when the learner reaches the end of the page, or with **Mark as complete**; ulams cannot see how much of an external video was watched. > **Note:** The `youtube` package is not used by video topics. It creates YouTube live streams for webinars and is > configured by an administrator under **Settings → Services** (YouTube API key, client ID and secret). --- # Developers > Developer documentation for ulams, covering architecture, the API packages, tenancy, auth, the reference frontend, local setup, testing and contribution guides. Canonical page: https://ulams-dev.github.io/ulams/developers/ ulams is a headless LMS: a Laravel 13 API built from vendored packages, two small Node services (H5P and PDF), an Astro reference frontend with a framework-free SDK and UI catalogue, a React admin panel and a legacy React learner app, all in one Yarn and Turborepo monorepo. Start with the architecture, then set up the stack. ## How it fits together - [Architecture](https://ulams-dev.github.io/ulams/developers/architecture/index.md): Services, hosts, request flow, workers and backing services. - [Monorepo layout](https://ulams-dev.github.io/ulams/developers/monorepo/index.md): Folders, workspaces, Turborepo tasks and shared libraries. - [API packages](https://ulams-dev.github.io/ulams/developers/api-packages/index.md): Every package in api/packages, grouped by domain. - [Tenancy](https://ulams-dev.github.io/ulams/developers/tenancy/index.md): Database, bucket and keys per tenant; --domain; content origin; isolation tests. - [Authentication](https://ulams-dev.github.io/ulams/developers/authentication/index.md): Passport tokens, roles, demo login, LTI launches, how clients keep tokens. - [API reference](https://ulams-dev.github.io/ulams/developers/api-reference/index.md): Swagger UI, the generated spec, SDK types and the endpoint index. ## Frontends - [Reference frontend](https://ulams-dev.github.io/ulams/developers/reference-frontend/index.md): front/web (Astro SSR, BFF, H5P proxy), @ulams/sdk and @ulams/ui. - [Generative UI](https://ulams-dev.github.io/ulams/developers/generative-ui/index.md): Page documents, bindings, validation and fallbacks; AG-UI streaming to come. - [Legacy learner app](https://ulams-dev.github.io/ulams/developers/legacy-front/index.md): The React app in front/src and the libraries the admin shares with it. - [LLM layer and Course Builder](https://ulams-dev.github.io/ulams/developers/llm-layer/index.md): The ai and course-builder packages, the AG-UI stream and the eval command. ## Working on the code - [Local development](https://ulams-dev.github.io/ulams/developers/local-development/index.md): Run the API stack, the frontends and a tenant on your machine. - [Testing](https://ulams-dev.github.io/ulams/developers/testing/index.md): PHPUnit suites, Vitest, Playwright, integration tests. - [Debugging](https://ulams-dev.github.io/ulams/developers/debugging/index.md): Logs, Horizon, the database, the services. - [Performance](https://ulams-dev.github.io/ulams/developers/performance/index.md): Caching, measuring and keeping pages fast. - [CI](https://ulams-dev.github.io/ulams/developers/ci/index.md): What runs on every pull request. - [Container images](https://ulams-dev.github.io/ulams/developers/container-images/index.md): The images we build and publish, and their licences. - [OpenAPI and SDK](https://ulams-dev.github.io/ulams/developers/openapi-and-sdk/index.md): Annotating endpoints and regenerating SDK types. - [Coding standards](https://ulams-dev.github.io/ulams/developers/coding-standards/index.md): Conventions for PHP, TypeScript, commits and branches. ## How-to guides - [Adding an endpoint](https://ulams-dev.github.io/ulams/developers/adding-an-endpoint/index.md): Route, controller, policy, permission, tests and tenant isolation. - [Adding an admin screen](https://ulams-dev.github.io/ulams/developers/adding-an-admin-screen/index.md): A new page in the umi/max admin. - [Adding a web page](https://ulams-dev.github.io/ulams/developers/adding-a-web-page/index.md): A new page in front/web with the catalogue and the BFF. ## Rules that apply everywhere **Non-negotiables** - LMS entities are changed through domain services, never by writing tables directly. - Every new endpoint gets a tenant isolation test; learner-facing UI meets WCAG 2.2 AA. - Uploaded content is untrusted input; third-party package code runs only on the content origin. - H5P stays in its isolated GPL service; no `@lumieducation/*` imports in MIT code. - Do not use or depend on `escolalms/recommender`. - Existing tests and linters stay green; H5P and SCORM behaviour does not change by accident. Generated reference pages ([packages](https://ulams-dev.github.io/ulams/reference/packages/index.md), [permissions](https://ulams-dev.github.io/ulams/reference/permissions/index.md), [settings](https://ulams-dev.github.io/ulams/reference/settings/index.md), [environment variables](https://ulams-dev.github.io/ulams/reference/environment-variables/index.md), [endpoints](https://ulams-dev.github.io/ulams/reference/api-endpoints/index.md), [events](https://ulams-dev.github.io/ulams/reference/events-and-notifications/index.md), [artisan commands](https://ulams-dev.github.io/ulams/reference/artisan-commands/index.md), [scheduled jobs](https://ulams-dev.github.io/ulams/reference/scheduled-jobs/index.md), [UI catalogue](https://ulams-dev.github.io/ulams/reference/ui-catalogue/index.md)) are rebuilt from the repository on every docs build. Decisions are in [Decisions](https://ulams-dev.github.io/ulams/decisions/index.md); contributing rules in [Contributing](https://ulams-dev.github.io/ulams/contributing/index.md). --- # Adding a web page > Add a learner page to the ulams reference frontend, with SDK data, catalogue components, a new component when needed, and accessibility tests. Canonical page: https://ulams-dev.github.io/ulams/developers/adding-a-web-page/ The reference frontend (`front/web`, package `@ulams/web`) is Astro with server rendering on every request. Pages read API data on the server through `@ulams/sdk`, describe their sections as a document of catalogue components from `@ulams/ui`, and render it with ``. No client JavaScript ships unless a component is interactive. Background: [Reference frontend](https://ulams-dev.github.io/ulams/developers/reference-frontend/index.md) and [Generative UI](https://ulams-dev.github.io/ulams/developers/generative-ui/index.md). The example is the events listing, `front/web/src/pages/events/index.astro`. ## 1. The page A file in `front/web/src/pages` becomes a route (`events/index.astro` is `/events`, `events/[kind]/[id].astro` is `/events/webinar/1`). The middleware (`src/middleware.ts`) has already resolved the tenant from the `Host` header into `Astro.locals.tenant`; on `/learn`, `/account` and `/bff` it also ensures a session and puts the token in `Astro.locals.token`. ```astro --- import Render from "@ulams/ui/Render.astro"; import type { UiNode } from "@ulams/ui/render-core"; import Base from "../../layouts/Base.astro"; import { apiFor, getSettings, getSiteModel, publicData } from "../../lib/data.ts"; import { chromeFor, withSessionLink } from "../../lib/docs.ts"; import { themeFor } from "../../lib/theme.ts"; import { consultationModels } from "../../lib/view-model.ts"; import { SESSION_COOKIE } from "../../lib/session.ts"; const tenant = Astro.locals.tenant; if (!tenant) return Astro.redirect("/"); const [site, settings, consultations] = await Promise.all([ getSiteModel(tenant), getSettings(tenant).catch(() => null), publicData(tenant, "consultations", () => apiFor(tenant).consultations.list({ per_page: 12 })).catch(() => []), ]); const theme = themeFor(settings?.theme?.theme, tenant.slug); const chrome = chromeFor(theme); // ... const doc: UiNode = { component: "Stack", props: { gap: "sm" }, children: [ ...section("webinars", "Live online", "Webinars", webinars), ...section("in-person", "Meet in person", "Events", inPerson), ...section("consultations", "One to one", "Consultations", oneToOne), ], }; --- {chrome.header && }

Live sessions and events

{chrome.footer && } ``` Conventions this shows: - **Data on the server.** `apiFor(tenant, token?)` is a `createClient(...)` pointed at the tenant API. Wrap public data in `publicData(tenant, name, fetcher)` so it goes through the stale-while-revalidate cache. Learner data is cached per session under a key derived from the token, with short lifetimes (`getProfile` 10 minutes, `getAllProgress` 20 seconds), and progress is dropped after writes through the BFF. Catch failures of optional data so the page still renders. - **No invented facts.** Map API responses to the view model in `src/lib/view-model.ts` and bind to it; do not hard-code numbers, ratings or quotes. - **Layout and landmarks.** `Base` sets the theme (`--ulams-*` variables, accent adjusted for AA contrast), the skip link and the demo badge. Keep one `
` and one `

`. - **Styles.** Scoped `