neural-loom 0.2.49 → 0.2.51
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/cache/.previewinfo +1 -1
- package/.next/cache/.rscinfo +1 -1
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/diagnostics/route-bundle-stats.json +2 -2
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/context/aider/route.js.nft.json +1 -1
- package/.next/server/app/api/context/claude/route.js.nft.json +1 -1
- package/.next/server/app/api/context/route.js.nft.json +1 -1
- package/.next/server/app/api/context/ssh/route.js.nft.json +1 -1
- package/.next/server/app/api/recents/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/inject/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/input/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/launch/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/scope/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/start/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/stop/route.js.nft.json +1 -1
- package/.next/server/app/api/sql/connections/route.js.nft.json +1 -1
- package/.next/server/app/api/sql/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/sql/query/route.js.nft.json +1 -1
- package/.next/server/app/api/sql/schema/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0.ptwor._.js +49 -9
- package/.next/server/chunks/[root-of-the-server]__0.ptwor._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__00l5btc._.js +49 -9
- package/.next/server/chunks/[root-of-the-server]__00l5btc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__06men8g._.js +41 -1
- package/.next/server/chunks/[root-of-the-server]__06men8g._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0co.g5k._.js +41 -1
- package/.next/server/chunks/[root-of-the-server]__0co.g5k._.js.map +1 -1
- package/.next/server/chunks/ssr/_0t7oqy6._.js +6 -1
- package/.next/server/chunks/ssr/_0t7oqy6._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0bb9anc7wd3_e.js +6 -0
- package/.next/static/chunks/0p28yw2f2duy-.js +1 -0
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/src/app/components/DbExplorer.tsx +28 -13
- package/src/app/page.tsx +9 -0
- package/src/lib/sql/ConnectionManager.ts +4 -1
- package/src/lib/sql/adapters/MssqlAdapter.ts +151 -0
- package/.next/static/chunks/03f4bqk_d65hs.js +0 -6
- package/.next/static/chunks/0~6gm~u8rgtpd.js +0 -1
- /package/.next/static/{BoncS4SNz6CDpSdR8oY-K → iopRcvtUwbEGa5VOyZAQh}/_buildManifest.js +0 -0
- /package/.next/static/{BoncS4SNz6CDpSdR8oY-K → iopRcvtUwbEGa5VOyZAQh}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{BoncS4SNz6CDpSdR8oY-K → iopRcvtUwbEGa5VOyZAQh}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/config.ts","../../../src/lib/sql/ConnectionManager.ts","../../../src/lib/sql/DbAdapter.ts","../../../src/lib/sql/adapters/SqliteAdapter.ts","../../../src/lib/sql/adapters/PostgresAdapter.ts","../../../src/lib/sql/adapters/MysqlAdapter.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/sql/query/route.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport os from \"os\";\n\nlet cachedConfigDir: string | null = null;\n\nexport function getConfigDir(): string {\n if (cachedConfigDir) {\n return cachedConfigDir;\n }\n\n const primaryDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), \".ai\", \"neural-loom\");\n \n try {\n // Check if primary directory exists. If not, try to create it.\n if (!fs.existsSync(primaryDir)) {\n fs.mkdirSync(primaryDir, { recursive: true });\n }\n // Perform a test write to verify write permissions (crucial for read-only directories like C:\\Program Files)\n const testFile = path.join(primaryDir, \".write-test-\" + Math.random().toString(36).substring(7));\n fs.writeFileSync(testFile, \"test\");\n fs.unlinkSync(testFile);\n cachedConfigDir = primaryDir;\n return primaryDir;\n } catch (err) {\n // If EPERM or any other write error occurs, fall back to the user's home directory\n console.warn(`[Config] Primary config dir is not writable (${primaryDir}). Falling back to home directory.`);\n const fallbackDir = path.join(os.homedir(), \".ai\", \"neural-loom\");\n try {\n if (!fs.existsSync(fallbackDir)) {\n fs.mkdirSync(fallbackDir, { recursive: true });\n }\n cachedConfigDir = fallbackDir;\n return fallbackDir;\n } catch (fallbackErr) {\n console.error(\"[Config] Fallback config dir is also not writable!\", fallbackErr);\n cachedConfigDir = primaryDir;\n return primaryDir;\n }\n }\n}\n\nexport function isDirWritable(dir: string): boolean {\n try {\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n const testFile = path.join(dir, \".write-test-\" + Math.random().toString(36).substring(7));\n fs.writeFileSync(testFile, \"test\");\n fs.unlinkSync(testFile);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isSystemDirectory(dir: string): boolean {\n const normalized = dir.toLowerCase().replace(/\\\\/g, \"/\");\n return (\n normalized.includes(\"/program files\") ||\n normalized.includes(\"/windows/system32\") ||\n normalized.includes(\"/winnt\") ||\n normalized.startsWith(\"/usr/\") ||\n normalized.startsWith(\"/bin/\") ||\n normalized.startsWith(\"/sbin/\") ||\n normalized.startsWith(\"/etc/\") ||\n normalized.startsWith(\"/var/\")\n );\n}\n\nexport function getDefaultWorkspaceRoot(): string {\n const launchDir = process.env.ORIGINAL_CWD || process.cwd();\n \n if (isDirWritable(launchDir) && !isSystemDirectory(launchDir)) {\n return launchDir.replace(/\\\\/g, \"/\");\n }\n \n const home = os.homedir();\n const commonDirs = [\n path.join(home, \"OneDrive\", \"Projects\"),\n path.join(home, \"Projects\"),\n path.join(home, \"source\", \"repos\"),\n path.join(home, \"Documents\"),\n home\n ];\n \n for (const dir of commonDirs) {\n try {\n if (fs.existsSync(dir) && isDirWritable(dir)) {\n return dir.replace(/\\\\/g, \"/\");\n }\n } catch {\n // Continue checking\n }\n }\n \n return home.replace(/\\\\/g, \"/\");\n}\n\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport fs from \"fs\";\nimport path from \"path\";\nimport { getConfigDir } from \"../config\";\nimport { DbAdapter } from \"./DbAdapter\";\nimport { SqliteAdapter } from \"./adapters/SqliteAdapter\";\nimport { PostgresAdapter } from \"./adapters/PostgresAdapter\";\nimport { MysqlAdapter } from \"./adapters/MysqlAdapter\";\n\nexport interface DbConnectionProfile {\n id: string;\n name: string;\n type: \"sqlite\" | \"postgres\" | \"mysql\";\n filepath?: string; // sqlite\n host?: string; // pg, mysql\n port?: number; // pg, mysql\n database?: string; // pg, mysql\n username?: string; // pg, mysql\n password?: string; // pg, mysql\n ssl?: boolean; // pg\n readOnly?: boolean;\n}\n\nexport interface SqlConfigSchema {\n connections: { [id: string]: DbConnectionProfile };\n activeConnection: string | null;\n}\n\nexport class ConnectionManager {\n private static activeInstances = new Map<string, DbAdapter>();\n\n private static getGlobalConfigPath(): string {\n return path.join(getConfigDir(), \"global-sql.json\");\n }\n\n private static getWorkspaceConfigPath(workspaceRoot?: string): string | null {\n if (!workspaceRoot) return null;\n return path.join(workspaceRoot, \".ai\", \"neural-loom\", \"sql-config.json\");\n }\n\n private static loadConfig(filePath: string): SqlConfigSchema {\n try {\n if (fs.existsSync(filePath)) {\n const content = fs.readFileSync(filePath, \"utf8\");\n return JSON.parse(content);\n }\n } catch (err) {\n console.error(`[ConnectionManager] Failed to load config from ${filePath}:`, err);\n }\n return { connections: {}, activeConnection: null };\n }\n\n private static saveConfig(filePath: string, config: SqlConfigSchema): void {\n try {\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n fs.writeFileSync(filePath, JSON.stringify(config, null, 2), \"utf8\");\n } catch (err) {\n console.error(`[ConnectionManager] Failed to save config to ${filePath}:`, err);\n }\n }\n\n public static async getProfiles(workspaceRoot?: string): Promise<{\n global: DbConnectionProfile[];\n workspace: DbConnectionProfile[];\n activeId: string | null;\n isActiveGlobal: boolean;\n }> {\n const globalConfig = this.loadConfig(this.getGlobalConfigPath());\n const globalProfiles = Object.values(globalConfig.connections);\n \n let workspaceProfiles: DbConnectionProfile[] = [];\n let activeId = globalConfig.activeConnection;\n let isActiveGlobal = true;\n\n if (workspaceRoot) {\n const wsConfigPath = this.getWorkspaceConfigPath(workspaceRoot);\n if (wsConfigPath) {\n const wsConfig = this.loadConfig(wsConfigPath);\n workspaceProfiles = Object.values(wsConfig.connections);\n if (wsConfig.activeConnection) {\n activeId = wsConfig.activeConnection;\n isActiveGlobal = false;\n }\n }\n }\n\n return {\n global: globalProfiles,\n workspace: workspaceProfiles,\n activeId,\n isActiveGlobal\n };\n }\n\n public static async saveProfile(\n profile: DbConnectionProfile,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for saving connection profile.\");\n }\n\n const config = this.loadConfig(filePath);\n config.connections[profile.id] = profile;\n this.saveConfig(filePath, config);\n }\n\n public static async deleteProfile(\n profileId: string,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for deleting connection profile.\");\n }\n\n const config = this.loadConfig(filePath);\n if (config.connections[profileId]) {\n delete config.connections[profileId];\n if (config.activeConnection === profileId) {\n config.activeConnection = null;\n }\n this.saveConfig(filePath, config);\n }\n\n // Close any active instance\n const cacheKey = `${isGlobal ? \"global\" : \"ws\"}:${profileId}`;\n const active = this.activeInstances.get(cacheKey);\n if (active) {\n await active.disconnect().catch(console.error);\n this.activeInstances.delete(cacheKey);\n }\n }\n\n public static async setActiveProfile(\n profileId: string | null,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for setting active profile.\");\n }\n\n const config = this.loadConfig(filePath);\n config.activeConnection = profileId;\n this.saveConfig(filePath, config);\n }\n\n public static createAdapter(profile: DbConnectionProfile, workspaceRoot?: string): DbAdapter {\n switch (profile.type) {\n case \"sqlite\":\n return new SqliteAdapter(profile, workspaceRoot);\n case \"postgres\":\n return new PostgresAdapter(profile);\n case \"mysql\":\n return new MysqlAdapter(profile);\n default:\n throw new Error(`Unsupported database type: ${(profile as any).type}`);\n }\n }\n\n public static async getActiveAdapter(workspaceRoot?: string): Promise<{ adapter: DbAdapter; profile: DbConnectionProfile } | null> {\n const { global, workspace, activeId, isActiveGlobal } = await this.getProfiles(workspaceRoot);\n if (!activeId) return null;\n\n const cacheKey = `${isActiveGlobal ? \"global\" : \"ws\"}:${activeId}`;\n const cached = this.activeInstances.get(cacheKey);\n if (cached) {\n // Find matching profile\n const list = isActiveGlobal ? global : workspace;\n const profile = list.find(p => p.id === activeId);\n if (profile) return { adapter: cached, profile };\n }\n\n // Load connection profile\n const list = isActiveGlobal ? global : workspace;\n const profile = list.find(p => p.id === activeId);\n if (!profile) return null;\n\n const adapter = this.createAdapter(profile, workspaceRoot);\n this.activeInstances.set(cacheKey, adapter);\n return { adapter, profile };\n }\n\n public static async closeAll(): Promise<void> {\n for (const [, instance] of this.activeInstances.entries()) {\n await instance.disconnect().catch(console.error);\n }\n this.activeInstances.clear();\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport interface TableSchema {\n name: string;\n type: string; // 'table' or 'view'\n}\n\nexport interface ColumnSchema {\n name: string;\n type: string;\n nullable: boolean;\n defaultValue?: string | null;\n isPrimaryKey: boolean;\n isForeignKey: boolean;\n referencedTable?: string | null;\n referencedColumn?: string | null;\n}\n\nexport interface QueryResult {\n rows: any[];\n fields?: string[];\n affectedRows?: number;\n}\n\nexport abstract class DbAdapter {\n protected config: any;\n\n constructor(config: any) {\n this.config = config;\n }\n\n abstract connect(): Promise<void>;\n abstract query(sql: string, params?: any[]): Promise<QueryResult>;\n abstract listTables(): Promise<TableSchema[]>;\n abstract describeTable(tableName: string): Promise<ColumnSchema[]>;\n abstract disconnect(): Promise<void>;\n\n async getSchemaSummary(): Promise<string> {\n try {\n const tables = await this.listTables();\n let summary = `### Database Schema Summary\\n\\n`;\n if (tables.length === 0) {\n return summary + \"*No tables found in this database.*\";\n }\n\n for (const t of tables) {\n summary += `#### Table: \\`${t.name}\\` (${t.type})\\n`;\n const columns = await this.describeTable(t.name);\n summary += `| Column | Type | Nullable | Key | References |\\n`;\n summary += `|---|---|---|---|---|\\n`;\n for (const col of columns) {\n const keyType = col.isPrimaryKey ? \"PK\" : col.isForeignKey ? \"FK\" : \"\";\n const ref = col.isForeignKey ? `\\`${col.referencedTable}.${col.referencedColumn}\\`` : \"\";\n summary += `| \\`${col.name}\\` | \\`${col.type}\\` | ${col.nullable ? \"Yes\" : \"No\"} | ${keyType} | ${ref} |\\n`;\n }\n summary += `\\n`;\n }\n return summary;\n } catch (err) {\n return `Failed to reflect schema summary: ${err instanceof Error ? err.message : String(err)}`;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport path from \"path\";\nimport fs from \"fs\";\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class SqliteAdapter extends DbAdapter {\n private db: any = null;\n private resolvedPath: string = \"\";\n\n constructor(config: any, workspaceRoot?: string) {\n super(config);\n const rawPath = config.filepath || \"dev.db\";\n // Resolve relative path against workspaceRoot or process CWD\n if (path.isAbsolute(rawPath)) {\n this.resolvedPath = rawPath.replace(/\\\\/g, \"/\");\n } else {\n const root = workspaceRoot || process.cwd();\n this.resolvedPath = path.resolve(root, rawPath).replace(/\\\\/g, \"/\");\n }\n }\n\n async connect(): Promise<void> {\n if (this.db) return;\n \n // Ensure parent directory exists\n const dir = path.dirname(this.resolvedPath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n try {\n // Lazy load better-sqlite3\n let Database;\n try {\n Database = require(\"better-sqlite3\");\n } catch (err) {\n throw new Error(\n \"SQLite driver 'better-sqlite3' is not installed. Please run `npm install better-sqlite3` in the neural-loom environment.\"\n );\n }\n\n this.db = new Database(this.resolvedPath);\n } catch (err: any) {\n console.error(\"[SqliteAdapter] Connect failed:\", err);\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const isSelect = sql.trim().toLowerCase().startsWith(\"select\") || \n sql.trim().toLowerCase().startsWith(\"pragma\") ||\n sql.trim().toLowerCase().startsWith(\"explain\");\n \n if (isSelect) {\n const rows = this.db.prepare(sql).all(params);\n const fields = rows.length > 0 ? Object.keys(rows[0]) : [];\n return { rows, fields };\n } else {\n const info = this.db.prepare(sql).run(params);\n return {\n rows: [],\n affectedRows: info.changes\n };\n }\n } catch (err: any) {\n console.error(\"[SqliteAdapter] Query execution failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%'`;\n const res = await this.query(sql);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"table\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n await this.connect();\n \n // Get table columns\n const columnsInfo = this.db.prepare(`PRAGMA table_info(\\`${tableName}\\`)`).all();\n // Get foreign keys\n const foreignKeys = this.db.prepare(`PRAGMA foreign_key_list(\\`${tableName}\\`)`).all();\n \n return columnsInfo.map((col: any) => {\n const fk = foreignKeys.find((f: any) => f.from === col.name);\n return {\n name: col.name,\n type: col.type || \"TEXT\",\n nullable: col.notnull === 0,\n defaultValue: col.dflt_value,\n isPrimaryKey: col.pk > 0,\n isForeignKey: !!fk,\n referencedTable: fk ? fk.table : null,\n referencedColumn: fk ? fk.to : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class PostgresAdapter extends DbAdapter {\n private client: any = null;\n private schema: string = \"public\";\n\n constructor(config: any) {\n super(config);\n this.schema = config.schema || \"public\";\n }\n\n async connect(): Promise<void> {\n if (this.client) return;\n\n try {\n let ClientClass;\n try {\n const pg = require(\"pg\");\n ClientClass = pg.Client;\n } catch (err) {\n throw new Error(\n \"PostgreSQL driver 'pg' is not installed. Please run `npm install pg` in the neural-loom environment.\"\n );\n }\n\n this.client = new ClientClass({\n host: this.config.host || \"localhost\",\n port: this.config.port || 5432,\n database: this.config.database || \"postgres\",\n user: this.config.username || \"postgres\",\n password: this.config.password || \"\",\n ssl: this.config.ssl ? this.config.ssl : undefined\n });\n\n await this.client.connect();\n } catch (err: any) {\n console.error(\"[PostgresAdapter] Connect failed:\", err);\n this.client = null;\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const res = await this.client.query(sql, params);\n const rows = res.rows || [];\n const fields = res.fields ? res.fields.map((f: any) => f.name) : [];\n return {\n rows,\n fields,\n affectedRows: res.rowCount !== null ? res.rowCount : undefined\n };\n } catch (err: any) {\n console.error(\"[PostgresAdapter] Query failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `\n SELECT table_name as name, table_type as type \n FROM information_schema.tables \n WHERE table_schema = $1 AND table_type IN ('BASE TABLE', 'VIEW')\n ORDER BY table_name\n `;\n const res = await this.query(sql, [this.schema]);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"BASE TABLE\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n const columnsSql = `\n SELECT \n c.column_name as name, \n c.data_type as type, \n c.is_nullable as nullable, \n c.column_default as default_value,\n (\n SELECT COUNT(*) \n FROM information_schema.table_constraints tc \n JOIN information_schema.key_column_usage kcu \n ON tc.constraint_name = kcu.constraint_name \n AND tc.table_schema = kcu.table_schema\n WHERE tc.constraint_type = 'PRIMARY KEY' \n AND tc.table_name = c.table_name \n AND kcu.column_name = c.column_name \n AND tc.table_schema = c.table_schema\n ) > 0 as is_pk\n FROM information_schema.columns c\n WHERE c.table_schema = $1 AND c.table_name = $2\n ORDER BY c.ordinal_position\n `;\n\n const fksSql = `\n SELECT\n kcu.column_name AS local_column,\n ccu.table_name AS foreign_table,\n ccu.column_name AS foreign_column\n FROM information_schema.table_constraints AS tc\n JOIN information_schema.key_column_usage AS kcu\n ON tc.constraint_name = kcu.constraint_name\n AND tc.table_schema = kcu.table_schema\n JOIN information_schema.constraint_column_usage AS ccu\n ON ccu.constraint_name = tc.constraint_name\n AND ccu.table_schema = tc.table_schema\n WHERE tc.constraint_type = 'FOREIGN KEY' \n AND tc.table_schema = $1 \n AND tc.table_name = $2\n `;\n\n const colsRes = await this.query(columnsSql, [this.schema, tableName]);\n const fksRes = await this.query(fksSql, [this.schema, tableName]);\n\n return colsRes.rows.map((row: any) => {\n const fk = fksRes.rows.find((f: any) => f.local_column === row.name);\n return {\n name: row.name,\n type: row.type,\n nullable: row.nullable === \"YES\",\n defaultValue: row.default_value,\n isPrimaryKey: row.is_pk,\n isForeignKey: !!fk,\n referencedTable: fk ? fk.foreign_table : null,\n referencedColumn: fk ? fk.foreign_column : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.client) {\n await this.client.end();\n this.client = null;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class MysqlAdapter extends DbAdapter {\n private connection: any = null;\n private dbName: string = \"\";\n\n constructor(config: any) {\n super(config);\n this.dbName = config.database || \"\";\n }\n\n async connect(): Promise<void> {\n if (this.connection) return;\n\n try {\n let mysql;\n try {\n mysql = require(\"mysql2/promise\");\n } catch (err) {\n throw new Error(\n \"MySQL driver 'mysql2' is not installed. Please run `npm install mysql2` in the neural-loom environment.\"\n );\n }\n\n this.connection = await mysql.createConnection({\n host: this.config.host || \"localhost\",\n port: this.config.port || 3306,\n database: this.dbName,\n user: this.config.username || \"root\",\n password: this.config.password || \"\",\n ssl: this.config.ssl ? this.config.ssl : undefined\n });\n } catch (err: any) {\n console.error(\"[MysqlAdapter] Connect failed:\", err);\n this.connection = null;\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const [rows, fields] = await this.connection.execute(sql, params);\n \n const isArray = Array.isArray(rows);\n return {\n rows: isArray ? rows : [],\n fields: fields ? fields.map((f: any) => f.name) : [],\n affectedRows: !isArray && (rows as any).affectedRows !== undefined ? (rows as any).affectedRows : undefined\n };\n } catch (err: any) {\n console.error(\"[MysqlAdapter] Query failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `\n SELECT table_name as name, table_type as type \n FROM information_schema.tables \n WHERE table_schema = ? AND table_type IN ('BASE TABLE', 'VIEW')\n ORDER BY table_name\n `;\n const res = await this.query(sql, [this.dbName]);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"BASE TABLE\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n const columnsSql = `\n SELECT \n column_name as name, \n column_type as type, \n is_nullable as nullable, \n column_default as default_value,\n column_key as col_key\n FROM information_schema.columns \n WHERE table_schema = ? AND table_name = ?\n ORDER BY ordinal_position\n `;\n\n const fksSql = `\n SELECT \n column_name AS local_column,\n referenced_table_name AS foreign_table,\n referenced_column_name AS foreign_column\n FROM information_schema.key_column_usage\n WHERE table_schema = ? \n AND table_name = ? \n AND referenced_table_name IS NOT NULL\n `;\n\n const colsRes = await this.query(columnsSql, [this.dbName, tableName]);\n const fksRes = await this.query(fksSql, [this.dbName, tableName]);\n\n return colsRes.rows.map((row: any) => {\n const fk = fksRes.rows.find((f: any) => f.local_column === row.name);\n return {\n name: row.name,\n type: row.type || \"VARCHAR\",\n nullable: row.nullable === \"YES\",\n defaultValue: row.default_value,\n isPrimaryKey: row.col_key === \"PRI\",\n isForeignKey: !!fk,\n referencedTable: fk ? fk.foreign_table : null,\n referencedColumn: fk ? fk.foreign_column : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.connection) {\n await this.connection.end();\n this.connection = null;\n }\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sql/query/route\",\n pathname: \"/api/sql/query\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/sql/query/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sql/query/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { ConnectionManager } from \"@/lib/sql/ConnectionManager\";\n\nconst isMutation = (sql: string): boolean => {\n const clean = sql.trim().toLowerCase();\n return (\n clean.startsWith(\"insert\") ||\n clean.startsWith(\"update\") ||\n clean.startsWith(\"delete\") ||\n clean.startsWith(\"drop\") ||\n clean.startsWith(\"alter\") ||\n clean.startsWith(\"create\") ||\n clean.startsWith(\"truncate\") ||\n clean.startsWith(\"replace\")\n );\n};\n\nexport async function POST(request: Request) {\n try {\n const body = await request.json();\n const { sql, root } = body;\n\n if (!sql || !sql.trim()) {\n return NextResponse.json({ error: \"Missing parameter 'sql'\" }, { status: 400 });\n }\n\n const active = await ConnectionManager.getActiveAdapter(root);\n if (!active) {\n return NextResponse.json({ \n error: \"No active database connection configured. Please set up and select an active profile in the database panel.\" \n }, { status: 400 });\n }\n\n const { adapter, profile } = active;\n\n if (profile.readOnly && isMutation(sql)) {\n return NextResponse.json({ \n error: \"This connection profile is configured as Read-Only. Modifications are disabled.\" \n }, { status: 403 });\n }\n\n const startTime = Date.now();\n const result = await adapter.query(sql);\n const durationMs = Date.now() - startTime;\n\n return NextResponse.json({\n success: true,\n rows: result.rows,\n fields: result.fields,\n affectedRows: result.affectedRows,\n durationMs\n });\n } catch (error: any) {\n return NextResponse.json({ error: error.message || String(error) }, { status: 500 });\n }\n}\n"],"names":["cachedConfigDir","getConfigDir","primaryDir","join","process","env","ORIGINAL_CWD","cwd","existsSync","mkdirSync","recursive","testFile","Math","random","toString","substring","writeFileSync","unlinkSync","err","console","warn","fallbackDir","homedir","fallbackErr","error","isDirWritable","dir","isSystemDirectory","normalized","toLowerCase","replace","includes","startsWith","getDefaultWorkspaceRoot","launchDir","home","commonDirs","DbAdapter","config","getSchemaSummary","tables","listTables","summary","length","t","name","type","columns","describeTable","col","keyType","isPrimaryKey","isForeignKey","ref","referencedTable","referencedColumn","nullable","Error","message","String","isMutation","sql","clean","trim","POST","request","body","json","root","status","active","getActiveAdapter","adapter","profile","readOnly","startTime","Date","now","result","query","durationMs","success","rows","fields","affectedRows"],"mappings":"qmCAAA,IAAA,EAA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A,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,CAGI,IAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[6]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/config.ts","../../../src/lib/sql/ConnectionManager.ts","../../../src/lib/sql/DbAdapter.ts","../../../src/lib/sql/adapters/SqliteAdapter.ts","../../../src/lib/sql/adapters/PostgresAdapter.ts","../../../src/lib/sql/adapters/MysqlAdapter.ts","../../../src/lib/sql/adapters/MssqlAdapter.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/sql/query/route.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport os from \"os\";\n\nlet cachedConfigDir: string | null = null;\n\nexport function getConfigDir(): string {\n if (cachedConfigDir) {\n return cachedConfigDir;\n }\n\n const primaryDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), \".ai\", \"neural-loom\");\n \n try {\n // Check if primary directory exists. If not, try to create it.\n if (!fs.existsSync(primaryDir)) {\n fs.mkdirSync(primaryDir, { recursive: true });\n }\n // Perform a test write to verify write permissions (crucial for read-only directories like C:\\Program Files)\n const testFile = path.join(primaryDir, \".write-test-\" + Math.random().toString(36).substring(7));\n fs.writeFileSync(testFile, \"test\");\n fs.unlinkSync(testFile);\n cachedConfigDir = primaryDir;\n return primaryDir;\n } catch (err) {\n // If EPERM or any other write error occurs, fall back to the user's home directory\n console.warn(`[Config] Primary config dir is not writable (${primaryDir}). Falling back to home directory.`);\n const fallbackDir = path.join(os.homedir(), \".ai\", \"neural-loom\");\n try {\n if (!fs.existsSync(fallbackDir)) {\n fs.mkdirSync(fallbackDir, { recursive: true });\n }\n cachedConfigDir = fallbackDir;\n return fallbackDir;\n } catch (fallbackErr) {\n console.error(\"[Config] Fallback config dir is also not writable!\", fallbackErr);\n cachedConfigDir = primaryDir;\n return primaryDir;\n }\n }\n}\n\nexport function isDirWritable(dir: string): boolean {\n try {\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n const testFile = path.join(dir, \".write-test-\" + Math.random().toString(36).substring(7));\n fs.writeFileSync(testFile, \"test\");\n fs.unlinkSync(testFile);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isSystemDirectory(dir: string): boolean {\n const normalized = dir.toLowerCase().replace(/\\\\/g, \"/\");\n return (\n normalized.includes(\"/program files\") ||\n normalized.includes(\"/windows/system32\") ||\n normalized.includes(\"/winnt\") ||\n normalized.startsWith(\"/usr/\") ||\n normalized.startsWith(\"/bin/\") ||\n normalized.startsWith(\"/sbin/\") ||\n normalized.startsWith(\"/etc/\") ||\n normalized.startsWith(\"/var/\")\n );\n}\n\nexport function getDefaultWorkspaceRoot(): string {\n const launchDir = process.env.ORIGINAL_CWD || process.cwd();\n \n if (isDirWritable(launchDir) && !isSystemDirectory(launchDir)) {\n return launchDir.replace(/\\\\/g, \"/\");\n }\n \n const home = os.homedir();\n const commonDirs = [\n path.join(home, \"OneDrive\", \"Projects\"),\n path.join(home, \"Projects\"),\n path.join(home, \"source\", \"repos\"),\n path.join(home, \"Documents\"),\n home\n ];\n \n for (const dir of commonDirs) {\n try {\n if (fs.existsSync(dir) && isDirWritable(dir)) {\n return dir.replace(/\\\\/g, \"/\");\n }\n } catch {\n // Continue checking\n }\n }\n \n return home.replace(/\\\\/g, \"/\");\n}\n\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport fs from \"fs\";\nimport path from \"path\";\nimport { getConfigDir } from \"../config\";\nimport { DbAdapter } from \"./DbAdapter\";\nimport { SqliteAdapter } from \"./adapters/SqliteAdapter\";\nimport { PostgresAdapter } from \"./adapters/PostgresAdapter\";\nimport { MysqlAdapter } from \"./adapters/MysqlAdapter\";\nimport { MssqlAdapter } from \"./adapters/MssqlAdapter\";\n\nexport interface DbConnectionProfile {\n id: string;\n name: string;\n type: \"sqlite\" | \"postgres\" | \"mysql\" | \"mssql\";\n filepath?: string; // sqlite\n host?: string; // pg, mysql\n port?: number; // pg, mysql\n database?: string; // pg, mysql\n username?: string; // pg, mysql\n password?: string; // pg, mysql\n ssl?: boolean; // pg\n readOnly?: boolean;\n}\n\nexport interface SqlConfigSchema {\n connections: { [id: string]: DbConnectionProfile };\n activeConnection: string | null;\n}\n\nexport class ConnectionManager {\n private static activeInstances = new Map<string, DbAdapter>();\n\n private static getGlobalConfigPath(): string {\n return path.join(getConfigDir(), \"global-sql.json\");\n }\n\n private static getWorkspaceConfigPath(workspaceRoot?: string): string | null {\n if (!workspaceRoot) return null;\n return path.join(workspaceRoot, \".ai\", \"neural-loom\", \"sql-config.json\");\n }\n\n private static loadConfig(filePath: string): SqlConfigSchema {\n try {\n if (fs.existsSync(filePath)) {\n const content = fs.readFileSync(filePath, \"utf8\");\n return JSON.parse(content);\n }\n } catch (err) {\n console.error(`[ConnectionManager] Failed to load config from ${filePath}:`, err);\n }\n return { connections: {}, activeConnection: null };\n }\n\n private static saveConfig(filePath: string, config: SqlConfigSchema): void {\n try {\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n fs.writeFileSync(filePath, JSON.stringify(config, null, 2), \"utf8\");\n } catch (err) {\n console.error(`[ConnectionManager] Failed to save config to ${filePath}:`, err);\n }\n }\n\n public static async getProfiles(workspaceRoot?: string): Promise<{\n global: DbConnectionProfile[];\n workspace: DbConnectionProfile[];\n activeId: string | null;\n isActiveGlobal: boolean;\n }> {\n const globalConfig = this.loadConfig(this.getGlobalConfigPath());\n const globalProfiles = Object.values(globalConfig.connections);\n \n let workspaceProfiles: DbConnectionProfile[] = [];\n let activeId = globalConfig.activeConnection;\n let isActiveGlobal = true;\n\n if (workspaceRoot) {\n const wsConfigPath = this.getWorkspaceConfigPath(workspaceRoot);\n if (wsConfigPath) {\n const wsConfig = this.loadConfig(wsConfigPath);\n workspaceProfiles = Object.values(wsConfig.connections);\n if (wsConfig.activeConnection) {\n activeId = wsConfig.activeConnection;\n isActiveGlobal = false;\n }\n }\n }\n\n return {\n global: globalProfiles,\n workspace: workspaceProfiles,\n activeId,\n isActiveGlobal\n };\n }\n\n public static async saveProfile(\n profile: DbConnectionProfile,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for saving connection profile.\");\n }\n\n const config = this.loadConfig(filePath);\n config.connections[profile.id] = profile;\n this.saveConfig(filePath, config);\n }\n\n public static async deleteProfile(\n profileId: string,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for deleting connection profile.\");\n }\n\n const config = this.loadConfig(filePath);\n if (config.connections[profileId]) {\n delete config.connections[profileId];\n if (config.activeConnection === profileId) {\n config.activeConnection = null;\n }\n this.saveConfig(filePath, config);\n }\n\n // Close any active instance\n const cacheKey = `${isGlobal ? \"global\" : \"ws\"}:${profileId}`;\n const active = this.activeInstances.get(cacheKey);\n if (active) {\n await active.disconnect().catch(console.error);\n this.activeInstances.delete(cacheKey);\n }\n }\n\n public static async setActiveProfile(\n profileId: string | null,\n isGlobal: boolean,\n workspaceRoot?: string\n ): Promise<void> {\n const filePath = isGlobal \n ? this.getGlobalConfigPath() \n : this.getWorkspaceConfigPath(workspaceRoot);\n\n if (!filePath) {\n throw new Error(\"Invalid workspace root path for setting active profile.\");\n }\n\n const config = this.loadConfig(filePath);\n config.activeConnection = profileId;\n this.saveConfig(filePath, config);\n }\n\n public static createAdapter(profile: DbConnectionProfile, workspaceRoot?: string): DbAdapter {\n switch (profile.type) {\n case \"sqlite\":\n return new SqliteAdapter(profile, workspaceRoot);\n case \"postgres\":\n return new PostgresAdapter(profile);\n case \"mysql\":\n return new MysqlAdapter(profile);\n case \"mssql\":\n return new MssqlAdapter(profile);\n default:\n throw new Error(`Unsupported database type: ${(profile as any).type}`);\n }\n }\n\n public static async getActiveAdapter(workspaceRoot?: string): Promise<{ adapter: DbAdapter; profile: DbConnectionProfile } | null> {\n const { global, workspace, activeId, isActiveGlobal } = await this.getProfiles(workspaceRoot);\n if (!activeId) return null;\n\n const cacheKey = `${isActiveGlobal ? \"global\" : \"ws\"}:${activeId}`;\n const cached = this.activeInstances.get(cacheKey);\n if (cached) {\n // Find matching profile\n const list = isActiveGlobal ? global : workspace;\n const profile = list.find(p => p.id === activeId);\n if (profile) return { adapter: cached, profile };\n }\n\n // Load connection profile\n const list = isActiveGlobal ? global : workspace;\n const profile = list.find(p => p.id === activeId);\n if (!profile) return null;\n\n const adapter = this.createAdapter(profile, workspaceRoot);\n this.activeInstances.set(cacheKey, adapter);\n return { adapter, profile };\n }\n\n public static async closeAll(): Promise<void> {\n for (const [, instance] of this.activeInstances.entries()) {\n await instance.disconnect().catch(console.error);\n }\n this.activeInstances.clear();\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport interface TableSchema {\n name: string;\n type: string; // 'table' or 'view'\n}\n\nexport interface ColumnSchema {\n name: string;\n type: string;\n nullable: boolean;\n defaultValue?: string | null;\n isPrimaryKey: boolean;\n isForeignKey: boolean;\n referencedTable?: string | null;\n referencedColumn?: string | null;\n}\n\nexport interface QueryResult {\n rows: any[];\n fields?: string[];\n affectedRows?: number;\n}\n\nexport abstract class DbAdapter {\n protected config: any;\n\n constructor(config: any) {\n this.config = config;\n }\n\n abstract connect(): Promise<void>;\n abstract query(sql: string, params?: any[]): Promise<QueryResult>;\n abstract listTables(): Promise<TableSchema[]>;\n abstract describeTable(tableName: string): Promise<ColumnSchema[]>;\n abstract disconnect(): Promise<void>;\n\n async getSchemaSummary(): Promise<string> {\n try {\n const tables = await this.listTables();\n let summary = `### Database Schema Summary\\n\\n`;\n if (tables.length === 0) {\n return summary + \"*No tables found in this database.*\";\n }\n\n for (const t of tables) {\n summary += `#### Table: \\`${t.name}\\` (${t.type})\\n`;\n const columns = await this.describeTable(t.name);\n summary += `| Column | Type | Nullable | Key | References |\\n`;\n summary += `|---|---|---|---|---|\\n`;\n for (const col of columns) {\n const keyType = col.isPrimaryKey ? \"PK\" : col.isForeignKey ? \"FK\" : \"\";\n const ref = col.isForeignKey ? `\\`${col.referencedTable}.${col.referencedColumn}\\`` : \"\";\n summary += `| \\`${col.name}\\` | \\`${col.type}\\` | ${col.nullable ? \"Yes\" : \"No\"} | ${keyType} | ${ref} |\\n`;\n }\n summary += `\\n`;\n }\n return summary;\n } catch (err) {\n return `Failed to reflect schema summary: ${err instanceof Error ? err.message : String(err)}`;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport path from \"path\";\nimport fs from \"fs\";\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class SqliteAdapter extends DbAdapter {\n private db: any = null;\n private resolvedPath: string = \"\";\n\n constructor(config: any, workspaceRoot?: string) {\n super(config);\n const rawPath = config.filepath || \"dev.db\";\n // Resolve relative path against workspaceRoot or process CWD\n if (path.isAbsolute(rawPath)) {\n this.resolvedPath = rawPath.replace(/\\\\/g, \"/\");\n } else {\n const root = workspaceRoot || process.cwd();\n this.resolvedPath = path.resolve(root, rawPath).replace(/\\\\/g, \"/\");\n }\n }\n\n async connect(): Promise<void> {\n if (this.db) return;\n \n // Ensure parent directory exists\n const dir = path.dirname(this.resolvedPath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n try {\n // Lazy load better-sqlite3\n let Database;\n try {\n Database = require(\"better-sqlite3\");\n } catch (err) {\n throw new Error(\n \"SQLite driver 'better-sqlite3' is not installed. Please run `npm install better-sqlite3` in the neural-loom environment.\"\n );\n }\n\n this.db = new Database(this.resolvedPath);\n } catch (err: any) {\n console.error(\"[SqliteAdapter] Connect failed:\", err);\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const isSelect = sql.trim().toLowerCase().startsWith(\"select\") || \n sql.trim().toLowerCase().startsWith(\"pragma\") ||\n sql.trim().toLowerCase().startsWith(\"explain\");\n \n if (isSelect) {\n const rows = this.db.prepare(sql).all(params);\n const fields = rows.length > 0 ? Object.keys(rows[0]) : [];\n return { rows, fields };\n } else {\n const info = this.db.prepare(sql).run(params);\n return {\n rows: [],\n affectedRows: info.changes\n };\n }\n } catch (err: any) {\n console.error(\"[SqliteAdapter] Query execution failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%'`;\n const res = await this.query(sql);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"table\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n await this.connect();\n \n // Get table columns\n const columnsInfo = this.db.prepare(`PRAGMA table_info(\\`${tableName}\\`)`).all();\n // Get foreign keys\n const foreignKeys = this.db.prepare(`PRAGMA foreign_key_list(\\`${tableName}\\`)`).all();\n \n return columnsInfo.map((col: any) => {\n const fk = foreignKeys.find((f: any) => f.from === col.name);\n return {\n name: col.name,\n type: col.type || \"TEXT\",\n nullable: col.notnull === 0,\n defaultValue: col.dflt_value,\n isPrimaryKey: col.pk > 0,\n isForeignKey: !!fk,\n referencedTable: fk ? fk.table : null,\n referencedColumn: fk ? fk.to : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class PostgresAdapter extends DbAdapter {\n private client: any = null;\n private schema: string = \"public\";\n\n constructor(config: any) {\n super(config);\n this.schema = config.schema || \"public\";\n }\n\n async connect(): Promise<void> {\n if (this.client) return;\n\n try {\n let ClientClass;\n try {\n const pg = require(\"pg\");\n ClientClass = pg.Client;\n } catch (err) {\n throw new Error(\n \"PostgreSQL driver 'pg' is not installed. Please run `npm install pg` in the neural-loom environment.\"\n );\n }\n\n this.client = new ClientClass({\n host: this.config.host || \"localhost\",\n port: this.config.port || 5432,\n database: this.config.database || \"postgres\",\n user: this.config.username || \"postgres\",\n password: this.config.password || \"\",\n ssl: this.config.ssl ? this.config.ssl : undefined\n });\n\n await this.client.connect();\n } catch (err: any) {\n console.error(\"[PostgresAdapter] Connect failed:\", err);\n this.client = null;\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const res = await this.client.query(sql, params);\n const rows = res.rows || [];\n const fields = res.fields ? res.fields.map((f: any) => f.name) : [];\n return {\n rows,\n fields,\n affectedRows: res.rowCount !== null ? res.rowCount : undefined\n };\n } catch (err: any) {\n console.error(\"[PostgresAdapter] Query failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `\n SELECT table_name as name, table_type as type \n FROM information_schema.tables \n WHERE table_schema = $1 AND table_type IN ('BASE TABLE', 'VIEW')\n ORDER BY table_name\n `;\n const res = await this.query(sql, [this.schema]);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"BASE TABLE\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n const columnsSql = `\n SELECT \n c.column_name as name, \n c.data_type as type, \n c.is_nullable as nullable, \n c.column_default as default_value,\n (\n SELECT COUNT(*) \n FROM information_schema.table_constraints tc \n JOIN information_schema.key_column_usage kcu \n ON tc.constraint_name = kcu.constraint_name \n AND tc.table_schema = kcu.table_schema\n WHERE tc.constraint_type = 'PRIMARY KEY' \n AND tc.table_name = c.table_name \n AND kcu.column_name = c.column_name \n AND tc.table_schema = c.table_schema\n ) > 0 as is_pk\n FROM information_schema.columns c\n WHERE c.table_schema = $1 AND c.table_name = $2\n ORDER BY c.ordinal_position\n `;\n\n const fksSql = `\n SELECT\n kcu.column_name AS local_column,\n ccu.table_name AS foreign_table,\n ccu.column_name AS foreign_column\n FROM information_schema.table_constraints AS tc\n JOIN information_schema.key_column_usage AS kcu\n ON tc.constraint_name = kcu.constraint_name\n AND tc.table_schema = kcu.table_schema\n JOIN information_schema.constraint_column_usage AS ccu\n ON ccu.constraint_name = tc.constraint_name\n AND ccu.table_schema = tc.table_schema\n WHERE tc.constraint_type = 'FOREIGN KEY' \n AND tc.table_schema = $1 \n AND tc.table_name = $2\n `;\n\n const colsRes = await this.query(columnsSql, [this.schema, tableName]);\n const fksRes = await this.query(fksSql, [this.schema, tableName]);\n\n return colsRes.rows.map((row: any) => {\n const fk = fksRes.rows.find((f: any) => f.local_column === row.name);\n return {\n name: row.name,\n type: row.type,\n nullable: row.nullable === \"YES\",\n defaultValue: row.default_value,\n isPrimaryKey: row.is_pk,\n isForeignKey: !!fk,\n referencedTable: fk ? fk.foreign_table : null,\n referencedColumn: fk ? fk.foreign_column : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.client) {\n await this.client.end();\n this.client = null;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class MysqlAdapter extends DbAdapter {\n private connection: any = null;\n private dbName: string = \"\";\n\n constructor(config: any) {\n super(config);\n this.dbName = config.database || \"\";\n }\n\n async connect(): Promise<void> {\n if (this.connection) return;\n\n try {\n let mysql;\n try {\n mysql = require(\"mysql2/promise\");\n } catch (err) {\n throw new Error(\n \"MySQL driver 'mysql2' is not installed. Please run `npm install mysql2` in the neural-loom environment.\"\n );\n }\n\n this.connection = await mysql.createConnection({\n host: this.config.host || \"localhost\",\n port: this.config.port || 3306,\n database: this.dbName,\n user: this.config.username || \"root\",\n password: this.config.password || \"\",\n ssl: this.config.ssl ? this.config.ssl : undefined\n });\n } catch (err: any) {\n console.error(\"[MysqlAdapter] Connect failed:\", err);\n this.connection = null;\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const [rows, fields] = await this.connection.execute(sql, params);\n \n const isArray = Array.isArray(rows);\n return {\n rows: isArray ? rows : [],\n fields: fields ? fields.map((f: any) => f.name) : [],\n affectedRows: !isArray && (rows as any).affectedRows !== undefined ? (rows as any).affectedRows : undefined\n };\n } catch (err: any) {\n console.error(\"[MysqlAdapter] Query failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `\n SELECT table_name as name, table_type as type \n FROM information_schema.tables \n WHERE table_schema = ? AND table_type IN ('BASE TABLE', 'VIEW')\n ORDER BY table_name\n `;\n const res = await this.query(sql, [this.dbName]);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"BASE TABLE\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n const columnsSql = `\n SELECT \n column_name as name, \n column_type as type, \n is_nullable as nullable, \n column_default as default_value,\n column_key as col_key\n FROM information_schema.columns \n WHERE table_schema = ? AND table_name = ?\n ORDER BY ordinal_position\n `;\n\n const fksSql = `\n SELECT \n column_name AS local_column,\n referenced_table_name AS foreign_table,\n referenced_column_name AS foreign_column\n FROM information_schema.key_column_usage\n WHERE table_schema = ? \n AND table_name = ? \n AND referenced_table_name IS NOT NULL\n `;\n\n const colsRes = await this.query(columnsSql, [this.dbName, tableName]);\n const fksRes = await this.query(fksSql, [this.dbName, tableName]);\n\n return colsRes.rows.map((row: any) => {\n const fk = fksRes.rows.find((f: any) => f.local_column === row.name);\n return {\n name: row.name,\n type: row.type || \"VARCHAR\",\n nullable: row.nullable === \"YES\",\n defaultValue: row.default_value,\n isPrimaryKey: row.col_key === \"PRI\",\n isForeignKey: !!fk,\n referencedTable: fk ? fk.foreign_table : null,\n referencedColumn: fk ? fk.foreign_column : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.connection) {\n await this.connection.end();\n this.connection = null;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars */\nimport { DbAdapter, TableSchema, ColumnSchema, QueryResult } from \"../DbAdapter\";\n\nexport class MssqlAdapter extends DbAdapter {\n private pool: any = null;\n private schema: string = \"dbo\";\n\n constructor(config: any) {\n super(config);\n this.schema = config.schema || \"dbo\";\n }\n\n async connect(): Promise<void> {\n if (this.pool) return;\n\n try {\n let mssql;\n try {\n mssql = require(\"mssql\");\n } catch (err) {\n throw new Error(\n \"Microsoft SQL Server driver 'mssql' is not installed. Please run `npm install mssql` in the neural-loom environment.\"\n );\n }\n\n this.pool = await mssql.connect({\n server: this.config.host || \"localhost\",\n port: this.config.port || 1433,\n database: this.config.database,\n user: this.config.username,\n password: this.config.password,\n options: {\n encrypt: this.config.ssl || false,\n trustServerCertificate: true\n }\n });\n } catch (err: any) {\n console.error(\"[MssqlAdapter] Connect failed:\", err);\n this.pool = null;\n throw err;\n }\n }\n\n async query(sql: string, params: any[] = []): Promise<QueryResult> {\n await this.connect();\n try {\n const request = this.pool.request();\n \n if (params.length > 0) {\n request.input(\"schema\", params[0]);\n if (params.length > 1) {\n request.input(\"table\", params[1]);\n }\n }\n\n const res = await request.query(sql);\n const rows = res.recordset || [];\n const fields = res.recordset && res.recordset.columns \n ? Object.keys(res.recordset.columns) \n : (rows.length > 0 ? Object.keys(rows[0]) : []);\n\n return {\n rows,\n fields,\n affectedRows: res.rowsAffected ? res.rowsAffected[0] : undefined\n };\n } catch (err: any) {\n console.error(\"[MssqlAdapter] Query failed:\", err);\n throw err;\n }\n }\n\n async listTables(): Promise<TableSchema[]> {\n const sql = `\n SELECT table_name as name, table_type as type \n FROM information_schema.tables \n WHERE table_schema = @schema AND table_type IN ('BASE TABLE', 'VIEW')\n ORDER BY table_name\n `;\n const res = await this.query(sql, [this.schema]);\n return res.rows.map(row => ({\n name: row.name,\n type: row.type === \"BASE TABLE\" ? \"table\" : \"view\"\n }));\n }\n\n async describeTable(tableName: string): Promise<ColumnSchema[]> {\n const columnsSql = `\n SELECT \n c.column_name as name, \n c.data_type as type, \n c.is_nullable as nullable, \n c.column_default as default_value,\n (\n SELECT COUNT(*) \n FROM information_schema.table_constraints tc \n JOIN information_schema.key_column_usage kcu \n ON tc.constraint_name = kcu.constraint_name \n AND tc.table_schema = kcu.table_schema\n WHERE tc.constraint_type = 'PRIMARY KEY' \n AND tc.table_name = c.table_name \n AND kcu.column_name = c.column_name \n AND tc.table_schema = c.table_schema\n ) > 0 as is_pk\n FROM information_schema.columns c\n WHERE c.table_schema = @schema AND c.table_name = @table\n ORDER BY c.ordinal_position\n `;\n\n const fksSql = `\n SELECT\n kcu.column_name AS local_column,\n ccu.table_name AS foreign_table,\n ccu.column_name AS foreign_column\n FROM information_schema.table_constraints AS tc\n JOIN information_schema.key_column_usage AS kcu\n ON tc.constraint_name = kcu.constraint_name\n AND tc.table_schema = kcu.table_schema\n JOIN information_schema.constraint_column_usage AS ccu\n ON ccu.constraint_name = tc.constraint_name\n AND ccu.table_schema = tc.table_schema\n WHERE tc.constraint_type = 'FOREIGN KEY' \n AND tc.table_schema = @schema \n AND tc.table_name = @table\n `;\n\n const colsRes = await this.query(columnsSql, [this.schema, tableName]);\n const fksRes = await this.query(fksSql, [this.schema, tableName]);\n\n return colsRes.rows.map((row: any) => {\n const fk = fksRes.rows.find((f: any) => f.local_column === row.name);\n return {\n name: row.name,\n type: row.type,\n nullable: row.nullable === \"YES\",\n defaultValue: row.default_value,\n isPrimaryKey: row.is_pk,\n isForeignKey: !!fk,\n referencedTable: fk ? fk.foreign_table : null,\n referencedColumn: fk ? fk.foreign_column : null\n };\n });\n }\n\n async disconnect(): Promise<void> {\n if (this.pool) {\n await this.pool.close();\n this.pool = null;\n }\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sql/query/route\",\n pathname: \"/api/sql/query\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/sql/query/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sql/query/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { ConnectionManager } from \"@/lib/sql/ConnectionManager\";\n\nconst isMutation = (sql: string): boolean => {\n const clean = sql.trim().toLowerCase();\n return (\n clean.startsWith(\"insert\") ||\n clean.startsWith(\"update\") ||\n clean.startsWith(\"delete\") ||\n clean.startsWith(\"drop\") ||\n clean.startsWith(\"alter\") ||\n clean.startsWith(\"create\") ||\n clean.startsWith(\"truncate\") ||\n clean.startsWith(\"replace\")\n );\n};\n\nexport async function POST(request: Request) {\n try {\n const body = await request.json();\n const { sql, root } = body;\n\n if (!sql || !sql.trim()) {\n return NextResponse.json({ error: \"Missing parameter 'sql'\" }, { status: 400 });\n }\n\n const active = await ConnectionManager.getActiveAdapter(root);\n if (!active) {\n return NextResponse.json({ \n error: \"No active database connection configured. Please set up and select an active profile in the database panel.\" \n }, { status: 400 });\n }\n\n const { adapter, profile } = active;\n\n if (profile.readOnly && isMutation(sql)) {\n return NextResponse.json({ \n error: \"This connection profile is configured as Read-Only. Modifications are disabled.\" \n }, { status: 403 });\n }\n\n const startTime = Date.now();\n const result = await adapter.query(sql);\n const durationMs = Date.now() - startTime;\n\n return NextResponse.json({\n success: true,\n rows: result.rows,\n fields: result.fields,\n affectedRows: result.affectedRows,\n durationMs\n });\n } catch (error: any) {\n return NextResponse.json({ error: error.message || String(error) }, { status: 500 });\n }\n}\n"],"names":["cachedConfigDir","getConfigDir","primaryDir","join","process","env","ORIGINAL_CWD","cwd","existsSync","mkdirSync","recursive","testFile","Math","random","toString","substring","writeFileSync","unlinkSync","err","console","warn","fallbackDir","homedir","fallbackErr","error","isDirWritable","dir","isSystemDirectory","normalized","toLowerCase","replace","includes","startsWith","getDefaultWorkspaceRoot","launchDir","home","commonDirs","DbAdapter","config","getSchemaSummary","tables","listTables","summary","length","t","name","type","columns","describeTable","col","keyType","isPrimaryKey","isForeignKey","ref","referencedTable","referencedColumn","nullable","Error","message","String","isMutation","sql","clean","trim","POST","request","body","json","root","status","active","getActiveAdapter","adapter","profile","readOnly","startTime","Date","now","result","query","durationMs","success","rows","fields","affectedRows"],"mappings":"qmCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAIA,EAAiC,KAsC9B,SAASyB,EAAcC,CAAW,EACvC,GAAI,CACE,AAAC,EAAA,OAAE,CAAClB,UAAU,CAACkB,IACjB,EADuB,AACvB,OAAE,CAACjB,SAAS,CAACiB,EAAK,CAAEhB,WAAW,CAAK,GAEtC,IAAMC,EAAW,EAAA,OAAI,CAACR,IAAI,CAACuB,EAAK,eAAiBd,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAGtF,OAFA,EAAA,OAAE,CAACC,aAAa,CAACL,EAAU,QAC3B,EAAA,OAAE,CAACM,UAAU,CAACN,IACP,CACT,CAAE,KAAM,CACN,MAAO,EACT,CACF,uBAhDO,SAASV,EACd,GAAID,EACF,OAAOA,EAGT,IAAME,EAJe,AAIF,EAAA,OAAI,CAACC,IAAI,CAACC,QAAQC,GAAG,CAACC,YAAY,EAAIF,QAAQG,GAAG,GAAI,MAAO,eAE/E,GAAI,CAEG,AAAD,EAAC,OAAE,CAACC,UAAU,CAACN,IACjB,EAAA,OAAE,AAD4B,CAC3BO,SAAS,CAACP,EAAY,CAAEQ,WAAW,CAAK,GAG7C,IAAMC,EAAW,EAAA,OAAI,CAACR,IAAI,CAACD,EAAY,eAAiBU,KAAKC,MAAM,GA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AFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,CACf,wCACA,CACJ,EACJ","ignoreList":[7]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
module.exports=[41997,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={BailoutToCSRError:function(){return g},isBailoutToCSRError:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f="BAILOUT_TO_CLIENT_SIDE_RENDERING";class g extends Error{constructor(a){super(`Bail out to client-side rendering: ${a}`),this.reason=a,this.digest=f}}function h(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===f}},32245,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=a.r(41997);function e({reason:a,children:b}){throw Object.defineProperty(new d.BailoutToCSRError(a),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},7773,(a,b,c)=>{"use strict";function d(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"encodeURIPath",{enumerable:!0,get:function(){return d}})},68063,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0});var e={getAssetToken:function(){return i},getAssetTokenQuery:function(){return j},getDeploymentId:function(){return g},getDeploymentIdQuery:function(){return h}};for(var f in e)Object.defineProperty(c,f,{enumerable:!0,get:e[f]});function g(){return d}function h(a=!1){return d?`${a?"&":"?"}dpl=${d}`:""}function i(){return!1}function j(a=!1){return""}d=void 0},97458,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"PreloadChunks",{enumerable:!0,get:function(){return i}});let d=a.r(87924),e=a.r(35112),f=a.r(56704),g=a.r(7773),h=a.r(68063);function i({moduleIds:a}){let b=f.workAsyncStorage.getStore();if(void 0===b)return null;let c=[];if(b.reactLoadableManifest&&a){let d=b.reactLoadableManifest;for(let b of a){if(!d[b])continue;let a=d[b].files;c.push(...a)}}if(0===c.length)return null;let j=(0,h.getAssetTokenQuery)();return(0,d.jsx)(d.Fragment,{children:c.map(a=>{let c=`${b.assetPrefix}/_next/${(0,g.encodeURIPath)(a)}${j}`;return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:c,rel:"stylesheet",as:"style",nonce:b.nonce},a):((0,e.preload)(c,{as:"script",fetchPriority:"low",nonce:b.nonce}),null)})})}},69853,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return j}});let d=a.r(87924),e=a.r(72131),f=a.r(32245),g=a.r(97458);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},19721,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return e}});let d=a.r(33354)._(a.r(69853));function e(a,b){let c={};"function"==typeof a&&(c.loader=a);let e={...c,...b};return(0,d.default)({...e,modules:e.loadableGenerated?.modules})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},46845,a=>{a.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},40777,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(19721),e=a.i(46845);let f=(0,d.default)(async()=>{},{loadableGenerated:{modules:[37314]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#05070a",color:"var(--muted)",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px"},children:(0,b.jsx)("span",{children:"Initializing terminal emulator..."})})}),g=(0,d.default)(async()=>{},{loadableGenerated:{modules:[1985]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--card)",border:"1px solid var(--border)",borderRadius:"12px",marginTop:"1.5rem"},children:(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Initializing prompt editor..."})})}),h=(0,d.default)(async()=>{},{loadableGenerated:{modules:[99026]},ssr:!1}),i=(0,d.default)(async()=>{},{loadableGenerated:{modules:[9949]},ssr:!1}),j=(0,d.default)(async()=>{},{loadableGenerated:{modules:[20032]},ssr:!1}),k=(0,d.default)(async()=>{},{loadableGenerated:{modules:[97722]},ssr:!1});a.s(["default",0,function(){let[a,d]=(0,c.useState)([]),[l,m]=(0,c.useState)(null),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(""),[B,C]=(0,c.useState)(3001),[D,E]=(0,c.useState)("0.2.19"),[F,G]=(0,c.useState)(null),H=a.filter(a=>"workspace-terminal"!==a.id),I=a.find(a=>a.id===l),J=H.some(a=>("claude-docker"===a.type||"aider-docker"===a.type)&&"running"===a.status),K=H.some(a=>"claude-ssh"===a.type&&"running"===a.status),L=async()=>{try{let a=await fetch("/api/sessions"),b=await a.json();b.sessions&&d(b.sessions),b.wsPort&&C(b.wsPort),b.originalCwd&&A(b.originalCwd),b.version&&E(b.version)}catch(a){console.error("Failed to fetch sessions:",a)}},M=async()=>{try{let a=await fetch("/api/recents");if(a.ok){let b=await a.json();b.success&&b.recents&&b.recents.lastSession&&G(b.recents.lastSession)}}catch(a){console.error("Failed to fetch recents:",a)}};(0,c.useEffect)(()=>{(async()=>{await L(),await M()})(),"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(a=>console.log("Service Worker registered:",a.scope)).catch(a=>console.error("Service Worker registration failed:",a));let a=setInterval(L,4e3);return()=>clearInterval(a)},[]);let N=async(a,b,c,d)=>{o(!0);try{let e=b;e||("claude"===a?e="Claude Local":"claude-docker"===a?e="Claude Docker":"claude-ssh"===a?e="Claude SSH":"aider"===a?e="Aider Local":"aider-docker"===a?e="Aider Docker":"mock"===a&&(e="Mock Session"));let f={type:a,name:e,workspaceRoot:c,scopedDirs:d};if(("aider"===a||"aider-docker"===a)&&!c)try{let a=await fetch("/api/context/aider");if(a.ok){let b=await a.json();b.success&&b.config&&(f.workspaceRoot=b.config.workspaceRoot,f.scopedDirs=b.config.scopedDirs)}}catch(a){console.error("Failed to load aider configuration before launch:",a)}let g=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),h=await g.json();h.success&&(await L(),m(h.session.id),G({type:a,name:e,workspaceRoot:c,scopedDirs:d}))}catch(a){console.error("Failed to launch session:",a)}finally{o(!1)}},O=async(a,b=!1)=>{try{let c=await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,delete:b})});(await c.json()).success&&(b&&l===a&&m(null),await L())}catch(a){console.error("Failed to stop session:",a)}};return(0,b.jsxs)("div",{className:`${e.default.container} ${I?e.default.containerActive:""}`,children:[(0,b.jsxs)("header",{className:e.default.header,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1.5rem"},children:[(0,b.jsx)("img",{src:"/logo.png",alt:"NeuralLoom Logo",style:{width:"160px",height:"160px",borderRadius:"16px",objectFit:"contain"}}),(0,b.jsxs)("div",{className:e.default.logoArea,children:[(0,b.jsx)("h1",{className:e.default.title,style:{margin:0,lineHeight:1.1},children:"NeuralLoom"}),(0,b.jsx)("span",{className:e.default.subtitle,children:"Unified AI Orchestrator & Context Bridge"})]})]}),(0,b.jsxs)("div",{className:e.default.statusIndicator,children:[(0,b.jsx)("span",{className:e.default.pulseDot}),(0,b.jsx)("span",{children:"Orchestrator Online"})]})]}),I?(0,b.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:(0,b.jsx)(k,{sessionId:I.id,workspaceRoot:I.workspaceRoot||"",scopedDirs:I.scopedDirs||[],onClose:()=>m(null),sessions:a,onSwitchSession:a=>m(a),onRefreshSessions:L,wsPort:B})}):(0,b.jsxs)("div",{className:e.default.dashboardGrid,children:[(0,b.jsxs)("main",{className:e.default.mainPanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Active AI Agents"}),0===H.length?(0,b.jsxs)("div",{className:"card",style:{padding:"3rem 1.5rem",textAlign:"center"},children:[(0,b.jsx)("p",{style:{color:"var(--muted)",marginBottom:"1.5rem"},children:"No active agent sessions in this workspace. Launch a Claude or Aider agent session to begin."}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},children:[F&&(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{N(F.type,F.name,F.workspaceRoot,F.scopedDirs)},disabled:n,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none",maxWidth:"200px"},title:`Re-launch: ${F.name||F.type}`,children:"⚡ Re-launch Last Session"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{y(!1),w(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Claude PTY"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{u(!1),s(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Aider PTY"})]}),(0,b.jsxs)("div",{style:{marginTop:"1.5rem",fontSize:"0.75rem",color:"var(--muted)"},children:["Want to verify layout features first?"," ",(0,b.jsx)("span",{onClick:()=>N("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Start simulated sandbox session"})]})]}):(0,b.jsx)("div",{className:e.default.agentGrid,children:H.map(a=>(0,b.jsxs)("div",{className:`${e.default.agentCard} card ${l===a.id?e.default.activeBorder:""}`,children:[(0,b.jsxs)("div",{className:e.default.agentHeader,children:[(0,b.jsx)("span",{className:e.default.agentName,children:a.name}),(0,b.jsx)("span",{className:`${e.default.agentBadge} ${"stopped"===a.status?e.default.stoppedBadge:""}`,children:a.status})]}),(0,b.jsxs)("div",{className:e.default.cardBody,children:[(0,b.jsxs)("p",{style:{fontSize:"0.825rem",color:"var(--muted)"},children:["ID: ",(0,b.jsx)("code",{style:{fontSize:"0.75rem"},children:a.id.substring(0,8)}),(0,b.jsx)("br",{}),"Type: ","claude"===a.type?"Claude Local PTY":"claude-docker"===a.type?"Claude Docker PTY":"claude-ssh"===a.type?"Claude SSH PTY":"aider"===a.type?"Aider Local PTY":"aider-docker"===a.type?"Aider Docker PTY":"mock"===a.type?"Simulated Mock PTY":"Unknown PTY",(0,b.jsx)("br",{}),"Logs: ",a.logsCount," captured lines"]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"1rem"},children:["running"===a.status?(0,b.jsx)("button",{onClick:()=>O(a.id,!1),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--danger)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--danger)"},children:"Stop"}):(0,b.jsx)("button",{onClick:()=>O(a.id,!0),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},children:"Delete"}),(0,b.jsx)("button",{onClick:()=>m(a.id),style:{flex:2,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"none",backgroundColor:l===a.id?"var(--border-focus)":"var(--primary)",fontSize:"0.75rem",fontWeight:600,color:"#fff"},children:l===a.id?"Connected":"Open Session"})]})]})]},a.id))})]}),l&&"workspace-terminal"!==l&&(0,b.jsxs)("section",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-focus)"},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(109, 40, 217, 0.08)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:["🖥️ Console Bridge — ",a.find(a=>a.id===l)?.name]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.find(a=>a.id===l)?.status==="stopped"&&(0,b.jsx)("button",{onClick:async()=>{try{let a=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l})});if(a.ok)await L();else{let b=await a.json();alert(b.error||"Failed to restart session.")}}catch(a){console.error("Failed to restart session:",a),alert("Network error: failed to restart session.")}},style:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",boxShadow:"0 0 8px rgba(234, 179, 8, 0.2)"},title:"Restart the stopped session process runner",children:"⚡ Restart Session"}),(0,b.jsx)("button",{onClick:()=>m(null),style:{border:"none",background:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.75rem"},children:"Close Panel ✖"})]})]}),(0,b.jsx)(f,{sessionId:l,wsPort:B})]}),(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Workspace Shell Terminal"}),(0,b.jsxs)("div",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border)",padding:0},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.85rem"},children:["💻 Local Workspace Shell (CWD: ",z||"root",")"]}),(0,b.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--muted)"},children:"Pre-configured environment"})]}),(0,b.jsx)(f,{sessionId:"workspace-terminal",height:"300px",wsPort:B})]})]}),(0,b.jsxs)("section",{style:{marginTop:"2rem"},children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Shared Context Hub & Slash Commands"}),(0,b.jsxs)("div",{className:e.default.contextList,children:[(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Context & System Rules (/ccc)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Compiles AGENTS.md guidelines and project files folder hierarchy map."})]}),(0,b.jsx)("button",{onClick:async()=>{l&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,command:"/ccc"})})},disabled:!l,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.75rem",fontWeight:600,opacity:l?1:.5,cursor:l?"pointer":"not-allowed"},children:"🚀 Mount Context (/ccc)"})]}),(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Developer Prompt (/ccp)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Executes instructions written in .ai/neural-loom/cprompt.md."})]}),(0,b.jsx)("button",{onClick:async()=>{l&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,command:"/ccp"})})},disabled:!l,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.75rem",fontWeight:600,opacity:l?1:.5,cursor:l?"pointer":"not-allowed"},children:"⚡ Trigger Prompt (/ccp)"})]})]}),(0,b.jsx)(g,{})]})]}),(0,b.jsxs)("aside",{className:e.default.sidePanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Execution Environments"}),(0,b.jsxs)("div",{className:e.default.envGrid,children:[(0,b.jsxs)("div",{className:e.default.envRow,children:[(0,b.jsx)("span",{className:e.default.envName,children:"💻 Local host OS"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:"var(--success)"},children:"Active"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:J?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🐳 Docker Sandbox"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:J?"var(--success)":"var(--muted)"},children:J?"Active":"Not Mounted"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:K?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🌐 Remote VM (SSH)"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:K?"var(--success)":"var(--muted)"},children:K?"Active":"Disconnected"})]})]})]}),(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{y(!1),w(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🤖"}),(0,b.jsx)("span",{children:"Launch Claude PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{y(!0),w(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(170, 72%, 40%) 0%, hsl(195, 100%, 40%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Docker PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>q(!0),disabled:n,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🌐"}),(0,b.jsx)("span",{children:"Launch SSH PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{u(!1),s(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐍"}),(0,b.jsx)("span",{children:"Launch Aider PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{u(!0),s(!0)},disabled:n,style:{background:"linear-gradient(135deg, hsl(195, 100%, 40%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Aider Docker"})]})]}),(0,b.jsxs)("section",{className:"card",style:{padding:"1.5rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsx)("h3",{style:{fontSize:"1rem",fontWeight:700},children:"Quick Actions"}),(0,b.jsxs)("ul",{style:{listStyle:"none",fontSize:"0.875rem",display:"flex",flexDirection:"column",gap:"0.5rem",color:"var(--muted)"},children:[(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Configure global API Keys"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Edit rules templates"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Inspect process locks"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]})]}),(0,b.jsxs)("div",{style:{marginTop:"1.2rem",textAlign:"center",fontSize:"0.72rem",color:"var(--muted)"},children:["Need to troubleshoot?"," ",(0,b.jsx)("span",{onClick:()=>N("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Launch simulated playground sandbox"})]})]})]})]}),(0,b.jsxs)("footer",{className:e.default.footer,children:[(0,b.jsxs)("span",{children:["NeuralLoom v",D," — Experimental AI Orchestrator Bridge"]}),(0,b.jsxs)("span",{children:["Directory: ",z||"Loading..."]})]}),p&&(0,b.jsx)(h,{onClose:()=>q(!1),onConfirmLaunch:()=>{q(!1),N("claude-ssh")}}),r&&(0,b.jsx)(i,{onClose:()=>s(!1),isDocker:t,onConfirmLaunch:()=>{s(!1),N(t?"aider-docker":"aider")}}),v&&(0,b.jsx)(j,{onClose:()=>w(!1),isDocker:x,onConfirmLaunch:(a,b,c)=>{w(!1),N(x?"claude-docker":"claude",a,b,c)}})]})}])}];
|
|
1
|
+
module.exports=[41997,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={BailoutToCSRError:function(){return g},isBailoutToCSRError:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f="BAILOUT_TO_CLIENT_SIDE_RENDERING";class g extends Error{constructor(a){super(`Bail out to client-side rendering: ${a}`),this.reason=a,this.digest=f}}function h(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===f}},32245,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=a.r(41997);function e({reason:a,children:b}){throw Object.defineProperty(new d.BailoutToCSRError(a),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},7773,(a,b,c)=>{"use strict";function d(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"encodeURIPath",{enumerable:!0,get:function(){return d}})},68063,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0});var e={getAssetToken:function(){return i},getAssetTokenQuery:function(){return j},getDeploymentId:function(){return g},getDeploymentIdQuery:function(){return h}};for(var f in e)Object.defineProperty(c,f,{enumerable:!0,get:e[f]});function g(){return d}function h(a=!1){return d?`${a?"&":"?"}dpl=${d}`:""}function i(){return!1}function j(a=!1){return""}d=void 0},97458,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"PreloadChunks",{enumerable:!0,get:function(){return i}});let d=a.r(87924),e=a.r(35112),f=a.r(56704),g=a.r(7773),h=a.r(68063);function i({moduleIds:a}){let b=f.workAsyncStorage.getStore();if(void 0===b)return null;let c=[];if(b.reactLoadableManifest&&a){let d=b.reactLoadableManifest;for(let b of a){if(!d[b])continue;let a=d[b].files;c.push(...a)}}if(0===c.length)return null;let j=(0,h.getAssetTokenQuery)();return(0,d.jsx)(d.Fragment,{children:c.map(a=>{let c=`${b.assetPrefix}/_next/${(0,g.encodeURIPath)(a)}${j}`;return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:c,rel:"stylesheet",as:"style",nonce:b.nonce},a):((0,e.preload)(c,{as:"script",fetchPriority:"low",nonce:b.nonce}),null)})})}},69853,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return j}});let d=a.r(87924),e=a.r(72131),f=a.r(32245),g=a.r(97458);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},19721,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return e}});let d=a.r(33354)._(a.r(69853));function e(a,b){let c={};"function"==typeof a&&(c.loader=a);let e={...c,...b};return(0,d.default)({...e,modules:e.loadableGenerated?.modules})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},46845,a=>{a.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},40777,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(19721),e=a.i(46845);function f({workspaceRoot:a}){let[d,e]=(0,c.useState)({global:[],workspace:[]}),[h,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!0),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(null),[p,q]=(0,c.useState)({}),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)("SELECT * FROM sqlite_master;"),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(null),[z,A]=(0,c.useState)(null),[B,C]=(0,c.useState)(!1),[D,E]=(0,c.useState)(!1),[F,G]=(0,c.useState)({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(null),L=async()=>{try{let b=await fetch(`/api/sql/connections?root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success&&(e({global:a.global||[],workspace:a.workspace||[]}),i(a.activeId),k(a.isActiveGlobal))}}catch(a){console.error("Failed to load connection profiles:",a)}},M=async()=>{if(!h)return void m([]);s(!0);try{let b=await fetch(`/api/sql/schema?action=list_tables&root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success?(m(a.tables||[]),y(null)):y(a.error||"Failed to load database schema.")}else{let a=await b.json();y(a.error||"Failed to load database schema.")}}catch(a){console.error("Failed to load schema:",a)}finally{s(!1)}},N=async b=>{if(p[b])return void o(n===b?null:b);try{let c=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(b)}&root=${encodeURIComponent(a)}`);if(c.ok){let a=await c.json();a.success&&(q(c=>({...c,[b]:a.columns})),o(b))}}catch(a){console.error(`Failed to load columns for table ${b}:`,a)}};(0,c.useEffect)(()=>{L()},[a]),(0,c.useEffect)(()=>{M(),A(null),o(null),q({});let a=j?d.global.find(a=>a.id===h):d.workspace.find(a=>a.id===h);a&&("sqlite"===a.type?u("SELECT name, type FROM sqlite_master WHERE type='table';"):"mssql"===a.type?u("SELECT * FROM sys.tables;"):u("SELECT * FROM information_schema.tables LIMIT 10;"))},[h,j,d.global.length,d.workspace.length]);let O=async(b,c)=>{try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set_active",profileId:b,isGlobal:c,root:a})})).ok&&(i(b),k(c))}catch(a){console.error("Failed to set active profile:",a)}},P=async()=>{K(null);try{let b=await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",profile:F,root:a})}),c=await b.json();c.success?K({success:!0,message:"Connection test successful!"}):K({success:!1,message:c.error||"Connection test failed."})}catch(a){K({success:!1,message:a.message||"Failed to make test query."})}},Q=async b=>{if(b.preventDefault(),!F.name||!F.type)return;I(!0);let c=F.id||`profile_${Math.random().toString(36).substring(7)}`,d={...F,id:c,name:F.name,type:F.type};try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"save",profile:d,isGlobal:D,root:a})})).ok&&(await L(),C(!1),h||O(c,D))}catch(a){console.error("Failed to save profile:",a)}finally{I(!1)}},R=async(b,c)=>{if(confirm("Are you sure you want to delete this connection profile?"))try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",profileId:b,isGlobal:c,root:a})})).ok&&(await L(),h===b&&i(null))}catch(a){console.error("Failed to delete connection profile:",a)}},S=async()=>{if(t.trim()&&h){w(!0),y(null),A(null);try{let b=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:t.trim(),root:a})}),c=await b.json();b.ok&&c.success?(A({rows:c.rows||[],fields:c.fields||[],durationMs:c.durationMs||0,affectedRows:c.affectedRows}),(t.toLowerCase().includes("create table")||t.toLowerCase().includes("drop table")||t.toLowerCase().includes("alter table"))&&M()):y(c.error||"Failed to execute query.")}catch(a){y(a.message||"An unexpected error occurred during execution.")}finally{w(!1)}}},T=j?d.global.find(a=>a.id===h):d.workspace.find(a=>a.id===h);return(0,b.jsxs)("div",{style:g.container,children:[(0,b.jsxs)("div",{style:g.sidebar,children:[(0,b.jsxs)("div",{style:g.section,children:[(0,b.jsxs)("div",{style:g.sectionHeader,children:[(0,b.jsx)("span",{style:g.sectionTitle,children:"Connections"}),(0,b.jsx)("button",{style:g.addBtn,onClick:()=>{K(null),G({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),E(!1),C(!0)},title:"Add Database Connection Profile",children:"➕ Add"})]}),(0,b.jsxs)("div",{style:g.profileList,children:[0===d.global.length&&0===d.workspace.length&&(0,b.jsx)("div",{style:g.emptyText,children:"No connections configured. Add one to start."}),d.workspace.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:g.groupHeader,children:"WORKSPACE CONNECTIONS"}),d.workspace.map(a=>(0,b.jsxs)("div",{style:{...g.profileItem,...h===a.id&&!j?g.profileItemActive:{}},onClick:()=>O(a.id,!1),children:[(0,b.jsxs)("div",{style:g.profileMeta,children:[(0,b.jsxs)("span",{style:g.profileName,children:["📁 ",a.name]}),(0,b.jsx)("span",{style:g.profileType,children:a.type})]}),(0,b.jsx)("button",{style:g.deleteProfileBtn,onClick:b=>{b.stopPropagation(),R(a.id,!1)},children:"✖"})]},a.id))]}),d.global.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:g.groupHeader,children:"GLOBAL CONNECTIONS"}),d.global.map(a=>(0,b.jsxs)("div",{style:{...g.profileItem,...h===a.id&&j?g.profileItemActive:{}},onClick:()=>O(a.id,!0),children:[(0,b.jsxs)("div",{style:g.profileMeta,children:[(0,b.jsxs)("span",{style:g.profileName,children:["🌐 ",a.name]}),(0,b.jsx)("span",{style:g.profileType,children:a.type})]}),(0,b.jsx)("button",{style:g.deleteProfileBtn,onClick:b=>{b.stopPropagation(),R(a.id,!0)},children:"✖"})]},a.id))]})]})]}),(0,b.jsxs)("div",{style:{...g.section,flex:1,borderTop:"1px solid var(--border)"},children:[(0,b.jsxs)("div",{style:g.sectionHeader,children:[(0,b.jsx)("span",{style:g.sectionTitle,children:"Schema Tables"}),r&&(0,b.jsx)("span",{style:g.spinnerMini})]}),(0,b.jsxs)("div",{style:g.tableList,children:[!h&&(0,b.jsx)("div",{style:g.emptyText,children:"Select an active connection to view tables."}),h&&0===l.length&&!r&&(0,b.jsx)("div",{style:g.emptyText,children:"No tables found in database schema."}),l.map(a=>(0,b.jsxs)("div",{style:g.tableTreeItem,children:[(0,b.jsxs)("div",{style:g.tableRow,onClick:()=>N(a.name),children:[(0,b.jsx)("span",{style:g.tableIcon,children:"view"===a.type?"👁️":"📊"}),(0,b.jsx)("span",{style:g.tableName,children:a.name}),(0,b.jsx)("span",{style:g.tableChevron,children:n===a.name?"▼":"▶"})]}),n===a.name&&p[a.name]&&(0,b.jsx)("div",{style:g.columnList,children:p[a.name].map(a=>(0,b.jsxs)("div",{style:g.columnItem,children:[(0,b.jsx)("span",{style:g.columnIcon,children:a.isPrimaryKey?"🔑":a.isForeignKey?"🔗":"▫"}),(0,b.jsx)("span",{style:g.columnName,title:a.type,children:a.name}),(0,b.jsx)("span",{style:g.columnType,children:a.type.toLowerCase().substring(0,12)})]},a.name))})]},a.name))]})]})]}),(0,b.jsxs)("div",{style:g.mainContent,children:[(0,b.jsxs)("div",{style:g.statusBar,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,b.jsx)("span",{style:g.statusLabel,children:"Active Connection:"}),T?(0,b.jsxs)("span",{style:g.statusValue,children:[j?"🌐":"📁"," ",T.name," (",T.type,")",T.readOnly&&(0,b.jsx)("span",{style:g.readOnlyBadge,children:"Read-Only"})]}):(0,b.jsx)("span",{style:{...g.statusValue,color:"var(--danger)"},children:"No Connection Selected"})]}),(0,b.jsx)("button",{style:{...g.runBtn,opacity:!h||v?.6:1,cursor:!h||v?"not-allowed":"pointer"},onClick:S,disabled:!h||v,children:v?"⌛ Running...":"⚡ Execute Query (F5)"})]}),(0,b.jsx)("div",{style:g.editorArea,children:(0,b.jsx)("textarea",{style:g.textarea,value:t,onChange:a=>u(a.target.value),placeholder:"Write your SQL query script here...",onKeyDown:a=>{("F5"===a.key||a.ctrlKey&&"Enter"===a.key)&&(a.preventDefault(),S())}})}),(0,b.jsxs)("div",{style:g.resultsArea,children:[x&&(0,b.jsxs)("div",{style:g.errorContainer,children:[(0,b.jsx)("h4",{style:{margin:"0 0 0.5rem 0",color:"var(--danger)"},children:"⚠️ Execution Error"}),(0,b.jsx)("pre",{style:g.errorText,children:x}),x.includes("not installed")&&(0,b.jsxs)("div",{style:g.driverPrompt,children:[(0,b.jsx)("p",{style:{margin:"0 0 0.5rem 0"},children:"To resolve this, run this installer command in your workspace terminal:"}),(0,b.jsx)("code",{style:g.driverCode,children:T?.type==="sqlite"?"npm install better-sqlite3":T?.type==="postgres"?"npm install pg":T?.type==="mysql"?"npm install mysql2":"npm install mssql"})]})]}),z&&(0,b.jsxs)("div",{style:g.resultsWrapper,children:[(0,b.jsxs)("div",{style:g.resultsMeta,children:[(0,b.jsxs)("span",{children:["Query completed."," ",void 0!==z.affectedRows?`Affected rows: ${z.affectedRows}`:`Returned ${z.rows.length} rows`]}),(0,b.jsxs)("span",{children:["Duration: ",z.durationMs,"ms"]})]}),z.rows.length>0?(0,b.jsx)("div",{style:g.tableContainer,children:(0,b.jsxs)("table",{style:g.table,children:[(0,b.jsx)("thead",{children:(0,b.jsx)("tr",{children:z.fields.map(a=>(0,b.jsx)("th",{style:g.th,children:a},a))})}),(0,b.jsx)("tbody",{children:z.rows.map((a,c)=>(0,b.jsx)("tr",{style:c%2==0?g.trEven:g.trOdd,children:z.fields.map(c=>(0,b.jsx)("td",{style:g.td,children:null===a[c]?"NULL":"object"==typeof a[c]?JSON.stringify(a[c]):String(a[c])},c))},c))})]})}):void 0===z.affectedRows&&(0,b.jsx)("div",{style:g.emptyResults,children:"Query executed successfully, but returned 0 results."})]}),!x&&!z&&!v&&(0,b.jsx)("div",{style:g.emptyResults,children:"Write a query script and click Execute to view table records."}),v&&(0,b.jsxs)("div",{style:g.loadingWrapper,children:[(0,b.jsx)("span",{style:g.spinnerLarge}),(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Running database statement..."})]})]})]}),B&&(0,b.jsx)("div",{style:g.modalOverlay,children:(0,b.jsxs)("div",{style:g.modalContent,children:[(0,b.jsxs)("h3",{style:{margin:"0 0 1rem 0",display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"🔌 Add Database Profile"}),(0,b.jsx)("span",{style:{cursor:"pointer"},onClick:()=>C(!1),children:"✖"})]}),(0,b.jsxs)("form",{onSubmit:Q,children:[(0,b.jsxs)("div",{style:g.formRow,children:[(0,b.jsx)("label",{style:g.label,children:"Profile Name"}),(0,b.jsx)("input",{style:g.input,type:"text",required:!0,value:F.name,onChange:a=>G(b=>({...b,name:a.target.value})),placeholder:"e.g. Local Postgres, Dev SQLite"})]}),(0,b.jsxs)("div",{style:g.formRow,children:[(0,b.jsx)("label",{style:g.label,children:"Scope Level"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:!D,onChange:()=>E(!1)}),"Workspace Local"]}),(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:D,onChange:()=>E(!0)}),"Global User Profile"]})]})]}),(0,b.jsxs)("div",{style:g.formRow,children:[(0,b.jsx)("label",{style:g.label,children:"Database Type"}),(0,b.jsxs)("select",{style:g.select,value:F.type,onChange:a=>{let b=a.target.value,c=5432;"mysql"===b&&(c=3306),"mssql"===b&&(c=1433),G(a=>({...a,type:b,filepath:"sqlite"===b?"./dev.db":void 0,port:"sqlite"!==b?c:void 0,database:"sqlite"===b?void 0:"mssql"===b?"master":"postgres"===b?"postgres":"",username:"sqlite"===b?void 0:"mssql"===b?"sa":"postgres"===b?"postgres":"root"}))},children:[(0,b.jsx)("option",{value:"sqlite",children:"SQLite (Local File)"}),(0,b.jsx)("option",{value:"postgres",children:"PostgreSQL"}),(0,b.jsx)("option",{value:"mysql",children:"MySQL"}),(0,b.jsx)("option",{value:"mssql",children:"Microsoft SQL Server"})]})]}),"sqlite"===F.type?(0,b.jsxs)("div",{style:g.formRow,children:[(0,b.jsx)("label",{style:g.label,children:"Database File Path"}),(0,b.jsx)("input",{style:g.input,type:"text",required:!0,value:F.filepath||"",onChange:a=>G(b=>({...b,filepath:a.target.value})),placeholder:"Relative (e.g. ./data/dev.db) or Absolute path"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...g.formRow,flex:3},children:[(0,b.jsx)("label",{style:g.label,children:"Host IP Address"}),(0,b.jsx)("input",{style:g.input,type:"text",required:!0,value:F.host||"",onChange:a=>G(b=>({...b,host:a.target.value})),placeholder:"localhost or IP"})]}),(0,b.jsxs)("div",{style:{...g.formRow,flex:1},children:[(0,b.jsx)("label",{style:g.label,children:"Port"}),(0,b.jsx)("input",{style:g.input,type:"number",required:!0,value:F.port||0,onChange:a=>G(b=>({...b,port:parseInt(a.target.value)}))})]})]}),(0,b.jsxs)("div",{style:g.formRow,children:[(0,b.jsx)("label",{style:g.label,children:"Database Name"}),(0,b.jsx)("input",{style:g.input,type:"text",required:!0,value:F.database||"",onChange:a=>G(b=>({...b,database:a.target.value}))})]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...g.formRow,flex:1},children:[(0,b.jsx)("label",{style:g.label,children:"Username"}),(0,b.jsx)("input",{style:g.input,type:"text",required:!0,value:F.username||"",onChange:a=>G(b=>({...b,username:a.target.value}))})]}),(0,b.jsxs)("div",{style:{...g.formRow,flex:1},children:[(0,b.jsx)("label",{style:g.label,children:"Password"}),(0,b.jsx)("input",{style:g.input,type:"password",value:F.password||"",onChange:a=>G(b=>({...b,password:a.target.value}))})]})]}),("postgres"===F.type||"mssql"===F.type)&&(0,b.jsx)("div",{style:g.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!F.ssl,onChange:a=>G(b=>({...b,ssl:a.target.checked}))}),"Require SSL Secure Connection"]})})]}),(0,b.jsx)("div",{style:g.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!F.readOnly,onChange:a=>G(b=>({...b,readOnly:a.target.checked}))}),"Enforce Read-Only Connection (Disable mutations)"]})}),J&&(0,b.jsx)("div",{style:{...g.testResult,backgroundColor:J.success?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)",border:J.success?"1px solid var(--success)":"1px solid var(--danger)",color:J.success?"var(--success)":"var(--danger)"},children:J.message}),(0,b.jsxs)("div",{style:g.modalFooter,children:[(0,b.jsx)("button",{type:"button",style:g.testBtn,onClick:P,children:"🔍 Test Connection"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,b.jsx)("button",{type:"button",style:g.cancelBtn,onClick:()=>C(!1),children:"Cancel"}),(0,b.jsx)("button",{type:"submit",style:g.saveBtn,disabled:H,children:H?"Saving...":"Save Profile"})]})]})]})]})})]})}let g={container:{display:"flex",height:"100%",width:"100%",backgroundColor:"#05070a",color:"#cbd5e1",fontSize:"0.875rem",minHeight:0},sidebar:{width:"280px",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"rgba(10, 15, 24, 0.4)",flexShrink:0},section:{display:"flex",flexDirection:"column",padding:"1rem",minHeight:0},sectionHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},sectionTitle:{fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",fontSize:"0.75rem",color:"var(--muted)"},addBtn:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},profileList:{display:"flex",flexDirection:"column",gap:"0.4rem",overflowY:"auto",maxHeight:"220px"},groupHeader:{fontSize:"0.65rem",fontWeight:600,color:"var(--muted)",marginTop:"0.5rem",marginBottom:"0.2rem",letterSpacing:"0.05em"},profileItem:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.5rem 0.6rem",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.02)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.2s ease"},profileItemActive:{backgroundColor:"rgba(109, 40, 217, 0.08)",border:"1px solid var(--border-focus)",boxShadow:"0 0 10px rgba(109, 40, 217, 0.1)"},profileMeta:{display:"flex",flexDirection:"column",gap:"0.15rem",flex:1,minWidth:0},profileName:{fontWeight:600,fontSize:"0.8rem",color:"#fff",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},profileType:{fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase"},deleteProfileBtn:{background:"none",border:"none",color:"rgba(239, 68, 68, 0.4)",cursor:"pointer",fontSize:"0.75rem",padding:"0.25rem"},tableList:{display:"flex",flexDirection:"column",gap:"0.25rem",overflowY:"auto",flex:1,minHeight:0},emptyText:{fontSize:"0.75rem",color:"var(--muted)",textAlign:"center",padding:"1rem 0"},tableTreeItem:{display:"flex",flexDirection:"column"},tableRow:{display:"flex",alignItems:"center",padding:"0.35rem 0.5rem",borderRadius:"4px",cursor:"pointer",userSelect:"none",transition:"background 0.2s ease"},tableIcon:{marginRight:"0.4rem",fontSize:"0.9rem"},tableName:{flex:1,fontSize:"0.8rem",color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tableChevron:{fontSize:"0.6rem",color:"var(--muted)",marginLeft:"0.25rem"},columnList:{display:"flex",flexDirection:"column",gap:"0.2rem",paddingLeft:"1.5rem",marginTop:"0.15rem",borderLeft:"1px dashed rgba(255,255,255,0.06)",marginLeft:"0.8rem",marginBottom:"0.25rem"},columnItem:{display:"flex",alignItems:"center",padding:"0.15rem 0.25rem",fontSize:"0.75rem"},columnIcon:{marginRight:"0.3rem",fontSize:"0.7rem"},columnName:{flex:1,color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis"},columnType:{fontSize:"0.65rem",color:"rgba(109, 40, 217, 0.75)",fontFamily:"monospace",paddingLeft:"0.5rem"},mainContent:{flex:1,display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"#05070a"},statusBar:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"rgba(15, 23, 42, 0.3)",flexShrink:0},statusLabel:{fontSize:"0.75rem",color:"var(--muted)"},statusValue:{fontSize:"0.8rem",fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:"0.4rem"},readOnlyBadge:{padding:"0.1rem 0.4rem",borderRadius:"4px",backgroundColor:"rgba(234, 179, 8, 0.12)",color:"#eab308",fontSize:"0.65rem",fontWeight:700,border:"1px solid rgba(234, 179, 8, 0.2)"},runBtn:{padding:"0.4rem 0.9rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.8rem",fontWeight:600,transition:"all 0.2s ease"},editorArea:{height:"180px",borderBottom:"1px solid var(--border)",position:"relative",flexShrink:0},textarea:{width:"100%",height:"100%",backgroundColor:"#080c14",border:"none",resize:"none",color:"#e2e8f0",fontFamily:"monospace",fontSize:"0.85rem",padding:"1rem",outline:"none",lineHeight:"1.4"},resultsArea:{flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"1rem"},errorContainer:{padding:"1rem",borderRadius:"8px",backgroundColor:"rgba(239, 68, 68, 0.08)",border:"1px solid rgba(239, 68, 68, 0.2)",overflowY:"auto"},errorText:{margin:0,fontFamily:"monospace",fontSize:"0.8rem",color:"#f87171",whiteSpace:"pre-wrap"},driverPrompt:{marginTop:"1rem",padding:"0.75rem",borderRadius:"6px",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)"},driverCode:{display:"block",padding:"0.5rem",backgroundColor:"#090d16",borderRadius:"4px",fontFamily:"monospace",fontSize:"0.8rem",color:"var(--primary)",border:"1px solid var(--border)"},resultsWrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},resultsMeta:{display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"var(--muted)",marginBottom:"0.5rem"},tableContainer:{flex:1,overflow:"auto",border:"1px solid var(--border)",borderRadius:"6px"},table:{width:"100%",borderCollapse:"collapse",fontFamily:"monospace",fontSize:"0.8rem"},th:{padding:"0.5rem 0.75rem",textAlign:"left",backgroundColor:"#0f172a",borderBottom:"1px solid var(--border)",color:"#94a3b8",fontWeight:600,position:"sticky",top:0,zIndex:1},td:{padding:"0.4rem 0.75rem",borderBottom:"1px solid rgba(255, 255, 255, 0.03)",color:"#cbd5e1",whiteSpace:"nowrap"},trEven:{backgroundColor:"transparent"},trOdd:{backgroundColor:"rgba(255, 255, 255, 0.01)"},emptyResults:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},loadingWrapper:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1rem"},spinnerLarge:{width:"24px",height:"24px",border:"3px solid rgba(109, 40, 217, 0.15)",borderTop:"3px solid var(--primary)",borderRadius:"50%",animation:"spin 1s linear infinite"},spinnerMini:{width:"12px",height:"12px",border:"2px solid rgba(255, 255, 255, 0.1)",borderTop:"2px solid var(--muted)",borderRadius:"50%",animation:"spin 1s linear infinite"},modalOverlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999},modalContent:{width:"480px",backgroundColor:"#0d131f",borderRadius:"12px",border:"1px solid var(--border-focus)",padding:"1.5rem",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.5)"},formRow:{display:"flex",flexDirection:"column",gap:"0.35rem",marginBottom:"1rem"},label:{fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},input:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},select:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},testResult:{padding:"0.5rem",borderRadius:"6px",fontSize:"0.75rem",marginBottom:"1rem"},modalFooter:{display:"flex",justifyContent:"space-between",marginTop:"1.5rem"},testBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},cancelBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},saveBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"}};if("u">typeof document){let a=document.createElement("style");a.innerHTML=`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
0% { transform: rotate(0deg); }
|
|
4
|
+
100% { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`,document.head.appendChild(a)}let h=(0,d.default)(async()=>{},{loadableGenerated:{modules:[37314]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#05070a",color:"var(--muted)",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px"},children:(0,b.jsx)("span",{children:"Initializing terminal emulator..."})})}),i=(0,d.default)(async()=>{},{loadableGenerated:{modules:[1985]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--card)",border:"1px solid var(--border)",borderRadius:"12px",marginTop:"1.5rem"},children:(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Initializing prompt editor..."})})}),j=(0,d.default)(async()=>{},{loadableGenerated:{modules:[99026]},ssr:!1}),k=(0,d.default)(async()=>{},{loadableGenerated:{modules:[9949]},ssr:!1}),l=(0,d.default)(async()=>{},{loadableGenerated:{modules:[20032]},ssr:!1}),m=(0,d.default)(async()=>{},{loadableGenerated:{modules:[97722]},ssr:!1});a.s(["default",0,function(){let[a,d]=(0,c.useState)([]),[g,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(""),[C,D]=(0,c.useState)(3001),[E,F]=(0,c.useState)("0.2.19"),[G,H]=(0,c.useState)(null),I=a.filter(a=>"workspace-terminal"!==a.id),J=a.find(a=>a.id===g),K=I.some(a=>("claude-docker"===a.type||"aider-docker"===a.type)&&"running"===a.status),L=I.some(a=>"claude-ssh"===a.type&&"running"===a.status),M=async()=>{try{let a=await fetch("/api/sessions"),b=await a.json();b.sessions&&d(b.sessions),b.wsPort&&D(b.wsPort),b.originalCwd&&B(b.originalCwd),b.version&&F(b.version)}catch(a){console.error("Failed to fetch sessions:",a)}},N=async()=>{try{let a=await fetch("/api/recents");if(a.ok){let b=await a.json();b.success&&b.recents&&b.recents.lastSession&&H(b.recents.lastSession)}}catch(a){console.error("Failed to fetch recents:",a)}};(0,c.useEffect)(()=>{(async()=>{await M(),await N()})(),"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(a=>console.log("Service Worker registered:",a.scope)).catch(a=>console.error("Service Worker registration failed:",a));let a=setInterval(M,4e3);return()=>clearInterval(a)},[]);let O=async(a,b,c,d)=>{p(!0);try{let e=b;e||("claude"===a?e="Claude Local":"claude-docker"===a?e="Claude Docker":"claude-ssh"===a?e="Claude SSH":"aider"===a?e="Aider Local":"aider-docker"===a?e="Aider Docker":"mock"===a&&(e="Mock Session"));let f={type:a,name:e,workspaceRoot:c,scopedDirs:d};if(("aider"===a||"aider-docker"===a)&&!c)try{let a=await fetch("/api/context/aider");if(a.ok){let b=await a.json();b.success&&b.config&&(f.workspaceRoot=b.config.workspaceRoot,f.scopedDirs=b.config.scopedDirs)}}catch(a){console.error("Failed to load aider configuration before launch:",a)}let g=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),h=await g.json();h.success&&(await M(),n(h.session.id),H({type:a,name:e,workspaceRoot:c,scopedDirs:d}))}catch(a){console.error("Failed to launch session:",a)}finally{p(!1)}},P=async(a,b=!1)=>{try{let c=await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,delete:b})});(await c.json()).success&&(b&&g===a&&n(null),await M())}catch(a){console.error("Failed to stop session:",a)}};return(0,b.jsxs)("div",{className:`${e.default.container} ${J?e.default.containerActive:""}`,children:[(0,b.jsxs)("header",{className:e.default.header,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1.5rem"},children:[(0,b.jsx)("img",{src:"/logo.png",alt:"NeuralLoom Logo",style:{width:"160px",height:"160px",borderRadius:"16px",objectFit:"contain"}}),(0,b.jsxs)("div",{className:e.default.logoArea,children:[(0,b.jsx)("h1",{className:e.default.title,style:{margin:0,lineHeight:1.1},children:"NeuralLoom"}),(0,b.jsx)("span",{className:e.default.subtitle,children:"Unified AI Orchestrator & Context Bridge"})]})]}),(0,b.jsxs)("div",{className:e.default.statusIndicator,children:[(0,b.jsx)("span",{className:e.default.pulseDot}),(0,b.jsx)("span",{children:"Orchestrator Online"})]})]}),J?(0,b.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:(0,b.jsx)(m,{sessionId:J.id,workspaceRoot:J.workspaceRoot||"",scopedDirs:J.scopedDirs||[],onClose:()=>n(null),sessions:a,onSwitchSession:a=>n(a),onRefreshSessions:M,wsPort:C})}):(0,b.jsxs)("div",{className:e.default.dashboardGrid,children:[(0,b.jsxs)("main",{className:e.default.mainPanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Active AI Agents"}),0===I.length?(0,b.jsxs)("div",{className:"card",style:{padding:"3rem 1.5rem",textAlign:"center"},children:[(0,b.jsx)("p",{style:{color:"var(--muted)",marginBottom:"1.5rem"},children:"No active agent sessions in this workspace. Launch a Claude or Aider agent session to begin."}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},children:[G&&(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{O(G.type,G.name,G.workspaceRoot,G.scopedDirs)},disabled:o,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none",maxWidth:"200px"},title:`Re-launch: ${G.name||G.type}`,children:"⚡ Re-launch Last Session"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{z(!1),x(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Claude PTY"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{v(!1),t(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Aider PTY"})]}),(0,b.jsxs)("div",{style:{marginTop:"1.5rem",fontSize:"0.75rem",color:"var(--muted)"},children:["Want to verify layout features first?"," ",(0,b.jsx)("span",{onClick:()=>O("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Start simulated sandbox session"})]})]}):(0,b.jsx)("div",{className:e.default.agentGrid,children:I.map(a=>(0,b.jsxs)("div",{className:`${e.default.agentCard} card ${g===a.id?e.default.activeBorder:""}`,children:[(0,b.jsxs)("div",{className:e.default.agentHeader,children:[(0,b.jsx)("span",{className:e.default.agentName,children:a.name}),(0,b.jsx)("span",{className:`${e.default.agentBadge} ${"stopped"===a.status?e.default.stoppedBadge:""}`,children:a.status})]}),(0,b.jsxs)("div",{className:e.default.cardBody,children:[(0,b.jsxs)("p",{style:{fontSize:"0.825rem",color:"var(--muted)"},children:["ID: ",(0,b.jsx)("code",{style:{fontSize:"0.75rem"},children:a.id.substring(0,8)}),(0,b.jsx)("br",{}),"Type: ","claude"===a.type?"Claude Local PTY":"claude-docker"===a.type?"Claude Docker PTY":"claude-ssh"===a.type?"Claude SSH PTY":"aider"===a.type?"Aider Local PTY":"aider-docker"===a.type?"Aider Docker PTY":"mock"===a.type?"Simulated Mock PTY":"Unknown PTY",(0,b.jsx)("br",{}),"Logs: ",a.logsCount," captured lines"]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"1rem"},children:["running"===a.status?(0,b.jsx)("button",{onClick:()=>P(a.id,!1),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--danger)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--danger)"},children:"Stop"}):(0,b.jsx)("button",{onClick:()=>P(a.id,!0),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},children:"Delete"}),(0,b.jsx)("button",{onClick:()=>n(a.id),style:{flex:2,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"none",backgroundColor:g===a.id?"var(--border-focus)":"var(--primary)",fontSize:"0.75rem",fontWeight:600,color:"#fff"},children:g===a.id?"Connected":"Open Session"})]})]})]},a.id))})]}),g&&"workspace-terminal"!==g&&(0,b.jsxs)("section",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-focus)"},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(109, 40, 217, 0.08)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:["🖥️ Console Bridge — ",a.find(a=>a.id===g)?.name]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.find(a=>a.id===g)?.status==="stopped"&&(0,b.jsx)("button",{onClick:async()=>{try{let a=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:g})});if(a.ok)await M();else{let b=await a.json();alert(b.error||"Failed to restart session.")}}catch(a){console.error("Failed to restart session:",a),alert("Network error: failed to restart session.")}},style:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",boxShadow:"0 0 8px rgba(234, 179, 8, 0.2)"},title:"Restart the stopped session process runner",children:"⚡ Restart Session"}),(0,b.jsx)("button",{onClick:()=>n(null),style:{border:"none",background:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.75rem"},children:"Close Panel ✖"})]})]}),(0,b.jsx)(h,{sessionId:g,wsPort:C})]}),(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Workspace Shell Terminal"}),(0,b.jsxs)("div",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border)",padding:0},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.85rem"},children:["💻 Local Workspace Shell (CWD: ",A||"root",")"]}),(0,b.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--muted)"},children:"Pre-configured environment"})]}),(0,b.jsx)(h,{sessionId:"workspace-terminal",height:"300px",wsPort:C})]})]}),(0,b.jsxs)("section",{style:{marginTop:"2rem"},children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Shared Context Hub & Slash Commands"}),(0,b.jsxs)("div",{className:e.default.contextList,children:[(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Context & System Rules (/ccc)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Compiles AGENTS.md guidelines and project files folder hierarchy map."})]}),(0,b.jsx)("button",{onClick:async()=>{g&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:g,command:"/ccc"})})},disabled:!g,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.75rem",fontWeight:600,opacity:g?1:.5,cursor:g?"pointer":"not-allowed"},children:"🚀 Mount Context (/ccc)"})]}),(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Developer Prompt (/ccp)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Executes instructions written in .ai/neural-loom/cprompt.md."})]}),(0,b.jsx)("button",{onClick:async()=>{g&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:g,command:"/ccp"})})},disabled:!g,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.75rem",fontWeight:600,opacity:g?1:.5,cursor:g?"pointer":"not-allowed"},children:"⚡ Trigger Prompt (/ccp)"})]})]}),(0,b.jsx)(i,{})]}),(0,b.jsxs)("section",{style:{marginTop:"2rem"},children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Built-in Database Explorer & SQL Client"}),(0,b.jsx)("div",{className:"card",style:{padding:0,overflow:"hidden",height:"480px",border:"1px solid var(--border)"},children:(0,b.jsx)(f,{workspaceRoot:A||""})})]})]}),(0,b.jsxs)("aside",{className:e.default.sidePanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Execution Environments"}),(0,b.jsxs)("div",{className:e.default.envGrid,children:[(0,b.jsxs)("div",{className:e.default.envRow,children:[(0,b.jsx)("span",{className:e.default.envName,children:"💻 Local host OS"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:"var(--success)"},children:"Active"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:K?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🐳 Docker Sandbox"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:K?"var(--success)":"var(--muted)"},children:K?"Active":"Not Mounted"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:L?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🌐 Remote VM (SSH)"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:L?"var(--success)":"var(--muted)"},children:L?"Active":"Disconnected"})]})]})]}),(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{z(!1),x(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🤖"}),(0,b.jsx)("span",{children:"Launch Claude PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{z(!0),x(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(170, 72%, 40%) 0%, hsl(195, 100%, 40%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Docker PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>r(!0),disabled:o,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🌐"}),(0,b.jsx)("span",{children:"Launch SSH PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{v(!1),t(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐍"}),(0,b.jsx)("span",{children:"Launch Aider PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{v(!0),t(!0)},disabled:o,style:{background:"linear-gradient(135deg, hsl(195, 100%, 40%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Aider Docker"})]})]}),(0,b.jsxs)("section",{className:"card",style:{padding:"1.5rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsx)("h3",{style:{fontSize:"1rem",fontWeight:700},children:"Quick Actions"}),(0,b.jsxs)("ul",{style:{listStyle:"none",fontSize:"0.875rem",display:"flex",flexDirection:"column",gap:"0.5rem",color:"var(--muted)"},children:[(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Configure global API Keys"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Edit rules templates"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Inspect process locks"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]})]}),(0,b.jsxs)("div",{style:{marginTop:"1.2rem",textAlign:"center",fontSize:"0.72rem",color:"var(--muted)"},children:["Need to troubleshoot?"," ",(0,b.jsx)("span",{onClick:()=>O("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Launch simulated playground sandbox"})]})]})]})]}),(0,b.jsxs)("footer",{className:e.default.footer,children:[(0,b.jsxs)("span",{children:["NeuralLoom v",E," — Experimental AI Orchestrator Bridge"]}),(0,b.jsxs)("span",{children:["Directory: ",A||"Loading..."]})]}),q&&(0,b.jsx)(j,{onClose:()=>r(!1),onConfirmLaunch:()=>{r(!1),O("claude-ssh")}}),s&&(0,b.jsx)(k,{onClose:()=>t(!1),isDocker:u,onConfirmLaunch:()=>{t(!1),O(u?"aider-docker":"aider")}}),w&&(0,b.jsx)(l,{onClose:()=>x(!1),isDocker:y,onConfirmLaunch:(a,b,c)=>{x(!1),O(y?"claude-docker":"claude",a,b,c)}})]})}],40777)}];
|
|
2
7
|
|
|
3
8
|
//# sourceMappingURL=_0t7oqy6._.js.map
|