feat(agentic-server): make canonical package the OpenAI-compatible gateway - #1568
Merged
Merged
Conversation
…teway Consolidate the two divergent agentic-server implementations into one source of truth. The published agentic-server becomes the stateless OpenAI-compatible gateway (ported from constructive-db) with backend- agnostic metering via an injected InferenceSink — it no longer imports any concrete telemetry/billing backend. The legacy stateful threads router (createAgenticRouter, express-context auth) is relocated into graphql/server as server-internal code so the deployed /v1/threads and /v1/embed surface is preserved unchanged. - agentic-server: gateway router/providers/transforms/server + types; exports createAgenticServer, createRouter, InferenceSink/InferenceEntry - graphql/server: local src/agentic threads router; server mounts it - deps: drop agentic-server dep from graphql/server, add the threads router's deps (@agentic-kit/ollama, llm-env); gateway keeps only logger
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Part of the
agentic-serverde-duplication in constructive-planning#1337: there are two divergentagentic-serverimplementations (this repo's published threads service vs. constructive-db's private OpenAI-compatible gateway). This makes the publishedagentic-serverthe one source of truth = the gateway, and relocates the legacy threads surface intographql/serverso nothing deployed breaks.Two moves, no behavior loss:
1.
agentic-serverbecomes the gateway (ported from constructive-db).Stateless multi-provider proxy (
/v1/chat/completions,/v1/embeddings,/v1/usage,/v1/providers,/healthz) with provider resolution + request/response transforms for OpenAI / Anthropic / Ollama. Crucially it is backend-agnostic — metering is injected, the package imports no concrete telemetry/billing backend:So the gateway carries none of constructive-db's
compute_log/ModuleLoader/pgcode — a future constructive-db change injectscreateComputeLogSink(pool, platformDatabaseId)and deletes its private fork.X-Database-Idis required (400 otherwise);isPublicstrips identity headers so untrusted requests fail loud rather than being mis-attributed. Package deps shrink to just@pgpmjs/logger.2. The legacy threads router moves into
graphql/serverunchanged.graphql/serverwas the only consumer of the old published package (dashboard / diligence-app-demo don't use it — verified). Rather than delete/v1/threads+/v1/embed, the router (express-context auth, billing, thread persistence, SSE) is relocated verbatim tographql/server/src/agentic/and mounted locally:graphql/serverdrops theagentic-serverdependency and picks up the threads router's own deps (@agentic-kit/ollama,@constructive-io/llm-env). The relocated router and its test are byte-identical to the originals (only the test's import path changed).Verification
agentic/agentic-server:pnpm build+pnpm test→ gateway suite 10/10 pass.graphql/server: relocated threads suite 20/20 pass; lint clean.agentic-serverpackage (grep-verified across repo).Publish
This bundles the canonical
agentic-serverpackage version to publish once merged; the follow-up constructive-db PR will then consume the published dep and delete its private fork.Link to Devin session: https://app.devin.ai/sessions/9d694c4be37a41719809d7e740343fc6
Requested by: @pyramation