feat: add billing/inferenceLog/agentChat module loaders + wire into agentic-server#1219
Merged
Conversation
…gentic-server - Add three module loaders to express-context/src/loaders/: - billing.ts: resolves BillingConfig (schema, record_usage, check_quota functions) - inference-log.ts: resolves InferenceLogConfig (schema, table name) - agent-chat.ts: resolves AgentChatConfig (thread/message/task table names) - Register loaders in createDefaultRegistry() and export from express-context - Add BillingConfig, InferenceLogConfig, AgentChatConfig to BuiltinModuleMap - Update agentic-server router to use ctx.useModule() instead of getAgentDiscovery/getDatabaseConfig - Update agentic-server billing.ts to import types from express-context - Fix and update router tests to mock useModule instead of pool.query for discovery - Add supertest as dev dependency for proper HTTP testing
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
Adds three module loaders to
express-contextand wires them intoagentic-server, replacing the package's internal discovery queries with the shareduseModule()pattern.express-context loaders added:
billing— resolvesBillingConfig(public/private schema,record_usage,check_billing_quotafunctions) frommetaschema_modules_public.billing_moduleinferenceLog— resolvesInferenceLogConfig(schema, table name) frommetaschema_modules_public.inference_log_moduleagentChat— resolvesAgentChatConfig(thread/message/task table names) frommetaschema_modules_public.agent_chat_moduleAll three are registered in
createDefaultRegistry()and exported from the package index.BuiltinModuleMapis updated for type-safeuseModule()calls.agentic-server changes:
ctx.useModule('agentChat')instead ofgetAgentDiscovery(ctx.pool, ctx.api.dbname)ctx.useModule('billing')+ctx.useModule('inferenceLog')instead ofgetDatabaseConfig(ctx.pool, ctx.databaseId)billing.tsimports types from@constructive-io/express-contextinstead of local./discoverydiscovery.tsmodule remains exported as public API (backwards compat) but is no longer used internally by the routerTests:
useModuleinstead ofpool.queryfor discoverysupertest+@types/supertestfor proper HTTP assertionsReview & Testing Checklist for Human
metaschema_modules_publictable schemas (billing_module, inference_log_module, agent_chat_module)checkBillingQuotaFunctionhardcoded value'check_billing_quota'is correct for all deployments (or should come from the module row)req.constructive.useModule('billing')etc.Notes
discovery.tsmodule in agentic-server is still exported but no longer used internally. It can be deprecated/removed in a follow-up.Link to Devin session: https://app.devin.ai/sessions/2b5a29d83d3f478e8d3d972653b4879c
Requested by: @pyramation