{"id":109535,"plugin_id":"plugin_asdk_app_6afaeb7839988191892ac50bedd8277b","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-21T13:43:35.943Z","digest":"ad8dcb6377c0dade920e8cc911e84db3c4c2ee808e5946ba36a41035e6e12aba","against":null,"payload":{"description":"Put images, fonts and other binary files into a Birta draft, or read them back: send them over HTTP to an upload address when you can make your own requests, or pass them as base64 text through the file tools when you can't. Use whenever a task adds, replaces or reads a picture, a font, an icon, a PDF download or any other non-text file of a Birta project.","included_files":[],"name":"birta-binary-files","skill_md_contents":"---\nname: birta-binary-files\ndescription: \"Put images, fonts and other binary files into a Birta draft, or read them back: send them over HTTP to an upload address when you can make your own requests, or pass them as base64 text through the file tools when you can't. Use whenever a task adds, replaces or reads a picture, a font, an icon, a PDF download or any other non-text file of a Birta project.\"\n---\n\n# Binary files in a Birta draft\n\nText files (HTML, CSS, JS, Markdown, SVG, JSON) go through `write_file`, `edit_file`\nand `replace_lines` as they are. Everything else is binary: images, fonts, audio,\nvideo, archives offered for download. There are two ways to put one into a draft.\n\n## Choose the way\n\n1. **You can make HTTP requests** (a terminal, `curl`, a script with network access):\n   ask for an upload address and send the files to it. This is the default — it is\n   fast, exact and costs no tokens for the file's bytes.\n2. **You can't** (a chat without network, a sandbox with no way out): write the file\n   as base64 text with the file tools, whole or in parts. See the last section.\n\nBoth ways need a draft: `list_versions` shows it; `create_version` opens one.\n\nSend the user's file as it is; don't resize or recompress it unless they ask.\n\nIf neither way works — no network and no way to read the file's bytes, or a file too\nlarge to write out as base64 yourself — don't publish without it and don't put a\nplaceholder in its place. Tell the person which file didn't go in and why, and offer:\n\n- attach it in the chat of the Birta panel (the paperclip) and ask Birta's agent there\n  to put it into the project;\n- or a smaller copy of it — made only with their consent.\n\n## Send files to an upload address\n\nCall `get_upload_address` with the project address and the draft's number. The\nanswer gives the address, the draft number and the moment it stops working. An\naddress takes **one** send within **15 minutes**; ask for a new one for every send.\nThe address is for your own request only: never show it to the person or ask them to\nopen it, and don't print it into files, pages or commits.\n\nSend either the files themselves or one zip archive.\n\n**Files** — one form part per file; the part's file name is the file's path in the\ndraft. Best for one to a few files:\n\n```bash\ncurl -sS -X POST \"$UPLOAD_URL\" \\\n  -F \"file=@./out/logo.png;filename=images/logo.png\" \\\n  -F \"file=@./out/hero.webp;filename=images/hero.webp\"\n```\n\n**A zip** — paths inside the archive are paths in the draft; the archive's root is\nthe draft's root. Best for many files gathered with one command:\n\n```bash\n(cd site && zip -r -X ../upload.zip images fonts)\ncurl -sS -X POST \"$UPLOAD_URL\" -H \"content-type: application/zip\" --data-binary @upload.zip\n```\n\nRules for both:\n\n- Send only the files that change. A send adds and replaces; it never deletes. Files\n  of the draft that are not in the send stay as they are.\n- Paths are case-sensitive and relative to the draft root: `images/logo.png`, not\n  `/images/logo.png` or `./images/logo.png`.\n- No two files with the same path in one send — the whole send is refused.\n- Leave out build output folders, version-control folders and secrets (`.env`, keys).\n  They are dropped anyway and named in one summary line.\n- No symbolic links inside the archive: they are refused as unsafe paths.\n- Only form parts and zip archives are read; tar, gzip and 7z are not.\n\n## Read the answer\n\nThe answer is JSON:\n\n| Field | Meaning |\n| --- | --- |\n| `refused` | `true` when nothing was written |\n| `reason` | Why it was refused, as a code; empty otherwise |\n| `version` | The draft's number |\n| `written` | `[{path, bytes}]` — files now in the draft |\n| `rejected` | `[{path, reason}]` — files not written; the rest of the send was |\n| `excluded` | One line naming junk and secrets left out |\n| `repeat` | `true` when this is the stored answer of an earlier send |\n| `text` | The same in one or two sentences |\n\nA send with at least one written file is a success even if some files were\nrejected. Fix the rejected ones (type, path, size) and send them again **to a new\naddress**. If every file was rejected, the answer is a refusal with reason\n`validation_failed` and the draft is unchanged.\n\nCheck the result with `list_files`, or open the draft's preview.\n\n## When the address doesn't take the send\n\n| `reason` | What to do |\n| --- | --- |\n| `repeat: true` in the answer | The address was used already; the answer is that first send's. Nothing new was read. Ask for a new address to send again. |\n| `wrong_state` | The address expired, or the draft was published or discarded. Check `list_versions` and ask for a new address for the current draft. |\n| `busy` | Another send to this address is still being received. Wait for its answer instead of sending again. |\n| `failed` | The send didn't arrive in time, broke off, or storing failed. Nothing was written and the address is still valid: send again to it. |\n| `too_many` | More files than one package may hold. Split into several sends, each to a new address. |\n| `plan_limit` | Bigger than the space the owner's plan gives one project. Send less at once, or tell the owner what the answer says about plans. |\n| `no_such_project`, `role_too_low`, `account_banned`, `project_blocked`, `external_build` | The same refusal a file edit gets. Tell the owner the answer's text. |\n\nAn address that was never issued, or a mistyped one, answers 404 with no fields.\n\n## Without network: base64 through the file tools\n\nA binary file is base64 text on `write_file`, `replace_lines` and `read_file`: it is\ndecoded on write and encoded again on read, wrapped at 1024 characters per line.\n\n- Small file: `write_file` with the whole base64 text as `content`.\n- Large file: write the first part with `write_file`, then append each next part with\n  `replace_lines` after the last line. Cut parts **only on whole lines** of the\n  encoded text (or on a multiple of 4 characters). Encode the file once and cut that\n  text; parts encoded separately don't join back into a valid file.\n- A large file makes a long call. Whenever you have network, use the upload address\n  instead.\n- Never edit the encoded text by hand, re-wrap it, or add spaces: one wrong\n  character breaks the file. To change a picture, replace the whole file.\n- `edit_file` is for text; a fragment of encoded text is rarely unique.\n- SVG is text: write it as markup, not base64.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}