autoclaw 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +56 -3
  2. package/README.zh-CN.md +347 -294
  3. package/dist/agent.js +13 -1
  4. package/dist/index.js +75 -1
  5. package/dist/skills.js +278 -0
  6. package/dist/tools/index.js +4 -0
  7. package/dist/tools/render-image.js +135 -0
  8. package/dist/tools/render-pdf.js +111 -0
  9. package/dist/tools/takumi-fonts.js +61 -0
  10. package/dist/zip.js +149 -0
  11. package/package.json +7 -4
  12. package/skills/code2media/SKILL.md +82 -0
  13. package/skills/code2media/references/syntax-guide.md +63 -0
  14. package/skills/code2media/scripts/package.json +10 -0
  15. package/skills/code2media/scripts/render.mjs +177 -0
  16. package/skills/code2media/templates/animation.html +19 -0
  17. package/skills/code2media/templates/badge.html +6 -0
  18. package/skills/code2media/templates/certificate.html +9 -0
  19. package/skills/code2media/templates/metrics-card.html +25 -0
  20. package/skills/code2media/templates/weekly-report.html +86 -0
  21. package/skills/invoice-maker/SKILL.md +65 -0
  22. package/skills/invoice-maker/references/syntax-guide.md +63 -0
  23. package/skills/invoice-maker/scripts/package.json +10 -0
  24. package/skills/invoice-maker/scripts/render.mjs +177 -0
  25. package/skills/invoice-maker/templates/invoice.html +26 -0
  26. package/skills/invoice-maker/templates/quote.html +68 -0
  27. package/skills/poster-maker/SKILL.md +83 -0
  28. package/skills/poster-maker/references/scenario-playbook.md +85 -0
  29. package/skills/poster-maker/references/syntax-guide.md +63 -0
  30. package/skills/poster-maker/scripts/package.json +10 -0
  31. package/skills/poster-maker/scripts/render.mjs +177 -0
  32. package/skills/poster-maker/templates/cover.html +13 -0
  33. package/skills/poster-maker/templates/og-card.html +17 -0
  34. package/skills/poster-maker/templates/social-post.html +14 -0
package/README.md CHANGED
@@ -40,6 +40,8 @@ Unlike "screen-seeing" agents (such as OpenClaw) that rely on visual interpretat
40
40
  - 🌐 **Web Search**: Integrated with Tavily for real-time information retrieval.
41
41
  - 🌍 **Web Reading & Screenshots**: Extract article content and capture page screenshots (requires `npx playwright install chromium`).
42
42
  - 🎨 **Image Generation**: DALL-E compatible image generation via any OpenAI-compatible images API.
43
+ - 🖼️ **Deterministic Image Rendering** (`render_image`): HTML + Tailwind templates rendered into PNG/JPEG/WebP/SVG, plus animations (animated WebP/GIF/APNG from CSS `@keyframes`). Fully offline, no browser, milliseconds per render — for OG cards, banners, badges and data cards where exact text and layout matter.
44
+ - 📄 **PDF Rendering** (`render_pdf`): HTML templates rendered into paged PDFs with selectable text, repeating headers/footers and page counters. Fully offline, no browser — for invoices, reports and certificates.
43
45
  - 🕒 **Time Accuracy**: Built-in tool to get precise system date and time for correct temporal context.
44
46
  - 📧 **Communication**: Send emails and push notifications to chat groups automatically.
45
47
 
@@ -50,6 +52,7 @@ Unlike "screen-seeing" agents (such as OpenClaw) that rely on visual interpretat
50
52
  - **UI**: Inquirer (interactivity), Chalk (styling), Ora (spinners)
51
53
  - **AI**: OpenAI SDK (any OpenAI-compatible endpoint: DeepSeek, Kimi, Qwen, GLM, Ollama, …)
52
54
  - **Web tools**: Playwright (headless Chromium for `read_website` / `take_screenshot`)
55
+ - **Rendering**: Takumi (Rust engine via native binding — powers `render_image` / `render_pdf`, no browser)
53
56
 
54
57
  ## Installation
55
58
 
@@ -132,6 +135,22 @@ Unattempted tasks are simply absent from the results file, so `--fail-fast` foll
132
135
 
