Skip to content

Commit 62e668f

Browse files
authored
feat: add agent-pdf skill and API (#26)
## Background Add `agent-pdf/` - a lightweight Rust microservice that lets AI agents edit and fill PDFs through SimplePDF. Hosted at `agent.simplepdf.com`. ## Changes - Add Rust API service (`GET /?url=` for URL passthrough, `POST /` for file upload and JSON URL) - `GET /` without params serves `SKILL.md` as `text/markdown` for agent discovery - `?companyIdentifier` routes to custom SimplePDF portals - Default editor host: `ai.simplepdf.com` - S3-compatible storage for file uploads (1hr expiry) - Proxy-aware rate limiting with bounded bucket eviction - Input validation (subdomain pattern, URL scheme) and HTML escaping in snippets - Dockerfile for DO App Platform deployment - GitHub Actions CI workflow (fmt, clippy, build) ## Notes Companion PR on simple-pdf: SimplePDF/simple-pdf#157 (plan + submodule ref)
1 parent 2e7c32c commit 62e668f

File tree

14 files changed

+3627
-0
lines changed

14 files changed

+3627
-0
lines changed

.github/workflows/agents.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Agents
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- agents/**
9+
- .github/workflows/agents.yaml
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- agents/**
15+
- .github/workflows/agents.yaml
16+
17+
jobs:
18+
check:
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
working-directory: agents
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Install Rust
29+
uses: dtolnay/rust-toolchain@stable
30+
with:
31+
components: rustfmt, clippy
32+
33+
- name: Cache cargo
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
~/.cargo/registry
38+
~/.cargo/git
39+
agents/target
40+
key: ${{ runner.os }}-cargo-${{ hashFiles('agents/Cargo.lock') }}
41+
restore-keys: ${{ runner.os }}-cargo-
42+
43+
- name: Format
44+
run: cargo fmt --check
45+
46+
- name: Clippy
47+
run: cargo clippy -- -D warnings
48+
49+
- name: Build
50+
run: cargo build

agents/.do/app.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: agent-pdf
2+
region: nyc
3+
services:
4+
- name: api
5+
github:
6+
repo: SimplePDF/simplepdf-embed
7+
branch: main
8+
deploy_on_push: true
9+
source_dir: agents
10+
dockerfile_path: Dockerfile
11+
instance_count: 1
12+
instance_size_slug: basic-xs
13+
http_port: 8080
14+
health_check:
15+
http_path: /health
16+
envs:
17+
- key: S3_KEY
18+
scope: RUN_TIME
19+
type: SECRET
20+
- key: S3_SECRET
21+
scope: RUN_TIME
22+
type: SECRET
23+
- key: S3_ENDPOINT
24+
scope: RUN_TIME
25+
value: https://nyc3.digitaloceanspaces.com
26+
- key: S3_BUCKET
27+
scope: RUN_TIME
28+
value: agent-pdf
29+
- key: S3_REGION
30+
scope: RUN_TIME
31+
value: nyc3
32+
- key: DEFAULT_EDITOR_HOST
33+
scope: RUN_TIME
34+
value: ai.simplepdf.com
35+
- key: TRUSTED_IP_HEADER
36+
scope: RUN_TIME
37+
value: do-connecting-ip
38+
- key: RATE_LIMIT_PER_MIN
39+
scope: RUN_TIME
40+
value: "30"

agents/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)