@axiom-lattice/gateway 2.1.34 → 2.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,7 @@ import { registerSandboxProxyRoutes } from "../controllers/sandbox";
32
32
  import { registerWorkspaceRoutes } from "../controllers/workspace";
33
33
  import { registerDatabaseConfigRoutes } from "../controllers/database-configs";
34
34
  import { registerMetricsServerConfigRoutes } from "../controllers/metrics-configs";
35
+ import { registerMcpServerConfigRoutes } from "../controllers/mcp-configs";
35
36
  import { registerUserRoutes } from "../controllers/users";
36
37
  import { registerTenantRoutes } from "../controllers/tenants";
37
38
  import { registerAuthRoutes } from "../controllers/auth";
@@ -306,6 +307,8 @@ export const registerLatticeRoutes = (app: FastifyInstance): void => {
306
307
 
307
308
  registerMetricsServerConfigRoutes(app);
308
309
 
310
+ registerMcpServerConfigRoutes(app);
311
+
309
312
  registerUserRoutes(app);
310
313
 
311
314
  registerTenantRoutes(app);
@@ -18,39 +18,6 @@ import {
18
18
  hasChunkBuffer,
19
19
  } from "@axiom-lattice/core";
20
20
 
21
- interface DatabaseConfigEntry {
22
- key: string;
23
- name?: string;
24
- description?: string;
25
- }
26
-
27
- async function fetchDatabaseConfigs(baseURL: string, apiKey?: string, tenantId?: string): Promise<DatabaseConfigEntry[]> {
28
- try {
29
- const headers: Record<string, string> = {};
30
- if (apiKey) {
31
- headers["Authorization"] = `Bearer ${apiKey}`;
32
- }
33
- if (tenantId) {
34
- headers["x-tenant-id"] = tenantId;
35
- }
36
-
37
- const response = await fetch(`${baseURL}/api/database-configs`, { headers });
38
- if (response.ok) {
39
- const data: any = await response.json();
40
- if (data.success && data.data && Array.isArray(data.data.records)) {
41
- return data.data.records.map((record: any) => ({
42
- key: record.key,
43
- name: record.name,
44
- description: record.description,
45
- }));
46
- }
47
- }
48
- } catch (error) {
49
- console.error("Failed to fetch database configs:", error);
50
- }
51
- return [];
52
- }
53
-
54
21
  /**
55
22
  * Get or create the global ChunkBuffer instance
56
23
  */
@@ -96,16 +63,6 @@ export async function agent_invoke({
96
63
  throw new Error(`Agent ${assistant_id} not found`);
97
64
  }
98
65
 
99
- // Fetch database configs and set to global for middleware to access
100
- const { configService } = await import("../config.js");
101
- const gatewayConfig = configService.getConfig();
102
- const databaseConfigs = await fetchDatabaseConfigs(
103
- gatewayConfig.baseURL || "http://localhost:4001",
104
- undefined,
105
- tenant_id
106
- );
107
- (global as any).__DATABASE_CONFIGS__ = databaseConfigs;
108
-
109
66
  // Get runConfig from agent config and merge with custom_run_config
110
67
  const runConfig = {
111
68
  ...agentLattice?.config?.runConfig || {},
@@ -179,16 +136,6 @@ export async function agent_stream({
179
136
  // Get ChunkBuffer instance
180
137
  const chunkBuffer = getOrCreateChunkBuffer();
181
138
 
182
- // Fetch database configs and set to global for middleware to access
183
- const { configService } = await import("../config.js");
184
- const gatewayConfig = configService.getConfig();
185
- const databaseConfigs = await fetchDatabaseConfigs(
186
- gatewayConfig.baseURL || "http://localhost:4001",
187
- undefined,
188
- tenant_id
189
- );
190
- (global as any).__DATABASE_CONFIGS__ = databaseConfigs;
191
-
192
139
  // Get runConfig from agent config and merge with custom_run_config
193
140
  const runConfig = {
194
141
  ...agentLattice?.config?.runConfig || {},
@@ -1,94 +0,0 @@
1
- // src/config.ts
2
- var ConfigService = class {
3
- constructor() {
4
- this.config = this.loadFromEnv();
5
- }
6
- /**
7
- * Load configuration from environment variables
8
- */
9
- loadFromEnv() {
10
- return {
11
- port: process.env.PORT ? Number(process.env.PORT) : void 0,
12
- queueServiceType: process.env.QUEUE_SERVICE_TYPE,
13
- redisUrl: process.env.REDIS_URL,
14
- redisPassword: process.env.REDIS_PASSWORD,
15
- queueName: process.env.QUEUE_NAME
16
- };
17
- }
18
- /**
19
- * Update configuration from JSON object
20
- * This will update both the internal config and process.env
21
- */
22
- updateConfig(jsonConfig) {
23
- for (const [key, value] of Object.entries(jsonConfig)) {
24
- if (value !== null && value !== void 0) {
25
- if (typeof value === "object" && !Array.isArray(value)) {
26
- for (const [nestedKey, nestedValue] of Object.entries(value)) {
27
- const envKey = `${key.toUpperCase()}_${nestedKey.toUpperCase()}`;
28
- process.env[envKey] = String(nestedValue);
29
- }
30
- } else {
31
- process.env[key.toUpperCase()] = String(value);
32
- }
33
- }
34
- }
35
- this.config = this.loadFromEnv();
36
- this.config = this.deepMerge(this.config, jsonConfig);
37
- }
38
- /**
39
- * Deep merge two objects
40
- */
41
- deepMerge(target, source) {
42
- const output = { ...target };
43
- if (this.isObject(target) && this.isObject(source)) {
44
- Object.keys(source).forEach((key) => {
45
- if (this.isObject(source[key])) {
46
- if (!(key in target)) {
47
- Object.assign(output, { [key]: source[key] });
48
- } else {
49
- output[key] = this.deepMerge(target[key], source[key]);
50
- }
51
- } else {
52
- Object.assign(output, { [key]: source[key] });
53
- }
54
- });
55
- }
56
- return output;
57
- }
58
- /**
59
- * Check if value is a plain object
60
- */
61
- isObject(item) {
62
- return item && typeof item === "object" && !Array.isArray(item);
63
- }
64
- /**
65
- * Get current configuration
66
- */
67
- getConfig() {
68
- return { ...this.config };
69
- }
70
- };
71
- var configService = new ConfigService();
72
- var config = {
73
- get port() {
74
- return configService.getConfig().port;
75
- },
76
- get queueServiceType() {
77
- return configService.getConfig().queueServiceType;
78
- },
79
- get redisUrl() {
80
- return configService.getConfig().redisUrl;
81
- },
82
- get redisPassword() {
83
- return configService.getConfig().redisPassword;
84
- },
85
- get queueName() {
86
- return configService.getConfig().queueName;
87
- }
88
- };
89
-
90
- export {
91
- configService,
92
- config
93
- };
94
- //# sourceMappingURL=chunk-FSASG3SB.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config.ts"],"sourcesContent":["/**\n * Configuration service\n * Manages environment variables and supports dynamic updates\n */\n\nexport interface GatewayConfig {\n port?: number;\n queueServiceType?: string;\n redisUrl?: string;\n redisPassword?: string;\n queueName?: string;\n [key: string]: any; // Allow additional config keys\n}\n\n/**\n * Get configuration from environment variables\n * Supports dynamic updates via updateConfig method\n */\nclass ConfigService {\n private config: GatewayConfig;\n\n constructor() {\n this.config = this.loadFromEnv();\n }\n\n /**\n * Load configuration from environment variables\n */\n private loadFromEnv(): GatewayConfig {\n return {\n port: process.env.PORT ? Number(process.env.PORT) : undefined,\n queueServiceType: process.env.QUEUE_SERVICE_TYPE,\n redisUrl: process.env.REDIS_URL,\n redisPassword: process.env.REDIS_PASSWORD,\n queueName: process.env.QUEUE_NAME,\n };\n }\n\n /**\n * Update configuration from JSON object\n * This will update both the internal config and process.env\n */\n updateConfig(jsonConfig: Record<string, any>): void {\n // Update process.env for all provided keys\n for (const [key, value] of Object.entries(jsonConfig)) {\n if (value !== null && value !== undefined) {\n // Convert nested objects to environment variable format\n if (typeof value === \"object\" && !Array.isArray(value)) {\n // Handle nested objects like supabase: { url: \"...\", key: \"...\" }\n for (const [nestedKey, nestedValue] of Object.entries(value)) {\n const envKey = `${key.toUpperCase()}_${nestedKey.toUpperCase()}`;\n process.env[envKey] = String(nestedValue);\n }\n } else {\n // Handle flat keys\n process.env[key.toUpperCase()] = String(value);\n }\n }\n }\n\n // Reload config from updated environment variables\n this.config = this.loadFromEnv();\n\n // Deep merge the JSON config into our config object\n this.config = this.deepMerge(this.config, jsonConfig);\n }\n\n /**\n * Deep merge two objects\n */\n private deepMerge(target: any, source: any): any {\n const output = { ...target };\n if (this.isObject(target) && this.isObject(source)) {\n Object.keys(source).forEach((key) => {\n if (this.isObject(source[key])) {\n if (!(key in target)) {\n Object.assign(output, { [key]: source[key] });\n } else {\n output[key] = this.deepMerge(target[key], source[key]);\n }\n } else {\n Object.assign(output, { [key]: source[key] });\n }\n });\n }\n return output;\n }\n\n /**\n * Check if value is a plain object\n */\n private isObject(item: any): boolean {\n return item && typeof item === \"object\" && !Array.isArray(item);\n }\n\n /**\n * Get current configuration\n */\n getConfig(): GatewayConfig {\n return { ...this.config };\n }\n}\n\n// Export singleton instance\nexport const configService = new ConfigService();\n\n// Export config getter for backward compatibility\nexport const config = {\n get port() {\n return configService.getConfig().port;\n },\n get queueServiceType() {\n return configService.getConfig().queueServiceType;\n },\n get redisUrl() {\n return configService.getConfig().redisUrl;\n },\n get redisPassword() {\n return configService.getConfig().redisPassword;\n },\n get queueName() {\n return configService.getConfig().queueName;\n },\n};\n"],"mappings":";AAkBA,IAAM,gBAAN,MAAoB;AAAA,EAGlB,cAAc;AACZ,SAAK,SAAS,KAAK,YAAY;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKQ,cAA6B;AACnC,WAAO;AAAA,MACL,MAAM,QAAQ,IAAI,OAAO,OAAO,QAAQ,IAAI,IAAI,IAAI;AAAA,MACpD,kBAAkB,QAAQ,IAAI;AAAA,MAC9B,UAAU,QAAQ,IAAI;AAAA,MACtB,eAAe,QAAQ,IAAI;AAAA,MAC3B,WAAW,QAAQ,IAAI;AAAA,IACzB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,YAAuC;AAElD,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,UAAU,GAAG;AACrD,UAAI,UAAU,QAAQ,UAAU,QAAW;AAEzC,YAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;AAEtD,qBAAW,CAAC,WAAW,WAAW,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC5D,kBAAM,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,UAAU,YAAY,CAAC;AAC9D,oBAAQ,IAAI,MAAM,IAAI,OAAO,WAAW;AAAA,UAC1C;AAAA,QACF,OAAO;AAEL,kBAAQ,IAAI,IAAI,YAAY,CAAC,IAAI,OAAO,KAAK;AAAA,QAC/C;AAAA,MACF;AAAA,IACF;AAGA,SAAK,SAAS,KAAK,YAAY;AAG/B,SAAK,SAAS,KAAK,UAAU,KAAK,QAAQ,UAAU;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA,EAKQ,UAAU,QAAa,QAAkB;AAC/C,UAAM,SAAS,EAAE,GAAG,OAAO;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MappingURL=config-F3FCBSPH.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}