autoclaw 1.3.4 โ 1.3.6
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.
- package/README.md +356 -291
- package/README.zh-CN.md +69 -4
- package/dist/agent.js +47 -2
- package/dist/index.js +75 -1
- package/dist/sandbox.js +94 -0
- package/dist/shell.js +55 -32
- package/dist/skills.js +276 -0
- package/dist/tools/background.js +165 -0
- package/dist/tools/core.js +17 -1
- package/dist/tools/index.js +9 -1
- package/dist/tools/render-image.js +135 -0
- package/dist/tools/render-pdf.js +111 -0
- package/dist/tools/takumi-fonts.js +61 -0
- package/dist/zip.js +149 -0
- package/package.json +5 -2
- package/skills/code2media/SKILL.md +82 -0
- package/skills/code2media/references/syntax-guide.md +63 -0
- package/skills/code2media/scripts/package.json +10 -0
- package/skills/code2media/scripts/render.mjs +177 -0
- package/skills/code2media/templates/animation.html +19 -0
- package/skills/code2media/templates/badge.html +6 -0
- package/skills/code2media/templates/certificate.html +9 -0
- package/skills/code2media/templates/metrics-card.html +25 -0
- package/skills/code2media/templates/weekly-report.html +86 -0
- package/skills/invoice-maker/SKILL.md +65 -0
- package/skills/invoice-maker/references/syntax-guide.md +63 -0
- package/skills/invoice-maker/scripts/package.json +10 -0
- package/skills/invoice-maker/scripts/render.mjs +177 -0
- package/skills/invoice-maker/templates/invoice.html +26 -0
- package/skills/invoice-maker/templates/quote.html +68 -0
- package/skills/poster-maker/SKILL.md +62 -0
- package/skills/poster-maker/references/syntax-guide.md +63 -0
- package/skills/poster-maker/scripts/package.json +10 -0
- package/skills/poster-maker/scripts/render.mjs +177 -0
- package/skills/poster-maker/templates/cover.html +13 -0
- package/skills/poster-maker/templates/og-card.html +17 -0
- package/skills/poster-maker/templates/social-post.html +14 -0
package/README.md
CHANGED
|
@@ -1,291 +1,356 @@
|
|
|
1
|
-
# AutoClaw ๐ฆ
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/autoclaw)
|
|
4
|
-
[](https://www.npmjs.com/package/autoclaw)
|
|
5
|
-
[](https://github.com/tsingliuwin/autoclaw)
|
|
6
|
-
[](https://github.com/tsingliuwin/autoclaw/blob/main/LICENSE)
|
|
7
|
-
[](https://www.npmjs.com/package/autoclaw)
|
|
4
|
+
[](https://www.npmjs.com/package/autoclaw)
|
|
5
|
+
[](https://github.com/tsingliuwin/autoclaw)
|
|
6
|
+
[](https://github.com/tsingliuwin/autoclaw/blob/main/LICENSE)
|
|
7
|
+
[](./SAFETY.md)
|
|
8
|
+
[](http://makeapullrequest.com)
|
|
9
|
+
|
|
10
|
+
**The Engineering-First Headless Agent Framework: Stable, Scalable Automation for the Post-Vision Era.**
|
|
11
|
+
|
|
12
|
+
English | [็ฎไฝไธญๆ](./README.zh-CN.md)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
๐ **GitHub Repository**: [https://github.com/tsingliuwin/autoclaw](https://github.com/tsingliuwin/autoclaw)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
AutoClaw is a high-stability, open-source automation framework specifically engineered for **headless systems**.
|
|
21
|
+
|
|
22
|
+
Unlike "screen-seeing" agents (such as OpenClaw) that rely on visual interpretation, AutoClaw is built on a foundation of precise command-driven execution. This makes it significantly more **stable**, **robust from an engineering perspective**, and **easier to scale** across complex environmentsโwhether it's a local server, a CI/CD pipeline, or thousands of containerized nodes.
|
|
23
|
+
|
|
24
|
+
## Why AutoClaw?
|
|
25
|
+
- ๐ณ **Docker Native**: Built to run safely inside containers. Minimal footprint (Node.js/Alpine friendly).
|
|
26
|
+
- ๐ **Better Engineering**: Operates via precise system APIs and shell commands rather than unstable visual recognition, ensuring deterministic outcomes.
|
|
27
|
+
- ๐ก๏ธ **Superior Stability**: Immune to issues like UI rendering, screen resolution, or network lag that plague vision-based agents.
|
|
28
|
+
- ๐ **Massive Scalability**: Low resource consumption allows orchestrating thousands of instances (e.g., in K8s) for true automation swarms.
|
|
29
|
+
- ๐ **Swarm Ready**: Stateless design allows for easy orchestration via K8s, Docker Swarm, or simple shell loops.
|
|
30
|
+
- ๐งฉ **Extensible Integrations**: Built-in support for Web Search (Tavily), Email (SMTP), and Notification Webhooks (Feishu, DingTalk, WeCom).
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- ๐ **Headless Execution**: No GUI required โ pure terminal efficiency. Core operation is shell + file I/O; the optional web tools run in headless Chromium.
|
|
35
|
+
- ๐ค **Non-Interactive Mode**: Intelligent flag handling (`-y`, `--no-interactive`) for zero-touch automation.
|
|
36
|
+
- ๐ **Universal Control**: From simple file I/O to complex system administration.
|
|
37
|
+
- ๐ฅ๏ธ **Background Processes**: start long-lived commands (dev servers, watchers) detached and poll their output without blocking the run.
|
|
38
|
+
- ๐ก๏ธ **Safety Rails**: destructive-command gate, credential-file guard, step cap, wall-clock timeout, and API retries โ designed for machines nobody is watching.
|
|
39
|
+
- ๐ง **Context Aware**: Provides accurate OS, system and time context so relative dates ("today", "next Monday") are handled correctly.
|
|
40
|
+
- ๐ **Web Search**: Integrated with Tavily for real-time information retrieval.
|
|
41
|
+
- ๐ **Web Reading & Screenshots**: Extract article content and capture page screenshots (requires `npx playwright install chromium`).
|
|
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.
|
|
45
|
+
- ๐ **Time Accuracy**: Built-in tool to get precise system date and time for correct temporal context.
|
|
46
|
+
- ๐ง **Communication**: Send emails and push notifications to chat groups automatically.
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
- **Runtime**: Node.js
|
|
50
|
+
- **Language**: TypeScript
|
|
51
|
+
- **Framework**: Commander.js
|
|
52
|
+
- **UI**: Inquirer (interactivity), Chalk (styling), Ora (spinners)
|
|
53
|
+
- **AI**: OpenAI SDK (any OpenAI-compatible endpoint: DeepSeek, Kimi, Qwen, GLM, Ollama, โฆ)
|
|
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)
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
### User Installation
|
|
60
|
+
Install globally via npm:
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g autoclaw
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Development Installation
|
|
66
|
+
1. Clone the repository:
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/tsingliuwin/autoclaw.git
|
|
69
|
+
cd autoclaw
|
|
70
|
+
```
|
|
71
|
+
2. Install dependencies:
|
|
72
|
+
```bash
|
|
73
|
+
npm install
|
|
74
|
+
```
|
|
75
|
+
3. Build the project:
|
|
76
|
+
```bash
|
|
77
|
+
npm run build
|
|
78
|
+
```
|
|
79
|
+
4. Link globally (optional):
|
|
80
|
+
```bash
|
|
81
|
+
npm link
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Quick Start
|
|
85
|
+
|
|
86
|
+
1. **Setup**: Run the interactive setup wizard to configure your API keys and integrations. The wizard runs a live connection test (failures map to the likely wrong field: 401 = key, 404 = base URL, 400 = model name) and can list the provider's models for you to pick from.
|
|
87
|
+
```bash
|
|
88
|
+
autoclaw setup
|
|
89
|
+
```
|
|
90
|
+
2. **Run**: Start the agent in interactive mode.
|
|
91
|
+
```bash
|
|
92
|
+
autoclaw
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Usage
|
|
96
|
+
|
|
97
|
+
### Interactive Mode
|
|
98
|
+
Simply run `autoclaw` to enter the chat loop.
|
|
99
|
+
```bash
|
|
100
|
+
autoclaw
|
|
101
|
+
> List all TypeScript files in the src folder.
|
|
102
|
+
```
|
|
103
|
+
Interactive commands: `exit` / `quit` to leave, and `/view` to open the full output of the last tool result in a pager โ tool output longer than 20 lines is folded on screen and saved to `~/.autoclaw/output/`.
|
|
104
|
+
|
|
105
|
+
### Headless Mode (One-Shot)
|
|
106
|
+
Run a single command and exit.
|
|
107
|
+
```bash
|
|
108
|
+
autoclaw "Check disk usage and save the report to usage.txt" --no-interactive
|
|
109
|
+
```
|
|
110
|
+
The exit code reports the outcome for orchestrators: `0` completed, `1` hard failure (e.g. API error), `2` step cap reached (task unfinished).
|
|
111
|
+
|
|
112
|
+
### Machine-Readable Output (--json)
|
|
113
|
+
Add `--json` to print one JSON event per line on stdout (run_start, tool_call, tool_result, usage, run_end); human output moves to stderr, including anything tools print themselves.
|
|
114
|
+
```bash
|
|
115
|
+
autoclaw "Deploy and report" -y -n --json
|
|
116
|
+
```
|
|
117
|
+
Token usage is collected only when `AUTOCLOW_INCLUDE_USAGE=1` (or `true`) is set โ it is opt-in because not every OpenAI-compatible provider accepts `stream_options.include_usage`.
|
|
118
|
+
|
|
119
|
+
### Batch Mode (Swarm Worker)
|
|
120
|
+
Feed a JSONL manifest of tasks; each task runs in a fresh, isolated agent (one task's context never leaks into another) and per-task results are written as JSONL:
|
|
121
|
+
```bash
|
|
122
|
+
autoclaw batch tasks.jsonl -y # results -> tasks.results.jsonl
|
|
123
|
+
autoclaw batch tasks.jsonl -o out.jsonl --fail-fast
|
|
124
|
+
```
|
|
125
|
+
Manifest lines are `{"id": "...", "task": "..."}` โ `id` is optional (defaults to `task-N`); blank lines and `#` comments are skipped. Optional per-task overrides: `maxSteps`, `model`, `provider`.
|
|
126
|
+
|
|
127
|
+
One failing task does not stop the batch (use `--fail-fast` for that). The process exits `0` when every task completed, `1` otherwise, so cron and K8s Jobs can detect bad batches. Task output stays human-readable on stdout โ the results file is the machine-readable contract, with `status`, `steps`, `message`, `error` and `usage` per task.
|
|
128
|
+
|
|
129
|
+
Long batches can stop and pick up where they left off, and can use local parallelism:
|
|
130
|
+
```bash
|
|
131
|
+
autoclaw batch big.jsonl -y --resume # skip tasks already completed in the results file
|
|
132
|
+
autoclaw batch big.jsonl -y -c 4 # run up to 4 tasks in parallel
|
|
133
|
+
```
|
|
134
|
+
Unattempted tasks are simply absent from the results file, so `--fail-fast` followed by `--resume` is a natural retry loop.
|
|
135
|
+
|
|
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.
|
|
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 (skills/<name>/ root) for store upload
|
|
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
|
+
|
|
154
|
+
### Recipes
|
|
155
|
+
|
|
156
|
+
Daily ops sweep on Linux (crontab):
|
|
157
|
+
```cron
|
|
158
|
+
0 9 * * * autoclaw batch /opt/ops/daily.jsonl -y -n --resume >> /var/log/autoclaw.log 2>&1
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Scheduled sweep on Windows (Task Scheduler):
|
|
162
|
+
```bash
|
|
163
|
+
schtasks /create /tn "AutoClaw Daily" /tr "autoclaw batch C:\ops\daily.jsonl -y -n" /sc daily /st 09:00
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Pipeline inside one manifest โ each task writes files the next task reads:
|
|
167
|
+
```jsonl
|
|
168
|
+
{"id": "sweep", "task": "ๆฃๆฅ็ฃ็ไธๅ
ณ้ฎๆๅก็ถๆ,ๆฅๅๅๅ
ฅ report/sweep.md"}
|
|
169
|
+
{"id": "notify", "task": "่ฏปๅ report/sweep.md,็จไธๅฅ่ฏๆป็ปๅๆจ้ๅฐ้ฃไนฆ"}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Diagnostics on a fresh machine or in CI:
|
|
173
|
+
```bash
|
|
174
|
+
autoclaw doctor # exit 0 = ready; exit 1 = what's missing is printed
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Auto-Confirm (CI/CD)
|
|
178
|
+
Automatically approve all tool executions (dangerous, use with caution or in sandboxes).
|
|
179
|
+
```bash
|
|
180
|
+
autoclaw "Refactor src/index.ts to use ES modules" -y
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### CLI Options
|
|
184
|
+
- `-m, --model <model>`: Specify the LLM model (default: `gpt-5.6`).
|
|
185
|
+
- `-P, --provider <name>`: Use a provider preset (see [Providers](#providers)).
|
|
186
|
+
- `-n, --no-interactive`: Exit after processing the initial query (Headless mode).
|
|
187
|
+
- `-y, --yes`: Auto-confirm all tool executions (e.g., shell commands).
|
|
188
|
+
- `--allow-dangerous`: Let `-y` run clearly destructive commands (rm -rf, format, shutdown, ...) that the built-in safety gate would block.
|
|
189
|
+
- `--json`: Emit NDJSON events on stdout (for orchestrators; use with `-n`).
|
|
190
|
+
|
|
191
|
+
### Diagnostics
|
|
192
|
+
`autoclaw doctor` checks everything headlessly and prints โ/โ per item: config files, resolved provider/baseUrl/model, API key, a live connection test, resolved shell, registered tools, and playwright browser status. Exit `0` = ready, `1` = a critical item failed (the failing item is printed). Ideal for CI or a fresh machine.
|
|
193
|
+
|
|
194
|
+
### Sandbox
|
|
195
|
+
Command execution can be confined with `config.sandbox` / `AUTOCLOW_SANDBOX` (vocabulary borrowed from DeepSeek Harness):
|
|
196
|
+
- `danger-full-access` (default): commands run unconstrained.
|
|
197
|
+
- `workspace-write`: commands can write only inside the current working directory and `/tmp`.
|
|
198
|
+
- `read-only`: commands cannot write anywhere.
|
|
199
|
+
|
|
200
|
+
Backends: bubblewrap on Linux (`apt install bubblewrap`), `sandbox-exec` on macOS. **Windows has no backend yet** โ non-default modes fail closed (commands are refused with a clear error) instead of pretending to confine; run with `danger-full-access` there for now. Reads and network are not confined by this vocabulary.
|
|
201
|
+
|
|
202
|
+
### Providers
|
|
203
|
+
AutoClaw works with any OpenAI-compatible endpoint. Built-in presets fill in the base URL and a default model for you:
|
|
204
|
+
```bash
|
|
205
|
+
autoclaw -P deepseek "Check disk usage and save a report" -y -n
|
|
206
|
+
```
|
|
207
|
+
Available presets: `openai`, `deepseek`, `moonshot` (Kimi), `dashscope` (Qwen), `zhipu` (GLM), `ark` (Volcano Ark), `siliconflow`, `openrouter`, `ollama` (local). You can still override the model with `-m` or config. When `OPENAI_API_KEY` is not set, the API key is read from the provider's own env var (e.g. `DEEPSEEK_API_KEY`, `MOONSHOT_API_KEY`, `DASHSCOPE_API_KEY`, `ZHIPU_API_KEY`, `ARK_API_KEY`, `SILICONFLOW_API_KEY`, `OPENROUTER_API_KEY`).
|
|
208
|
+
|
|
209
|
+
## Configuration
|
|
210
|
+
|
|
211
|
+
AutoClaw uses a hierarchical configuration system.
|
|
212
|
+
|
|
213
|
+
**Priority Order (Highest to Lowest):**
|
|
214
|
+
1. **CLI Arguments**: (e.g., `-m gpt-5.6`)
|
|
215
|
+
2. **Environment Variables**: (`OPENAI_API_KEY`, `.env` file)
|
|
216
|
+
3. **Project Config**: (`./.autoclaw/setting.json` in current directory)
|
|
217
|
+
4. **Global Config**: (`~/.autoclaw/setting.json`)
|
|
218
|
+
|
|
219
|
+
### Supported Configuration Keys (JSON)
|
|
220
|
+
- `provider`: Provider preset name (e.g. `deepseek`).
|
|
221
|
+
- `apiKey`: Your OpenAI API Key.
|
|
222
|
+
- `baseUrl`: Custom Base URL (e.g., for DeepSeek or LocalLLM).
|
|
223
|
+
- `model`: Default model to use.
|
|
224
|
+
- `maxSteps`: Max LLM turns per task before the agent stops (default: `25`).
|
|
225
|
+
- `shellTimeout`: Shell command timeout in milliseconds (default: `120000`).
|
|
226
|
+
- `taskTimeoutMs`: Whole-task wall-clock timeout in milliseconds (off by default; aborts in-flight API calls and stops with `timeout` status).
|
|
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`).
|
|
229
|
+
- `shell`: Force a shell for `execute_shell_command` (`bash`, `powershell`, `cmd`, `sh`; default: auto-detect โ Git Bash > PowerShell > cmd on Windows).
|
|
230
|
+
- `tavilyApiKey`: API Key for Tavily Web Search.
|
|
231
|
+
- `smtpHost`, `smtpPort`, `smtpUser`, `smtpPass`, `smtpFrom`: SMTP Email settings.
|
|
232
|
+
- `feishuWebhook`, `dingtalkWebhook`, `wecomWebhook`: Notification webhooks.
|
|
233
|
+
|
|
234
|
+
### Project-Level Config Example
|
|
235
|
+
Create a file at `.autoclaw/setting.json`:
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"model": "gpt-5.6",
|
|
239
|
+
"baseUrl": "https://api.deepseek.com/v1"
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
> **โ ๏ธ Security Warning**: If you store your `apiKey` or secrets in `.autoclaw/setting.json`, make sure to add `.autoclaw/` to your `.gitignore` file to prevent leaking secrets!
|
|
244
|
+
|
|
245
|
+
### Environment Variables
|
|
246
|
+
- `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_MODEL`: main LLM settings.
|
|
247
|
+
- `AUTOCLOW_PROVIDER`: provider preset used when `-P` is not passed.
|
|
248
|
+
- `AUTOCLOW_MAX_STEPS`, `AUTOCLOW_SHELL_TIMEOUT`: reliability limits (max LLM turns per task; shell timeout in ms).
|
|
249
|
+
- `AUTOCLOW_TASK_TIMEOUT_MS`: whole-task wall-clock timeout in ms.
|
|
250
|
+
- `AUTOCLOW_SANDBOX`: confine shell commands (`read-only`, `workspace-write`, `danger-full-access`).
|
|
251
|
+
- `AUTOCLOW_SHELL`: force the shell for shell commands (`bash`, `powershell`, `cmd`, `sh`).
|
|
252
|
+
- `AUTOCLOW_INCLUDE_USAGE`: set to `1`/`true` to request token usage from the API (opt-in).
|
|
253
|
+
- `TAVILY_API_KEY`, `SMTP_HOST`/`SMTP_PORT`/`SMTP_USER`/`SMTP_PASS`, `FEISHU_WEBHOOK`/`FEISHU_KEYWORD`, `DINGTALK_WEBHOOK`/`DINGTALK_KEYWORD`, `WECOM_WEBHOOK`/`WECOM_KEYWORD`: tool credentials as an alternative to setup.
|
|
254
|
+
|
|
255
|
+
## Integrations
|
|
256
|
+
|
|
257
|
+
### Web Search (Tavily)
|
|
258
|
+
AutoClaw can search the web if you provide a Tavily API Key during setup or in config.
|
|
259
|
+
- **Usage**: "Search for the latest Node.js release notes."
|
|
260
|
+
|
|
261
|
+
### Email (SMTP)
|
|
262
|
+
Configure SMTP settings to let the agent send emails.
|
|
263
|
+
- **Usage**: "Send an email to user@example.com with the summary of the log file."
|
|
264
|
+
|
|
265
|
+
### Notifications (Feishu/DingTalk/WeCom)
|
|
266
|
+
Configure webhooks to receive alerts or reports in your team chat apps.
|
|
267
|
+
- **Usage**: "Notify the team on Feishu that the build has finished."
|
|
268
|
+
|
|
269
|
+
### Date & Time
|
|
270
|
+
Built-in utility to provide the agent with the current system time, ensuring accurate handling of relative time requests.
|
|
271
|
+
- **Usage**: "What's the date today?" or "Remind me to check the logs next Monday."
|
|
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.zip`) that renders HTML โ image/SVG/PDF/animation via a standalone Node script on any machine with Node >= 20.19.
|
|
305
|
+
|
|
306
|
+
## Docker Support
|
|
307
|
+
|
|
308
|
+
### Build & Run
|
|
309
|
+
The repository ships a multi-stage `Dockerfile` (node:22-alpine, browser downloads skipped to keep the image slim). The container runs headless one-shot tasks against the mounted directory:
|
|
310
|
+
```bash
|
|
311
|
+
docker build -t autoclaw .
|
|
312
|
+
docker run --rm -v "$PWD":/workspace -w /workspace -e OPENAI_API_KEY=sk-... autoclaw "Check disk usage and save a report" -y -n
|
|
313
|
+
```
|
|
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.
|
|
315
|
+
|
|
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.
|
|
318
|
+
|
|
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.
|
|
320
|
+
|
|
321
|
+
**For Debian/Ubuntu:**
|
|
322
|
+
```bash
|
|
323
|
+
apt-get update && apt-get install -y fonts-noto-cjk fonts-wqy-zenhei fonts-noto-color-emoji
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**For Alpine Linux:**
|
|
327
|
+
```bash
|
|
328
|
+
apk add font-noto-cjk font-noto-emoji
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## License
|
|
332
|
+
|
|
333
|
+
MIT
|
|
334
|
+
|
|
335
|
+
## Contributing
|
|
336
|
+
|
|
337
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
338
|
+
|
|
339
|
+
1. Fork the Project
|
|
340
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
341
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
342
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
343
|
+
5. Open a Pull Request
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
GitHub: [https://github.com/tsingliuwin/autoclaw](https://github.com/tsingliuwin/autoclaw)
|
|
347
|
+
|
|
348
|
+
## Star History
|
|
349
|
+
|
|
350
|
+
<a href="https://www.star-history.com/?repos=tsingliuwin%2Fautoclaw&type=date&legend=top-left">
|
|
351
|
+
<picture>
|
|
352
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=tsingliuwin/autoclaw&type=date&theme=dark&legend=top-left" />
|
|
353
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=tsingliuwin/autoclaw&type=date&legend=top-left" />
|
|
354
|
+
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=tsingliuwin/autoclaw&type=date&legend=top-left" />
|
|
355
|
+
</picture>
|
|
356
|
+
</a>
|