From 6d74e6b1fedf18b11ea12ba38164fcd146fdba4b Mon Sep 17 00:00:00 2001 From: Nicholas Wengel Date: Thu, 15 Feb 2024 00:40:12 -0700 Subject: [PATCH] fix: a bunch of bugs, commit residuals such as npm install pg --- .../providers/PostgresContextProvider.ts | 97 ++++++------ core/package-lock.json | 148 ++++++++++++++++++ core/package.json | 1 + core/yarn.lock | 117 ++++++++++++-- docs/static/schemas/config.json | 67 +++++++- extensions/vscode/continue_rc_schema.json | 73 ++++++++- extensions/vscode/package-lock.json | 5 +- extensions/vscode/package.json | 2 +- extensions/vscode/yarn.lock | 24 ++- gui/package-lock.json | 1 + 10 files changed, 456 insertions(+), 79 deletions(-) diff --git a/core/context/providers/PostgresContextProvider.ts b/core/context/providers/PostgresContextProvider.ts index b76748a64..34c829f4d 100644 --- a/core/context/providers/PostgresContextProvider.ts +++ b/core/context/providers/PostgresContextProvider.ts @@ -7,9 +7,6 @@ import { ContextSubmenuItem, } from "../.."; -const ALL_TABLES = "__all_tables"; -const DEFAULT_SAMPLE_ROWS = 3; - class PostgresContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { title: "postgres", @@ -18,6 +15,9 @@ class PostgresContextProvider extends BaseContextProvider { type: "submenu", }; + static ALL_TABLES = "__all_tables"; + static DEFAULT_SAMPLE_ROWS = 3; + constructor(options: { host: string; port: number; @@ -41,6 +41,20 @@ class PostgresContextProvider extends BaseContextProvider { }); } + private async getTableNames(pool: any): Promise { + const schema = this.options.schema ?? "public"; + var tablesInfoQuery = ` +SELECT table_schema, table_name +FROM information_schema.tables`; + if (schema != null) { + tablesInfoQuery += ` WHERE table_schema = '${schema}'`; + } + const { rows: tablesInfo } = await pool.query(tablesInfoQuery); + return tablesInfo.map( + (tableInfo: any) => `${tableInfo.table_schema}.${tableInfo.table_name}` + ); + } + async getContextItems( query: string = "", _: ContextProviderExtras = {} as ContextProviderExtras @@ -50,49 +64,48 @@ class PostgresContextProvider extends BaseContextProvider { try { const contextItems: ContextItem[] = []; - var schemaQuery = ` -SELECT column_name, data_type, character_maximum_length -FROM INFORMATION_SCHEMA.COLUMNS`; - if (this.options.query != ALL_TABLES) { + const tableNames = []; + if (query === PostgresContextProvider.ALL_TABLES) { + tableNames.push(...(await this.getTableNames(pool))); + } else { + tableNames.push(query); + } + + for (const tableName of tableNames) { // Get the table schema - const tableName = query; if (!tableName.includes(".")) { throw new Error( `Table name must be in format schema.table_name, got ${tableName}` ); } - schemaQuery += `WHERE table_name = '${tableName.split(".")[1]}'`; - } - - const { rows: tableSchemas } = await pool.query(schemaQuery); - - var prompt = `Postgres schema for database ${this.options.database}`; - for (const tableSchema of tableSchemas) { - const tableName = query; + var schemaQuery = ` +SELECT column_name, data_type, character_maximum_length +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_schema = '${tableName.split(".")[0]}' + AND table_name = '${tableName.split(".")[1]}'`; + console.log("schemaQuery", schemaQuery); + const { rows: tableSchema } = await pool.query(schemaQuery); // Get the sample rows - const sampleRows = this.options.sampleRows ?? DEFAULT_SAMPLE_ROWS; + const sampleRows = + this.options.sampleRows ?? + PostgresContextProvider.DEFAULT_SAMPLE_ROWS; const { rows: sampleRowResults } = await pool.query(` SELECT * FROM ${tableName} LIMIT ${sampleRows}`); // Create prompt from the table schema and sample rows - var prompt = `Table schema for ${tableName}:\n${JSON.stringify( - tableSchema, - null, - 2 - )}\n\n`; + var prompt = `Postgres schema for database ${this.options.database} table ${tableName}:\n`; + prompt += `${JSON.stringify(tableSchema, null, 2)}\n\n`; prompt += `Sample rows: ${JSON.stringify(sampleRowResults, null, 2)}`; - } - contextItems.push({ - name: `${this.options.database}-${query}-schema-and-sample-rows`, - description: `Schema and sample rows for ${ - query == ALL_TABLES ? "all table" : query - } in ${this.options.database} database`, - content: prompt, - }); + contextItems.push({ + name: `${this.options.database}-${tableName}-schema-and-sample-rows`, + description: `Schema and sample rows for table ${tableName}`, + content: prompt, + }); + } return contextItems; } catch (error) { @@ -106,32 +119,22 @@ LIMIT ${sampleRows}`); ): Promise { const pool = await this.getPool(); - const schema = this.options.schema ?? "public"; - var tablesInfoQuery = ` -SELECT table_schema, table_name -FROM information_schema.tables`; - if (schema != null) { - tablesInfoQuery += ` WHERE table_schema = '${schema}'`; - } - const tablesInfo = await pool.query(tablesInfoQuery).rows; - try { const contextItems: ContextSubmenuItem[] = []; + const tableNames = await this.getTableNames(pool); - for (const tableInfo of tablesInfo) { - const tableName = `${tableInfo.table_schema}.${tableInfo.table_name}`; - + for (const tableName of tableNames) { contextItems.push({ id: tableName, title: tableName, description: `Schema from ${tableName} and ${this.options.sampleRows} sample rows.`, }); - contextItems.push({ - id: ALL_TABLES, - title: "All tables", - description: `Schema from all tables and ${this.options.sampleRows} sample rows each.`, - }); } + contextItems.push({ + id: PostgresContextProvider.ALL_TABLES, + title: "All tables", + description: `Schema from all tables and ${this.options.sampleRows} sample rows each.`, + }); return contextItems; } catch (error) { diff --git a/core/package-lock.json b/core/package-lock.json index 6ea8b6f89..ee487e639 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -22,6 +22,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "openai": "^4.20.1", + "pg": "^8.11.3", "posthog-node": "^3.6.2", "replicate": "^0.26.0", "socket.io-client": "^4.7.3", @@ -2471,6 +2472,14 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", + "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", + "engines": { + "node": ">=4" + } + }, "node_modules/cacache": { "version": "15.3.0", "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", @@ -5598,6 +5607,11 @@ "node": ">=6" } }, + "node_modules/packet-reader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", + "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" + }, "node_modules/pad-left": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz", @@ -5683,6 +5697,89 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/pg": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.11.3.tgz", + "integrity": "sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.6.2", + "pg-pool": "^3.6.1", + "pg-protocol": "^1.6.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.1.1" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz", + "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz", + "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz", + "integrity": "sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz", + "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "dependencies": { + "split2": "^4.1.0" + } + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -5727,6 +5824,41 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/posthog-node": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz", @@ -6382,6 +6514,14 @@ "source-map": "^0.6.0" } }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -7105,6 +7245,14 @@ "node": ">=0.4.0" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/core/package.json b/core/package.json index dfb3e6f34..f0185b4a4 100644 --- a/core/package.json +++ b/core/package.json @@ -31,6 +31,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "openai": "^4.20.1", + "pg": "^8.11.3", "posthog-node": "^3.6.2", "replicate": "^0.26.0", "socket.io-client": "^4.7.3", diff --git a/core/yarn.lock b/core/yarn.lock index 295c042b7..08f24a731 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -321,10 +321,10 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@esbuild/darwin-arm64@0.19.11": +"@esbuild/linux-x64@0.19.11": version "0.19.11" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz" - integrity sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz" + integrity sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA== "@gar/promisify@^1.0.1": version "1.1.3" @@ -576,10 +576,10 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@lancedb/vectordb-darwin-arm64@0.4.3": +"@lancedb/vectordb-linux-x64-gnu@0.4.3": version "0.4.3" - resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.3.tgz" - integrity sha512-47CvvSaV1EdUsFEpXUJApTk+hMzAhCxVizipCFUlXCgcmzpCDL86wNgJij/X9a+j6zADhIX//Lsu0qd/an/Bpw== + resolved "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.3.tgz" + integrity sha512-OBx3WF3pK0xNfFJeErmuD9R2QWLa3XdeZspyTsIrQmBDeKj3HKh8y7Scpx4NH5Y09+9JNqRRKRZN7OqWTYhITg== "@neon-rs/load@^0.0.74": version "0.0.74" @@ -1238,6 +1238,11 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer-writer@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz" + integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== + buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" @@ -1918,11 +1923,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" @@ -3178,6 +3178,11 @@ p-try@^2.0.0: resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +packet-reader@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz" + integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== + pad-left@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz" @@ -3230,6 +3235,64 @@ path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +pg-cloudflare@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz" + integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== + +pg-connection-string@^2.6.2: + version "2.6.2" + resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz" + integrity sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA== + +pg-int8@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz" + integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== + +pg-pool@^3.6.1: + version "3.6.1" + resolved "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz" + integrity sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og== + +pg-protocol@^1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz" + integrity sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q== + +pg-types@^2.1.0: + version "2.2.0" + resolved "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz" + integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== + dependencies: + pg-int8 "1.0.1" + postgres-array "~2.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.4" + postgres-interval "^1.1.0" + +pg@^8.11.3, pg@>=8.0: + version "8.11.3" + resolved "https://registry.npmjs.org/pg/-/pg-8.11.3.tgz" + integrity sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.6.2" + pg-pool "^3.6.1" + pg-protocol "^1.6.0" + pg-types "^2.1.0" + pgpass "1.x" + optionalDependencies: + pg-cloudflare "^1.1.1" + +pgpass@1.x: + version "1.0.5" + resolved "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== + dependencies: + split2 "^4.1.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" @@ -3257,6 +3320,28 @@ platform@^1.3.6: resolved "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz" integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg== +postgres-array@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz" + integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz" + integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== + +postgres-date@~1.0.4: + version "1.0.7" + resolved "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz" + integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== + +postgres-interval@^1.1.0: + version "1.2.0" + resolved "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz" + integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== + dependencies: + xtend "^4.0.0" + posthog-node@^3.6.2: version "3.6.2" resolved "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz" @@ -3611,6 +3696,11 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +split2@^4.1.0: + version "4.2.0" + resolved "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" @@ -4056,6 +4146,11 @@ xmlhttprequest-ssl@~2.0.0: resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz" integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== +xtend@^4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 746737b6a..4e3514bb3 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -989,7 +989,8 @@ "docs", "tree", "highlights", - "outline" + "outline", + "postgres" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1007,7 +1008,8 @@ "Display a file tree of the current workspace", "Include a repo map showing important code objects", "Displays important snippets of code from the currently open files", - "Displays definition lines from the currently open files" + "Displays definition lines from the currently open files", + "References Postgres table schema and sample rows" ], "type": "string" }, @@ -1169,6 +1171,67 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "postgres" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "host": { + "title": "Host", + "description": "Database host", + "default": "localhost", + "type": "string" + }, + "port": { + "title": "Port", + "description": "Database port", + "default": 5432, + "type": "integer" + }, + "user": { + "title": "User", + "description": "Database user", + "default": "postgres", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Database password", + "type": "string" + }, + "database": { + "title": "Database", + "description": "Database name", + "default": "postgres", + "type": "string" + }, + "schema": { + "title": "Schema", + "description": "Database schema", + "default": "public", + "type": "string" + }, + "sampleRows": { + "title": "Sample Rows", + "description": "Number of rows to sample from the database", + "default": 3, + "type": "integer" + } + } + } + }, + "required": ["host", "port", "user", "password", "database"] + } } ], "required": ["name"] diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index ea2a834e5..b63bef3c5 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1132,7 +1132,8 @@ "docs", "tree", "highlights", - "outline" + "outline", + "postgres" ], "markdownEnumDescriptions": [ "Reference the contents of the current changes as given by `git diff`", @@ -1150,7 +1151,8 @@ "Display a file tree of the current workspace", "Include a repo map showing important code objects", "Displays important snippets of code from the currently open files", - "Displays definition lines from the currently open files" + "Displays definition lines from the currently open files", + "References Postgres table schema and sample rows" ], "type": "string" }, @@ -1344,6 +1346,73 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "postgres" + ] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "host": { + "title": "Host", + "description": "Database host", + "default": "localhost", + "type": "string" + }, + "port": { + "title": "Port", + "description": "Database port", + "default": 5432, + "type": "integer" + }, + "user": { + "title": "User", + "description": "Database user", + "default": "postgres", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Database password", + "type": "string" + }, + "database": { + "title": "Database", + "description": "Database name", + "default": "postgres", + "type": "string" + }, + "schema": { + "title": "Schema", + "description": "Database schema", + "default": "public", + "type": "string" + }, + "sampleRows": { + "title": "Sample Rows", + "description": "Number of rows to sample from the database", + "default": 3, + "type": "integer" + } + } + } + }, + "required": [ + "host", + "port", + "user", + "password", + "database" + ] + } } ], "required": [ diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index f56f37b61..749d267da 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.65", + "version": "0.9.67", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.65", + "version": "0.9.67", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -98,6 +98,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "openai": "^4.20.1", + "pg": "^8.11.3", "posthog-node": "^3.6.2", "replicate": "^0.26.0", "socket.io-client": "^4.7.3", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 6c45752fc..977787e74 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.9.65", + "version": "0.9.67", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 4d470fefc..57f43ac2a 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -368,15 +368,15 @@ tar "^6.0.5" yargs "^17.0.1" -"@esbuild/darwin-arm64@0.17.19": +"@esbuild/linux-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz" - integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz" + integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== -"@esbuild/darwin-arm64@0.18.20": +"@esbuild/linux-x64@0.18.20": version "0.18.20" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz" - integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz" + integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" @@ -696,10 +696,10 @@ resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz" integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== -"@lancedb/vectordb-darwin-arm64@*", "@lancedb/vectordb-darwin-arm64@0.4.9": +"@lancedb/vectordb-linux-x64-gnu@0.4.9": version "0.4.9" - resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.9.tgz" - integrity sha512-u56TXU0hvdLbknGwC7Ebza3/CUFeCTkoCy/sC6h0FtOGya+NV7jraAeXEwDzoZbfW08VYYxnp3TsCcpNU9lpTA== + resolved "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.9.tgz" + integrity sha512-HbvSym1WXgTTDb+gfEaD9R/x+NbI6PWM8PrqFaAXkhm2Zzi/eL9eHBl2vgTyYFbzUvucTYnHZzT8a8FzCuvW0A== "@lukeed/csprng@^1.0.0": version "1.1.0" @@ -2324,6 +2324,7 @@ core-util-is@1.0.2: node-html-markdown "^1.3.0" ollama "^0.4.6" openai "^4.20.1" + pg "^8.11.3" posthog-node "^3.6.2" replicate "^0.26.0" socket.io-client "^4.7.3" @@ -3341,11 +3342,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/gui/package-lock.json b/gui/package-lock.json index f1f681629..3443b0811 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -86,6 +86,7 @@ "node-html-markdown": "^1.3.0", "ollama": "^0.4.6", "openai": "^4.20.1", + "pg": "^8.11.3", "posthog-node": "^3.6.2", "replicate": "^0.26.0", "socket.io-client": "^4.7.3",