Skip to content

feat(agentic-server): make canonical package the OpenAI-compatible gateway - #1568

Merged
pyramation merged 1 commit into
mainfrom
feat/agentic-server-gateway-consolidation
Jul 31, 2026
Merged

feat(agentic-server): make canonical package the OpenAI-compatible gateway#1568
pyramation merged 1 commit into
mainfrom
feat/agentic-server-gateway-consolidation

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Part of the agentic-server de-duplication in constructive-planning#1337: there are two divergent agentic-server implementations (this repo's published threads service vs. constructive-db's private OpenAI-compatible gateway). This makes the published agentic-server the one source of truth = the gateway, and relocates the legacy threads surface into graphql/server so nothing deployed breaks.

Two moves, no behavior loss:

1. agentic-server becomes 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:

export interface InferenceSink {
  logInference(entry: InferenceEntry): void; // fire-and-forget; must not throw
}

createAgenticServer({ providerType, providerBaseUrl, inferenceSink });

So the gateway carries none of constructive-db's compute_log/ModuleLoader/pg code — a future constructive-db change injects createComputeLogSink(pool, platformDatabaseId) and deletes its private fork. X-Database-Id is required (400 otherwise); isPublic strips 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/server unchanged.
graphql/server was 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 to graphql/server/src/agentic/ and mounted locally:

- import { createAgenticRouter } from 'agentic-server';
+ import { createAgenticRouter } from './agentic';

graphql/server drops the agentic-server dependency 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.
  • No remaining importers of the old agentic-server package (grep-verified across repo).

Publish

This bundles the canonical agentic-server package 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

…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
@pyramation pyramation self-assigned this Jul 31, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit d0ff78d into main Jul 31, 2026
16 checks passed
@pyramation
pyramation deleted the feat/agentic-server-gateway-consolidation branch July 31, 2026 22:38
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