M5 — @thinkfleet/piece-agentmark Activepieces piece - #7
Merged
Conversation
Sibling package in pieces/agentmark/ that wraps the core AgentMark library
as an Activepieces piece. Drop into any flow to convert web pages or PDFs
into AgentMark snapshots and fill PDF forms — no code, no SDK install for
the flow author.
Three actions (v1)
- Capture Web Page (snapshot_web_page)
URL → AgentMark snapshot. Launches Chromium, snapshots the page,
closes browser. Configurable wait_until + timeout + headless.
Output: { agentmark, url, title, kind, action_count, bytes,
captured_at }
- Capture PDF (snapshot_pdf)
PDF source (URL / file path / file:// / data: URI / bare base64) →
AgentMark snapshot with kind: 'document' or 'form'. Optional OCR
(Tesseract + Poppler) for scanned and "Print To PDF" outputs.
Output: { agentmark, source_url, bytes, ocr_used }
- Fill PDF Form (fill_pdf_form)
Atomic PDF fill operation. Accepts field values keyed by either
AgentMark action ID (act_field_N) or original PDF field name —
matches whichever the caller has. Returns the filled PDF as base64
data URI or raw base64. Optional flatten (bake values into page
content; resulting PDF no longer fillable).
Output: { filled_pdf, bytes, fields_applied[], fields_skipped[],
flattened }
Architecture
- pieces/agentmark/ — sibling package in the same repo, builds + tests
independently from the core library.
- pieces/agentmark/src/lib/common.ts — shared resolveBytes() helper that
accepts URL/path/data URI/base64 strings so all PDF actions take a
uniform `source` prop.
- pieces/agentmark/src/lib/actions/*.ts — one file per action.
- Depends on @thinkfleet/agentmark via file:.. for monorepo dev; bump
to ^0.7.0 (or whatever version is on npm) before publishing.
- Uses @activepieces/pieces-framework for the createPiece + createAction
API; matches conventions from the official AI piece in
activepieces-main.
Tests (13 piece tests + 1 gated browser test)
- Piece-shape assertions: display name, minimum release, exposed
actions, prop schemas
- fill_pdf_form end-to-end:
- Fill by action ID
- Fill by original field name (resolution)
- Unknown keys reported via fields_skipped (no throw)
- return_format=base64 vs data_uri
- flatten removes the form
- Accepts data: URI source (no temp file)
- snapshot_pdf end-to-end (text PDF, no OCR): produces kind: form
- snapshot_web_page: gated on AGENTMARK_INTEGRATION=1 with a local
HTTP server (no external network)
Cross-package hygiene
- Root vitest.config.ts excludes pieces/** from root test discovery
to prevent the symlinked node_modules/@thinkfleet/agentmark from
causing duplicate-module instanceof failures.
- Piece's tsconfig sets rootDir: ./src and preserveSymlinks: true so
TypeScript never emits compiled JS into the parent's src/ via the
monorepo symlink.
Known limitations (deferred)
- No multi-step "browser_workflow" action yet — for now each web action
launches a fresh browser. Stateful flows need to fit in a single
action call. Multi-step is on the v1.1 roadmap.
- No AP piece-auth (auth: PieceAuth.None()) — none of the v1 actions
need credentials. Future Mistral OCR integration would add custom
auth for the API key.
Distribution unlocks
- Growth OS (built on Activepieces) gets AgentMark as a flow primitive
for free once this piece is registered.
- Every other Activepieces deployment (community + commercial) can
install the piece independently.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sibling package in `pieces/agentmark/` that wraps the core AgentMark library as an Activepieces piece. Drop into any flow to convert web pages or PDFs into AgentMark snapshots and fill PDF forms — no code, no SDK install for the flow author.
Stacked on top of #6 (v0.7 MCP server). Merge #2 → #3 → #4 → #5 → #6 → this PR.
Three actions (v1)
Why this matters
Tests (13 + 1 gated)
Cross-package hygiene fixes
Two real bugs caught during development:
Architecture
```
pieces/agentmark/
├── package.json (file:../.. dep on parent during dev)
├── tsconfig.lib.json (rootDir: ./src + preserveSymlinks: true)
├── README.md
├── src/
│ ├── index.ts (createPiece export)
│ └── lib/
│ ├── common.ts (resolveBytes — URL/path/base64/data URI)
│ └── actions/
│ ├── snapshot-web-page.ts
│ ├── snapshot-pdf.ts
│ └── fill-pdf-form.ts
└── test/piece.test.ts (13 unit + 1 gated)
```
Distribution path
When v0.7 publishes to npm:
The piece can then be added to any Activepieces deployment via `@thinkfleet/piece-agentmark`.
Test plan
🤖 Generated with Claude Code