133
136
  AutoClaw also keeps its own prompt lean: optional tools (web search, email, group notifications, image generation) only register once their credentials are configured, and in long loops older tool results in the model context are replaced by short excerpts.
134
137
 
138
+ ### Skills (Portable Capability Packages)
139
+ AutoClaw runs `SKILL.md` skill packages — the same format used by the WorkBuddy skill store, so one package runs both inside AutoClaw and on other platforms. The system prompt only carries a one-line manifest per skill; when a task matches, the agent reads that skill's `SKILL.md` and follows it with the normal file and shell tools. There is no privileged runtime: skill scripts pass through the same destructive-command gate, sandbox and step caps as any command.
140
+
141
+ Scopes (later shadows earlier on name collision): built-in `skills/` (ships with the npm package) → `~/.autoclaw/skills/` → `.autoclaw/skills/`.
142
+
143
+ ```bash
144
+ autoclaw skill list # show discovered skills with scope and version
145
+ autoclaw skill install <zip|dir|https-url> # install into ~/.autoclaw/skills/ (zip-slip protected)
146
+ autoclaw skill remove <name> # remove a user-installed skill (built-ins are protected)
147
+ autoclaw skill pack <dir> # zip a skill dir -> <name>-skill-<version>.zip (SKILL.md at zip root)
148
+ ```
149
+
150
+ Install accepts any SKILL.md-compatible package: a local directory, a local zip, or an https download URL. It tolerates third-party layout variance (SKILL.md at the zip root, a plain folder, or a `skills/<name>/` wrapper, macOS `__MACOSX`/`.DS_Store` junk) and always installs under the skill's frontmatter `name`, so discovery and the manifest stay consistent.
151
+
152
+ Three built-in skills, layered: [`code2media`](skills/code2media/SKILL.md) (Code to Media) is the universal rendering engine — a standalone Node script turning any HTML into images/SVG/paged PDFs/animations; [`poster-maker`](skills/poster-maker/SKILL.md) and [`invoice-maker`](skills/invoice-maker/SKILL.md) are independently optimized scenario skills carrying platform size specs, document layout conventions and quality checklists. The same zips publish to any SKILL.md-compatible store. Skills compose with batch mode: one manifest line like `{"id":"inv-042","task":"用 invoice-maker 技能根据 orders-042.json 生成发票 invoices/042.pdf"}` drives an isolated swarm worker through the same skill.
153
+
135
154
  ### Recipes
136
155
 
137
156
  Daily ops sweep on Linux (crontab):
@@ -206,6 +225,7 @@ AutoClaw uses a hierarchical configuration system.
206
225
  - `shellTimeout`: Shell command timeout in milliseconds (default: `120000`).
207
226
  - `taskTimeoutMs`: Whole-task wall-clock timeout in milliseconds (off by default; aborts in-flight API calls and stops with `timeout` status).
208
227
  - `sandbox`: Confine shell commands (`read-only`, `workspace-write`, `danger-full-access`; default: `danger-full-access`).
228
+ - `skillsEnabled`: Set `false` to disable the skill system (default: `true`).
209
229
  - `shell`: Force a shell for `execute_shell_command` (`bash`, `powershell`, `cmd`, `sh`; default: auto-detect — Git Bash > PowerShell > cmd on Windows).
210
230
  - `tavilyApiKey`: API Key for Tavily Web Search.
211
231
  - `smtpHost`, `smtpPort`, `smtpUser`, `smtpPass`, `smtpFrom`: SMTP Email settings.
@@ -250,6 +270,39 @@ Configure webhooks to receive alerts or reports in your team chat apps.
250
270
  Built-in utility to provide the agent with the current system time, ensuring accurate handling of relative time requests.
251
271
  - **Usage**: "What's the date today?" or "Remind me to check the logs next Monday."
252
272
 
