feat: agent-mesh v-next pt.2 — in-process transport + Postgres/Redis adapters#39
Merged
Merged
Conversation
…tConfig
Add an in-process dispatch path so an embedding host can run agents as local
handlers (no HTTP hop), and resolve the AgentConfig drift.
- core: `AgentConfigSchema.type` is now `enum(['mcp','inprocess']).default('mcp')`
and `endpoint` is optional, required (via refine) only for mcp agents.
- **Redundancy fix:** AgentConfig was defined twice (core + registry). It now lives
once in core (with the SSRF-safe endpoint check, moved from registry); the registry
package re-exports it and keeps only the AgentRegistry array schema + invariants.
- router: new `InProcessTransport` (registerInProcessAgent / dispatchInProcess).
`dispatchToAgent` routes by `agent.type` — in-process handler vs pooled MCP client —
and threads optional `metadata` (e.g. tenant `orgId`) into the ContextPacket so the
handler can resolve per-call deps. mcp.client guards the now-optional endpoint.
Backward compatible: existing `type: 'mcp'` agents (with endpoint) validate and
dispatch exactly as before.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ges) Two backend adapters implementing the pluggable persistence interfaces, so agent-mesh runs on Postgres/Redis instead of Firestore. - @reaatech/agent-mesh-postgres — PostgresSessionStore + PostgresBreakerStore (+ ensureSchema / SCHEMA_SQL). Leader election via a single-row lease table with SELECT … FOR UPDATE. `pg` is a peer dependency. - @reaatech/agent-mesh-redis — RedisSessionStore + RedisBreakerStore. Leader election via a SET NX PX lease. `ioredis` is a peer dependency. Injected via `setSessionStore` / `setBreakerStore`. Unit-tested against in-memory/mock clients (SQL issuance + row mapping + session lifecycle + leader election); a live-DB smoke test is noted in each README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… + adapters Update README (features + packages), ARCHITECTURE (pluggable providers), the orchestrator example (extending: inject classifier/store, register in-process agent), and package READMEs. Add a changeset for the v-next part-2 changes. Co-Authored-By: Claude Opus 4.8 <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.
Completes the agent-mesh v-next set (part 2). All additive and backward-compatible.
Changes
feat(router,core): in-process transport + consolidateAgentConfig. Agents can be dispatched in-process (type: 'inprocess', no HTTP hop) viaregisterInProcessAgent, alongside the MCP transport;dispatchToAgentroutes byagent.typeand threads an optionalmetadatapassthrough (e.g. a tenantorgId) into theContextPacket. Redundancy fix:AgentConfigwas defined twice (core + registry) — it now lives once in core (with the SSRF-safe endpoint check) and the registry re-exports it;typeisenum(['mcp','inprocess']),endpointoptional (required for mcp via refine).feat(postgres,redis): new store adapter packages.@reaatech/agent-mesh-postgresand@reaatech/agent-mesh-redisimplementSessionStore+BreakerStore(leader election via aSELECT … FOR UPDATElease /SET NX PXlease respectively), injected withsetSessionStore/setBreakerStore.docs: README (features + packages), ARCHITECTURE (pluggable providers), the orchestrator example (extending: inject classifier/store, register in-process agent), and package READMEs.Backward compatibility
Existing
type: 'mcp'agents (with endpoint) validate and dispatch exactly as before; Firestore/Gemini defaults unchanged. Semver: core/router minor, new adapters initial release.Verification (full monorepo, reproducing CI)
pnpm typecheck✅ ·pnpm lint✅ ·biome format✅ ·pnpm build✅pnpm test(turbo, all packages) ✅ — incl. in-process dispatch test, and the adapters unit-tested against in-memory/mock clients (session lifecycle, breaker persist/load, leader election, SQL issuance + row mapping)pnpm audit --audit-level high✅The two new packages (
-postgres,-redis) are unit-tested against fakes only — please run a live-DB smoke test (jsonb /FOR UPDATE/ timestamptz / multi-instance leader election) before relying on them in production. Each README says so. First npm publish of a new scoped package may need a manualnpm publish --access publicif the automated changesets publish 404s.🤖 Generated with Claude Code