lmctl upload skill
Use lmctl upload to put a web page, a report or a whole static website where the user can open it from lmctl.ai. The files go to the space of the account behind your appkey. The user finds them under My space on lmctl.ai without being told a file name.
When to use it
- You made an HTML page, a report, a chart or a small static site and the user needs to look at it.
- You want the user to find the result later in the same place, not in a chat message.
- You need a link that works without signing in: use the link form below, and read its safety rule first.
Do not use it for secrets, credentials or personal data. Do not use it to store the only copy of anything.
Setup
The command needs an lmctl appkey. It looks for one in this order: the LMCTL_APPKEY variable, the file named by LMCTL_APPKEY_FILE, then the default file ~/.config/lmctl/appkey.json. Never print the appkey, never put it in a page and never send it anywhere except through lmctl. Check which account you act for:
lmctl whoami
The server defaults to https://lmctl.ai. Another server is selected with the LMCTL_SITE_API_URL variable.
Upload one page or file
lmctl upload report.html
lmctl upload chart.png --name charts/chart.png
lmctl upload report.html --destdir reports
lmctl upload report.html --json
The command prints the address of the page. A file keeps its own name unless you give another with the name option. A name may contain slashes: the part before the last slash is a folder in the space, so charts/chart.png lands in a folder called charts. Names are relative: no leading slash, no dot-dot parts, no backslashes, at most 400 characters.
The destdir option puts the file inside a directory of that name: report.html with destdir reports is served as reports/report.html. A directory is one upload, so uploading again to the same destdir replaces everything in it, and removing it removes everything in it. Use the name option with slashes when you want to add one file to a folder without touching the others.
Uploading to a name that already exists replaces it at once. There are no versions.
Upload a folder
The reliable way for any lmctl is to zip the site and unpack it on the server. Zip from inside the folder so that index.html sits at the top of the zip, not inside a wrapping folder:
cd mysite
zip -r ../mysite.zip .
cd ..
lmctl upload mysite.zip --unzip --destdir mysite
The unpacked files are served under the destination directory, which defaults to the zip name without the zip suffix. The address ends with a slash and opens index.html of that directory. Links between the pages must be relative, for example sub/page.html, so they keep working under the directory.
Uploading again to the same directory replaces the whole directory.
Where it lands and who can open it
- The space belongs to the account, not to one user. Every user of the account sees the same space.
- Only signed-in users of that account can open the files. Anyone else gets a sign-in page.
- The user opens My space in the lmctl.ai menu to see pages and folders, and clicks through folders and pages from there.
- The address printed by lmctl upload also works in a browser where the user is signed in.
Pages run in a sandbox: scripts and styles work, but the page cannot read the user's session. Links that open a new tab do not work from inside a page, so use plain relative links.
What the browser shows
These types are shown in the browser: html, htm, css, js, mjs, json, map, txt, md, csv, xml, svg, png, jpg, jpeg, gif, webp, ico, avif, woff, woff2, ttf, otf, pdf, mp3, mp4, webm and wasm. Any other type, for example wav, ogg, mov or tiff, is offered as a download instead of being shown.
Share a report with a link
lmctl upload report.html --link
lmctl upload report.html --link --name weekly.html
The link form is for one HTML report of at most 2 MB. It prints a link that anyone who holds it can open, with no sign-in. A new report under the same name from the same session replaces the old one and prints a new link. The old link stops working, so give the user the new one. Reports are kept 30 days and the limit is 5 a minute per session.
Safety rule: a link is public. Put only what may be read by anyone who gets the link. The session is taken from the LMCTL_SELF_SESSIONID variable when it is set. Put the link in your answer so the user can click it in the chat.
List, replace and remove
lmctl uploads list
lmctl uploads rm report.html
lmctl uploads rm mysite
The list shows the name, size, time and address of everything in the space. Remove a single file by its name, or a whole directory by the directory name. Removing a report also stops its link.
Limits
- 50 MB for one upload.
- A zip has at most 2,000 files and 200 MB when unpacked.
- 200 uploads in the space.
- A report link is one HTML file of at most 2 MB.
How to verify
- Run lmctl uploads list and check that the name and size are the ones you sent.
- For a report link, fetch the printed link without any credential and check that the page comes back.
- For a private page, do not try to read it with a bare HTTP request: it answers 401 by design. Tell the user which page to open under My space and what they should see.
Errors
- A message about the appkey or a 401 answer: no valid appkey was found. Check lmctl whoami and the three places named in Setup.
- A message about size, file count or the number of uploads: you hit a limit above. Zip fewer or smaller files, or remove old uploads with lmctl uploads rm.
- A message that the name is not allowed: use a relative name without leading slash, dot-dot parts or backslashes.
- A message about too many requests: wait a minute and send the report again.
- A folder shows its files but index.html is missing: the zip had a wrapping folder. Zip again from inside the folder.