273
+ ### Deterministic Rendering (Takumi)
274
+ `render_image` turns HTML templates into precise images — PNG, JPEG, WebP or vector SVG — offline with no browser or AI model involved. `render_pdf` turns HTML templates into paged PDFs with selectable text, repeating header/footer bands, and `<span class="pageNumber">` / `<span class="totalPages">` counters. Templates are styled with inline CSS, `<style>` blocks, or Tailwind v4 utilities via the `tw` attribute (`<div tw="w-full h-full bg-blue-500">`); plain `class` attributes only match regular CSS selectors. Both tools auto-detect common system fonts (CJK/emoji included); register specific font files via `font_paths`.
275
+
276
+ Typical workflows — describe the job in natural language and the agent writes the templates itself:
277
+
278
+ ```bash
279
+ # Blog SEO: one OG share image per post
280
+ autoclaw "Read the title and summary of every .md file in content/posts/ and render an OG share image (1200x630) for each into public/og/" -y -n
281
+
282
+ # Finance / e-commerce: invoice PDFs from an orders export, then email them out
283
+ autoclaw "Read orders.csv, render a PDF invoice for each order into invoices/ (A4, page-number footer), then email every invoice to the customer address in its row" -y
284
+
285
+ # HR / training: personalized completion certificates for an attendee list
286
+ autoclaw "Read attendees.json and render a completion certificate (1414x1000) for each attendee into certs/, numbered from AC-2026-0001" -y -n
287
+
288
+ # Ops reporting under cron/CI: deterministic output — same input produces the same PDF
289
+ autoclaw "Aggregate this week's nginx access log into a one-page A4 PDF report with a metrics table and save it as report.pdf" -y -n
290
+ ```
291
+
292
+ Swarm scale via batch mode — each task renders in its own isolated agent:
293
+
294
+ ```bash
295
+ cat > render-jobs.jsonl <<'EOF'
296
+ {"id": "og-001", "task": "Render an OG share image for post-001.md into public/og/001.png"}
297
+ {"id": "og-002", "task": "Render an OG share image for post-002.md into public/og/002.png"}
298
+ EOF
299
+ autoclaw batch render-jobs.jsonl -y -c 4
300
+ ```
301
+
302
+ Tool choice: use `render_image` / `render_pdf` when exact text, layout and branding matter (cards, banners, badges, documents); use `generate_image` for artistic or photographic imagery. Emoji in templates are fetched from the Twemoji CDN by default, so fully offline environments should keep templates text-only.
303
+
304
+ Runnable examples with committed previews: [examples/render](examples/render/README.md) (OG cards, social posters, KPI cards, weekly-report PDFs, SVG badges, certificates, animations, multi-page invoices — plus a real agent one-shot run under `agent-run/`). The same capability ships as a portable [WorkBuddy skill](skills/code2media/SKILL.md) (`code2media-skill-1.2.1.zip`) that renders HTML → image/SVG/PDF/animation via a standalone Node script on any machine with Node >= 20.19.
305
+
253
306
  ## Docker Support
254
307
 
255
308
  ### Build & Run
@@ -260,10 +313,10 @@ docker run --rm -v "$PWD":/workspace -w /workspace -e OPENAI_API_KEY=sk-... auto
260
313
  ```
261
314
  Note: browser-based tools (`read_website` / `take_screenshot`) are not functional in the default image since browsers are not bundled — they return a friendly install hint instead.
262
315
 
263
- ### Chinese Font Issues in Screenshots
264
- When running AutoClaw inside a Docker container (especially Alpine or Debian Slim), screenshots of Chinese websites may display text as square boxes ("tofu") due to missing fonts. Emojis (e.g., 🔥) may also appear as squares.
316
+ ### Chinese Font Issues in Screenshots and Rendered Output
317
+ When running AutoClaw inside a Docker container (especially Alpine or Debian Slim), screenshots of Chinese websites may display text as square boxes ("tofu") due to missing fonts. Emojis (e.g., 🔥) may also appear as squares. The same affects `render_image` / `render_pdf` output containing CJK text.
265
318
 
266
- **Solution:** Install CJK (Chinese/Japanese/Korean) and Emoji fonts in your container.
319
+ **Solution:** Install CJK (Chinese/Japanese/Korean) and Emoji fonts in your container. The render tools auto-detect the same font paths, so installing these packages fixes both screenshots and rendered images/PDFs.
267
320
 
268
321
  **For Debian/Ubuntu:**
269
322
  ```bash