feat: agent-mesh v-next — pluggable classifier, persistence + metadata passthrough (+ audit fix)#37
Merged
Merged
Conversation
…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>
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.
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
feat(classifier): pluggableClassifierProvider— inject any intent classifier (self-hosted / different provider / host-resolved model) instead of hard-wired Gemini.Gemini/Mockimplement the interface;ClassifierServicetakes an optional provider;createClassifier(). Default (no provider) = Gemini→mock, unchanged.feat(session,utils): pluggableSessionStore+BreakerStore— persistence behind interfaces; Firestore refactored into the default impl;InMemory*adapters added; injection viasetSessionStore/setBreakerStore. Public service/module functions unchanged. (Postgres/Redis adapters land in follow-ups.)feat(core): optionalmetadatapassthrough on request/context/session — lets a host carry its own identifiers (e.g. multi-tenantorgId) without the HR-specificemployee_id. Fuller de-HR-ification deferred to a later major.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/loadpnpm build✅ ·pnpm audit --audit-level highnow exits 0 (was 7 highs)Remaining v-next work (separate PRs)
SessionStore/BreakerStoreadapters (leader election via Redis lock / pg advisory lock)AgentConfig.type: 'mcp' | 'inprocess')🤖 Generated with Claude Code