fix(plugins): swap speculative Remote backends for real ActivepiecesMemoryBackend - #36
Merged
Merged
Conversation
…emoryBackend PR #35 shipped Remote{Memory,Recipe}Backend classes that targeted REST endpoints we never built — pure stubs. They were marked "v1 proposal" in their headers, which is the kind of speculative interface we don't want in production code. This PR removes the stubs and replaces them with a REAL ActivepiecesMemoryBackend that hits live endpoints in the user's Activepieces deployment: /v1/projects/:projectId/memory (project-scoped) /v1/projects/:projectId/chatbots/:chatbotId/memory (chatbot-scoped) /v1/projects/:projectId/chatbots/:chatbotId/memory/search (hybrid search) Auth: `Authorization: Bearer sk-<api-key>` against the existing Activepieces Service-principal flow. The same Claude Code / Cursor / Codex agent connecting to agentmark now writes to **real Activepieces memory** instead of a speculative service — and gets hybrid vector + BM25 semantic search for free since agentmark_memory_search routes to /memory/search. Mapping (agentmark K/V → Activepieces rich shape): - agentmark `key` → metadata.agentmark_key - agentmark `value` → content + metadata.raw_value (preserves type) - agentmark `scope` → Activepieces scope (same five-level enum) - agentmark `scope.id` → metadata.scope_id - agentmark `tags` → metadata.tags - source stamp = "agentmark" (filterable; backends only see records they wrote) Recipes: NO ActivepiecesRecipeBackend ships in this PR because Activepieces has no recipes endpoints yet. RecipeBackend interface + LocalFileRecipeBackend remain; when the recipes service ships, a real implementation lands then. Removed (the stubs): - src/plugins/memory/remote-backend.ts - src/plugins/recipes/remote-backend.ts - test/memory/remote-backend.test.ts - test/recipes/remote-backend.test.ts Added: - src/plugins/memory/activepieces-backend.ts (real impl) - test/memory/activepieces-backend.test.ts (20 tests) Tests: 491 pass / 10 skip. Build clean. All prior tests pass unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 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
PR #35 shipped `RemoteMemoryBackend` + `RemoteRecipeBackend` against a REST contract we never built. They were marked "v1 proposal" — pure stubs. This PR removes them and replaces with a real production-ready `ActivepiecesMemoryBackend` that hits live endpoints.
What changes
Removed (stubs):
Added (real):
What ActivepiecesMemoryBackend does
Mapping
Recipes
NO `ActivepiecesRecipeBackend` ships in this PR. Activepieces has no recipes endpoints yet; we don't ship a stub. The `RecipeBackend` interface + `LocalFileRecipeBackend` remain — when the service ships, the real backend lands then.
Usage (post-merge)
```ts
import { createMemoryPlugin, ActivepiecesMemoryBackend } from '@thinkfleet/agentmark'
const memory = createMemoryPlugin({
backend: new ActivepiecesMemoryBackend({
baseUrl: 'https://app.thinkfleet.ai',
apiKey: process.env.AP_API_KEY, // sk-...
projectId: process.env.AP_PROJECT_ID,
chatbotId: process.env.AP_CHATBOT_ID, // optional
}),
})
```
Test plan
🤖 Generated with Claude Code