feat(plugins): ActivepiecesRecipeBackend — recipes sync over HTTPS - #40
Merged
Conversation
Pairs with flobyteAI PR #694 (Activepieces recipes endpoints). Same
agentmark binary now supports two production-ready recipe deployments:
- Local-only (default): file-based, single-user laptop
- Activepieces-backed: hits the live ThinkFleet recipes API, team-
shareable across users / sessions / on-prem deployments
Mirrors ActivepiecesMemoryBackend exactly so the wiring story stays
uniform: same Bearer sk-* auth, same project + chatbot scope model,
same 404→null/false semantics on get/delete.
Endpoint contract (one-to-one with flobyteAI PR #694):
POST /v1/projects/:projectId/[chatbots/:chatbotId/]recipes
?on_conflict=fail|replace create / replace
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes
?target_app=<name> list + filter
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/:name
DELETE /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/:name
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/describe
Field-name translation on the wire:
agentmark `target_app` ↔ Activepieces `targetApp` (snake/camel)
Everything else is field-identical.
Usage (post-merge of both PRs):
import { createRecipesPlugin, ActivepiecesRecipeBackend } from '@thinkfleet/agentmark'
const recipes = createRecipesPlugin({
backend: new ActivepiecesRecipeBackend({
baseUrl: process.env.AP_BASE_URL,
apiKey: process.env.AP_API_KEY, // sk-...
projectId: process.env.AP_PROJECT_ID,
chatbotId: process.env.AP_CHATBOT_ID, // optional
}),
})
Same Claude Code / Cursor / Codex agent now reads and writes recipes
to **real Activepieces storage** instead of a local file. Team
members in the same project share recipes automatically.
Tests (15 new, 506 total):
- Construction validation (baseUrl, sk- prefix, projectId)
- Auth shape + project/chatbot routing
- save() POSTs to /recipes with on_conflict query param
- save() translates target_app → targetApp on the wire
- save() translates targetApp → target_app on the response
- get/delete return null/false on 404 (not throw)
- list with target_app builds the query string
- non-2xx throws ActivepiecesRecipeError with status + body
- describe reports kind=activepieces
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Architecture
```ts
const recipes = createRecipesPlugin({
backend: new ActivepiecesRecipeBackend({
baseUrl: process.env.AP_BASE_URL,
apiKey: process.env.AP_API_KEY, // sk-...
projectId: process.env.AP_PROJECT_ID,
chatbotId: process.env.AP_CHATBOT_ID, // optional
}),
})
```
Endpoint contract
Mirrors flobyteAI PR #694 1-to-1. Both project-scoped and chatbot-scoped routes:
```
POST /v1/projects/:projectId/[chatbots/:chatbotId/]recipes ?on_conflict=fail|replace
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes ?target_app=
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/:name
DELETE /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/:name
GET /v1/projects/:projectId/[chatbots/:chatbotId/]recipes/describe
```
Field translation
Test plan
🤖 Generated with Claude Code