Skip to content

feat: agent-mesh v-next — pluggable classifier, persistence + metadata passthrough (+ audit fix)#37

Merged
reaatech merged 5 commits into
mainfrom
feat/classifier-provider
Jul 2, 2026
Merged

feat: agent-mesh v-next — pluggable classifier, persistence + metadata passthrough (+ audit fix)#37
reaatech merged 5 commits into
mainfrom
feat/classifier-provider

Conversation

@reaatech

@reaatech reaatech commented Jul 2, 2026

Copy link
Copy Markdown
Owner

The agent-mesh v-next groundwork: make the orchestrator provider-agnostic, backend-agnostic, and host-embeddable — additive, backward-compatible changes so an existing GCP+Gemini+Firestore deployment upgrades with no config change. Also fixes the pre-existing Security Audit CI failure.

Commits

  1. feat(classifier): pluggable ClassifierProvider — inject any intent classifier (self-hosted / different provider / host-resolved model) instead of hard-wired Gemini. Gemini/Mock implement the interface; ClassifierService takes an optional provider; createClassifier(). Default (no provider) = Gemini→mock, unchanged.
  2. feat(session,utils): pluggable SessionStore + BreakerStore — persistence behind interfaces; Firestore refactored into the default impl; InMemory* adapters added; injection via setSessionStore/setBreakerStore. Public service/module functions unchanged. (Postgres/Redis adapters land in follow-ups.)
  3. feat(core): optional metadata passthrough on request/context/session — lets a host carry its own identifiers (e.g. multi-tenant orgId) without the HR-specific employee_id. Fuller de-HR-ification deferred to a later major.
  4. chore(deps): resolve high-severity audit advisories — the only failing check on the original PR was Security Audit (7 pre-existing transitive highs, failing every PR). Overrides bumped to patched versions; vite (a peer-only edge overrides can't touch) pinned as a direct devDep >=8.0.16.

Backward compatibility

Every change is additive with the old default (Gemini / Firestore / no metadata). Semver: minor for classifier/session/utils/core.

Verification (full monorepo, reproducing CI locally)

  • pnpm typecheck ✅ · pnpm lint (biome) ✅ · biome format
  • pnpm test (turbo, all packages) ✅ — incl. new tests: injected classifier path, in-memory SessionStore lifecycle, in-memory BreakerStore persist/load
  • pnpm build ✅ · pnpm audit --audit-level high now exits 0 (was 7 highs)

Remaining v-next work (separate PRs)

  • Postgres + Redis SessionStore/BreakerStore adapters (leader election via Redis lock / pg advisory lock)
  • Embeddable orchestrator factory + in-process transport (AgentConfig.type: 'mcp' | 'inprocess')

🤖 Generated with Claude Code

reaatech and others added 4 commits July 2, 2026 15:50
…ssifier)

Extract a `ClassifierProvider` interface so hosts can supply an alternative to
the built-in Gemini classifier — a self-hosted model, a different provider, or
a host-resolved model (letting the embedding app own the inference call).

- New `ClassifierProvider` interface (classifier package — kept out of core to
  avoid a core→registry cycle, since it references `AgentRegistry`).
- `GeminiClassifier` and `MockClassifier` now `implements ClassifierProvider`.
- `ClassifierService` accepts an optional injected provider; add `createClassifier()`.
  An injected provider is the primary; the mock remains the on-error fallback and
  is used regardless of NODE_ENV (so it is testable).
- Fully backward compatible: no provider → Gemini in normal runs (mock fallback),
  mock under NODE_ENV=test — unchanged. Additive minor.
- Tests: injected provider is used; default (no provider) still routes via mock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ce seam)

Extract persistence behind interfaces so the Firestore coupling in the session
service and circuit-breaker sync becomes swappable (Postgres/Redis adapters land
next, per the v-next plan). Firestore remains the default — no behaviour change.

core:
- New `SessionStore`, `BreakerStore`, `LeaderState` interfaces (only reference core
  types, so no cycle).

session:
- `FirestoreSessionStore` (moves the existing Firestore code) + `InMemorySessionStore`
  + `setSessionStore`/`getSessionStore`/`resetSessionStore` injection. The exported
  service functions (createSession/getActiveSession/appendTurn/…) now delegate to the
  active store; signatures unchanged.
- `publishSessionEvent` skips PubSub under NODE_ENV=test (mirrors the classifier's
  Gemini guard), so the seam is testable without GCP credentials. Prod unchanged.

utils:
- `FirestoreBreakerStore` (persist/load/loadAll + Firestore-transaction leader
  election) + `InMemoryBreakerStore` (single-instance = always leader) + injection.
  `circuitBreaker.persistence` now delegates to the active store; public API unchanged.

Tests: injected InMemory backends drive the full session lifecycle and breaker
persist/load through the public functions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an optional `metadata` record to IncomingRequestSchema, ContextPacketSchema,
and SessionRecordSchema. agent-mesh does not interpret it — it lets an embedding
host carry its own identifiers (e.g. a multi-tenant `orgId`) through to agents
without the HR-specific `employee_id`. Additive and optional; the Firestore
session mapper round-trips it. Fuller de-HR-ification (making employee_id
optional, moving Slack out of core) is deferred to a later major.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`pnpm audit --audit-level high` (the Security Audit CI job) was failing on seven
high-severity advisories in transitive deps — pre-existing, unrelated to feature
code, failing on every PR. The existing `pnpm.overrides` had stale versions
(hono >=4.12.18 < the required 4.12.25) and were incomplete.

- Bump overrides to patched versions: hono >=4.12.25, protobufjs >=8.4.1,
  @grpc/grpc-js >=1.14.4, ws >=8.21.0, form-data >=4.0.6 (keep fast-uri, ip-address).
- vite is a peer-only edge (via vitest), which `overrides` can't bump, so pin it as
  a direct devDependency `>=8.0.16` (resolves 8.1.3; satisfies vitest's ^8.0.0 peer).

`pnpm audit --audit-level high` now exits 0 (0 high). Build + typecheck + all
package tests pass on vite 8.1.3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reaatech reaatech changed the title feat(classifier): pluggable ClassifierProvider (inject any intent classifier) feat: agent-mesh v-next — pluggable classifier, persistence + metadata passthrough (+ audit fix) Jul 2, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reaatech
reaatech merged commit 00427b3 into main Jul 2, 2026
@reaatech
reaatech deleted the feat/classifier-provider branch July 2, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant