Anza kazi
Unda kwa AI
Kutuma mstereani
Kila kitu ambacho AI assistant ya kodi inahitajika kufanua programu ya Lia kwa usahihi. Dokumenti kama Markdown, llms.txt, OpenAPI spec ya serikali ya API, TypeScript ya kundi, na faili la mafunzo kwa project yako.
Mipango hii umeandikwa kusoma na watu na AI kazi zote pia. Kumbuka msaada wako (Claude, ChatGPT, Cursor, Copilot, Claude Code au wengine) kwenye faili zifuatazo, na kusakamana kifile cha mafunzo kwenye mchakato wako, ili ameandikwa kifanyi cha Lia kwa kifupi kwanza.
#Kwa mwenyekiti wako
| Nini | Wapi | Tumia kwa |
|---|---|---|
| Mapambo ya maelezo | /llms.txt | Mipango ya kawaida na kila mkono, na mifano ya kushiriki kwenye Markdown. Tumia hapa. |
| Kila maelezo kwenye faili moja | /llms-full.txt | Kutuma au kushiriki kwa wakati mchango wako unaweza't browse. |
| Kila skrini kama Markdown | Zidai .md kwa anwani yake, kama /concepts/payments.md | Kipimo kimoja kwa wakati. Kila mfumo's Kutuma mstereani mnu pia hivyo. |
| Server API kama OpenAPI 3.1 | /openapi.json | Kuunda client ya kisasa, au kushiriki kwa agent kuzalisha API kwa usahihi. |
| Faili ya mafunzo kwa project yako | /AGENTS.md | Chini: mafunzo ambao yana manufaa zaidi, kwenye faili ambao wajibu wanaokaa. |
| Aina za TypeScript | npm install @lia-labs/sdk | Kila njia'mwenyewe params na jibu, kila hadithi'zilizopita data. |
#Kutuma mstereani
Kila ukurasa una Kutuma mstereani mnu kando ya jina lake:
- Kutuma kama Markdown hukusanya kifundo kwenye clipboard yako, inapatikana kwenye chat.
- Tazama kama Markdown inatwambia Markdown yake.
- Fungua kwenye Claude na Fungua kwenye ChatGPT tuma chat ambayo inayosoma mazingira yako.
#Zidai mafunzo kwenye project yako
Hifadhi hii kama AGENTS.md kwenye mchezo wako (au CLAUDE.md kwa Claude Code, au kisasi kwenye .cursor/rules/). Mwanaume wanaosoma kama wao wanaandika code, kwa hivyo wanaendelea Lia'kikosi cha mshahara bila kushirikiana kila mmoja. It'kutoka kwenye mstari pia kwenye /AGENTS.md.
# Building a Lia app
This is a web app that runs inside the Lia app (lialabs.org), like a Telegram mini app. Docs: https://docs.lialabs.org (every page as Markdown: add .md; everything: https://docs.lialabs.org/llms-full.txt).
## The SDK
- In a page without a build step: <script src="https://api.lialabs.org/sdk/lia-apps-v1.js"></script> gives window.Lia. Never copy or bundle that file.
- With a bundler: npm install @lia-labs/sdk (or @lia-labs/sdk-react, -preact, -vue, -svelte, -solid, -angular, @lia-labs/elements). Use one or the other on a page, never both.
- Call init() first, then ready() once the first screen is drawn. Outside Lia every call fails with code "not_in_lia"; for local development call mockLia() when isLia() is false.
- Every failure is an Error with a code. "cancelled" from pay() is a normal no, not an error to report.
## Trust
- Never trust the page. Your server verifies a session token (from init() or session(), 15 minutes) with POST https://api.lialabs.org/api/apps/v1/session/verify and takes the player id from Lia's answer, never from the page.
- Secret keys (lia_test_..., lia_live_...) and the webhook secret (whsec_...) live on the server only. The app id is the only public identifier.
- Prices come from Lia's records: the page passes a product id to pay(), never an amount.
## Payments
- pay(productId) opens Lia's pay sheet and answers { chargeId, productId }. The server then checks GET /charges/:id (its player, product and status), gives the item once per charge id, and calls POST /charges/:id/deliver. If it can't deliver, POST /charges/:id/refund.
- On opening, call charges() and deliver any paid, undelivered charges; listen with onCharge() too. Webhooks (charge.paid) are a nudge: check with the API, and verify the Lia-Signature header (HMAC SHA-256 of "<t>.<raw body>" with the whsec_ secret).
## Rewards, ads, notifications
- Pay players in $LIA only from the server: POST /rewards with a key that names the reason (a key pays once, ever). At most 10,000 LIA a reward; handle pool_empty and daily_limit.
- A rewarded video answers { watched, adId }: give the reward only after the server checks POST /ads/verify (watched, and the same player), once per adId.
- Between rounds and games, call Lia.showInterstitialAd() (Lia paces it: about one every 90 seconds and every 2nd round; "too_soon" means carry on). Rewarded videos only behind a button the player chooses (a hint, a second chance), never by themselves between rounds. Test keys always get Google's test ads.
- Banners and native ads (SDK 1.7): Lia.showBanner({ position: "bottom" | "top" }) and Lia.showNativeAd({ placement: "card" | "sheet" }). Lia draws them natively beside the page (the page gets shorter), never inside it: don't build an ad slot in your own HTML for them, just let the layout follow the viewport height. Show the card at pauses (a results screen) and hideNativeAd() when play resumes; both answer { shown: false, reason } when there's nothing to show, so carry on. For an ad inside the page's own content, use the developer's own AdSense or Google Ad Manager tags: Lia lets only Google's ad frames load and opens ad taps in Safari; that revenue is the developer's own, not counted by Lia. For games: pin Lia.showBanner({ position: "top" }) before Lia.ready() and keep it for the visit; put in-page ad rows only on calm screens (home, lobby), never over or under the board; don't use the native card or sheet over gameplay.
- Notifications are opt-in (requestNotifications()), sent by the server with POST /notifications, at most 3 a day per person from one app, an hour apart, 180 characters, no links. Use a startParam to open the right screen.
## Feel like Lia
- Use Lia's theme (CSS variables --lia-bg-color, --lia-text-color, --lia-hint-color...), the safe areas (--lia-safe-area-inset-bottom), Lia.language (13 languages) and Lia.rtl for dir.
- Use Lia's mainButton for the main action, backButton for your own screens, Lia's dialogs and toasts, and play sound only while soundOn.
- Only your own pages load in the frame: open other sites with openLink(url).
## Conventions
- In text people read: "$LIA" for the token, "LIA" next to numbers (5 LIA).
- Retry server POSTs with the same Idempotency-Key header.#Tuma maswali mazuri
Chini ya mifano ambayo inafundisha kwa mizani yafuatayo:
- "Kusoma https://docs.lialabs.org/llms.txt, kisha kufundisha mfumo wa Lia kwenye React ambapo wanaosomanya kusoma kupiga muda mmoja kwa 5 LIA, na server ya Node ambapo inachukua na inaongeza kifedha."
- "Kutumia https://docs.lialabs.org/openapi.json, andika client ya kichaguo kwa serikali ya Lia ya API kwa TypeScript na kujaribu tena na mfululizo wa maelekezo ya Idempotency-Key."
- "Kusoma https://docs.lialabs.org/guides/multiplayer-with-invites.md na kuchukua bordi ya kawaida kwenye mchezaji wangu wa kawaida."
#Kama kitu'sio sahihi
Mipango ya AI zinaweza kuwa kushambulia. Kwa SDK mazoezi na server API hutegemeana, na Kuzigira mgonjwa wako inashow kama kufundisha kila kitu kabla ya kuanza kuvuta.
Kutafsiri kwa kawaida. Kiingereza kina maana ya kawaida. Kusoma kwa Kiingereza