עמדה
ENעב

סוכני AI

משתמשים בסוכן קוד מבוסס AI ‏(Claude Code, ‏Cursor, ‏GitHub Copilot, ‏Codex…) כדי לחבר את האתר או המערכת שלכם ל-Emda? תנו לו את הקבצים האלה, והוא יכתוב את השילוב נכון כבר בפעם הראשונה.

קובץ מה זה
emda.io/llms.txt אינדקס קצר של התיעוד של Emda לסוכני AI
emda.io/llms-full.txt כל התיעוד בקובץ טקסט אחד: ‏API בעמוד, ‏API מרחוק, יכולות והגדרה
emda.io/emda.d.ts טיפוסי TypeScript ל-window.Emda
emda.io/openapi.json ה-API מרחוק בתיאור OpenAPI 3.1, ליצירת לקוחות
npm install @emda/web (בקרוב) כלי עזר, טיפוסים ועמדה מדומה לפיתוח מקומי

התחלה מהירה

כתבו לסוכן:

Read https://emda.io/llms-full.txt and add Emda receipt printing to the checkout page. Use the types from https://emda.io/emda.d.ts.

(אפשר לכתוב לו גם בעברית.) להגדרה קבועה, הוסיפו את הכללים שלמטה להוראות הסוכן בפרויקט: ‏AGENTS.md, ‏CLAUDE.md, ‏.cursor/rules/emda.md או .github/copilot-instructions.md. ושמרו את emda.d.ts בפרויקט (למשל src/types/emda.d.ts) כדי שהטיפוסים תמיד יהיו זמינים.

כללים לסוכן

העתיקו את הבלוק כמו שהוא (הוא באנגלית, השפה שסוכנים עובדים בה הכי טוב):

## Emda kiosk integration

This site runs on Emda kiosks (https://emda.io). Full reference: https://emda.io/llms-full.txt.
Types for window.Emda: https://emda.io/emda.d.ts (save as src/types/emda.d.ts), or use the
@emda/web package (whenReady, printReceipt, …; @emda/web/mock gives a fake kiosk for development).
Remote API as OpenAPI 3.1: https://emda.io/openapi.json.

Page API (JavaScript in our pages, running in the kiosk):

- `window.Emda` is undefined outside Emda, and each part exists only when the kiosk enables it:
  page integration (`version`, `getDeviceInfo`, `print`, `printUrl`, `home/reload/back/forward`),
  `Emda.receipt` (receipt printer) and `Emda.scale` (scale). Always feature-detect:
  `window.Emda?.receipt`, never assume.
- Wait for it: `if (window.Emda) start(); else addEventListener('emda:ready', start, { once: true });`
  Also keep a normal path for regular browsers (the same page may open on a phone or a PC).
- Receipts are HTML printed at paper width: 58 mm = 384 CSS px, 80 mm = 576 CSS px, 1 CSS px = 1
  printer dot, black on white. Use inline styles and inline (data:) or https images; scripts in the
  receipt don't run. Hebrew and RTL work (`dir="rtl"`). ~24px is a normal line, ~40px a heading.
- Receipt and print calls resolve `{ ok: true }` or `{ ok: false, error }`; they don't throw. Show a
  friendly message for `printer-unreachable`, `printer-failed`, `receipt-disabled`, `not-licensed`.
- Scale calls reject with `{ code, status, message }` (`not_connected`, `timeout`, `not_supported`,
  …). Use `Emda.scale.waitForStable({ onReading })` for live weight and keep its `cancel()` for
  cleanup. Weights are in kilograms.
- `Emda.printUrl(url)` and `Emda.receipt.printUrl(url)` only print pages the kiosk's site rules
  allow (`error: 'blocked'` otherwise).
- Don't depend on `deviceId` for security: any page in the kiosk can read it.

Remote API (our server or tools, over the local network):

- `http://<kiosk IP>:8081/api/v1/...` with `Authorization: Bearer <token>`; JSON bodies;
  responses `{ ok: true, ... }` or `{ ok: false, error }` with an HTTP status.
- Never call it from browser code (no CORS) and never ship the token to the client.
- 402 `not-licensed` means the kiosk's licence doesn't include that feature; 409 `admin-open`
  means someone is in the kiosk's Settings: retry later.

טיפים

תיעוד