@prostgles/app 2.3.6-dev.1791886605 → 2.3.6-dev.1791916090

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.
Files changed (32) hide show
  1. package/client/build/js/733.bundle.js +1 -1
  2. package/client/build/js/main.bundle.js +2 -2
  3. package/dist/common/managedTableSchema.d.ts +4 -0
  4. package/dist/common/managedTableSchema.d.ts.map +1 -1
  5. package/dist/common/managedTableSchema.js.map +1 -1
  6. package/dist/common/mcp/db.mcp.schema.d.ts +2 -2
  7. package/dist/common/mcp/db.mcp.schema.d.ts.map +1 -1
  8. package/dist/common/mcp/db.mcp.schema.js +2 -2
  9. package/dist/common/mcp/db.mcp.schema.js.map +1 -1
  10. package/dist/common/prostglesMcp.d.ts +2 -2
  11. package/dist/server/package.json +2 -2
  12. package/dist/server/src/ConnectionManager/getFilesTableHook.d.ts +1 -0
  13. package/dist/server/src/ConnectionManager/getFilesTableHook.d.ts.map +1 -1
  14. package/dist/server/src/ConnectionManager/modifyClientSchema.d.ts.map +1 -1
  15. package/dist/server/src/ConnectionManager/modifyClientSchema.js +12 -5
  16. package/dist/server/src/ConnectionManager/modifyClientSchema.js.map +1 -1
  17. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Db.mcp.d.ts +2 -2
  18. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/schemas/getContainerToolProxyAccessInstructions.d.ts.map +1 -1
  19. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/schemas/getContainerToolProxyAccessInstructions.js +7 -9
  20. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/schemas/getContainerToolProxyAccessInstructions.js.map +1 -1
  21. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers.d.ts +4 -4
  22. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMcpHub.d.ts +4 -4
  23. package/dist/server/src/cli/cliTemplateFiles.js +45 -3
  24. package/dist/server/src/cli/cliTemplateFiles.js.map +1 -1
  25. package/dist/server/src/serverFunctions/askLLM/agentConstants.d.ts +1 -1
  26. package/dist/server/src/serverFunctions/askLLM/defaultPrompts/createAgenticWorkflow.prompt.d.ts.map +1 -1
  27. package/dist/server/src/serverFunctions/askLLM/defaultPrompts/createAgenticWorkflow.prompt.js +2 -0
  28. package/dist/server/src/serverFunctions/askLLM/defaultPrompts/createAgenticWorkflow.prompt.js.map +1 -1
  29. package/dist/server/src/serverFunctions/askLLM/getFullPrompt.d.ts.map +1 -1
  30. package/dist/server/src/serverFunctions/askLLM/getFullPrompt.js +26 -13
  31. package/dist/server/src/serverFunctions/askLLM/getFullPrompt.js.map +1 -1
  32. package/package.json +2 -2
@@ -10,9 +10,32 @@ const startProstgles_1 = require("../../init/startProstgles.js");
10
10
  const getFullPrompt = async ({ prompt, schema, connectionId, }) => {
11
11
  const connInfo = await index_1.connectionManager.getConnectionData(connectionId);
12
12
  const activeConnection = index_1.connectionManager.getActiveConnectionSilentFail(connectionId);
13
- const fileTableName = activeConnection?.dbConf.file_table_config?.fileTable;
13
+ const fileTableConfig = activeConnection?.dbConf.file_table_config;
14
+ const fileTableName = fileTableConfig?.fileTable;
15
+ const fileStorageInfo = !activeConnection ?
16
+ "File storage status is unavailable because the connection is not active. Do not assume it is enabled."
17
+ : !fileTableName ?
18
+ "File storage is disabled for this connection. Enable it in Connection configuration > File storage before uploading files. Creating a table named files does not enable managed storage."
19
+ : [
20
+ `File storage is enabled for this connection: managed file table ${JSON.stringify(fileTableName)}, storage type ${fileTableConfig.storageType.type}. File bytes live in configured server-side local storage or S3, outside PostgreSQL and outside the workflow container; the table stores metadata.`,
21
+ `Upload files using the normal database tools ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "insert")} or ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "insertMany")}. No separate upload tool or endpoint is needed. Storage enablement does not grant access: request the required tool and table permissions if missing. Raw SQL writes bypass managed file storage.`,
22
+ `Each upload requires original_name (including extension) and data. For JSON/MCP requests use data: { encoding: "base64", data: "<standard base64 file bytes>" }; do not use a bare base64 string, file path, URL, or data URL. A byte array or { type: "Buffer", data: [0, 1, 2] } is also accepted. Node.js Buffer values serialize to the latter form.`,
23
+ `Example ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "insert")} arguments: ${JSON.stringify({
24
+ tableName: fileTableName,
25
+ data: {
26
+ original_name: "hello.txt",
27
+ data: { encoding: "base64", data: "SGVsbG8=" },
28
+ },
29
+ returning: { id: 1, url: 1 },
30
+ })}. For insertMany, data is an array of these file objects.`,
31
+ `original_last_modified is optional (timestamp string). Custom metadata columns may also be written when permitted. Do not supply generated storage fields such as content_type, content_length, extension, url, or storage_key; Prostgles derives them.`,
32
+ `Replace file bytes through ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "update")} with a filter, original_name and data in the same upload format. Delete through ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "delete")}.`,
33
+ `In workflows use tableHandlers[${JSON.stringify(fileTableName)}].insert(file, { returning: { id: 1, url: 1 } }) or .insertMany(files, ...), with the file table included in databaseAccessDefinitions.tablePermissions. Read mounted input files with node:fs and pass their bytes; mounting a file alone does not upload it.`,
34
+ `Read file bytes through the returned url (resolve relative URLs against the Prostgles application URL and use authorized access). The database data column is a placeholder, not the stored bytes. DOCKER_MCP_ENDPOINT is a tool proxy, not the file-serving base URL.`,
35
+ `Text extraction is ${(fileTableConfig.extractText ?? !!fileTableConfig.annotationsTable) ? "enabled" : "disabled"}. When enabled, the document (docling) service asynchronously populates text_content (Markdown page array) and docling_metadata for supported files. Do not assume they are populated immediately; $array_element can access individual array elements.`,
36
+ ].join("\n");
14
37
  const schemaWithInfo = !schema ?
15
- "Schema is empty: there are no tables or views in the database"
38
+ "No database schema was supplied. This does not establish that the database is empty."
16
39
  : [
17
40
  "Below (in the next sql code block) is the schema of database they're currently working with expressed as create statements so you have a better idea of relationships and constraints.",
18
41
  "\n\nIMPORTANT: Wrapped in an sql code block below is the schema of EXISTING TABLES AND VIEWS from the database. Tables can be accessed through the database tools. The schema is expressed as create statements to give you a better idea of relationships and constraints.",
@@ -20,16 +43,6 @@ const getFullPrompt = async ({ prompt, schema, connectionId, }) => {
20
43
  `\n`,
21
44
  `When interacting with the tables through non raw SQL tools, it is important that you include double quotes for table names that need escaping. `,
22
45
  `For example: db.find(${JSON.stringify("my users")}); db.insert("tools");`,
23
- ...(!fileTableName ?
24
- []
25
- : [
26
- `The database has file storage enabled. The table named "${fileTableName}" stores only the necessary metadata and is used to facilitate file access:`,
27
- `- Files can be inserted only through ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "insert")} or ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "insertMany")} and only these properties can be inserted: "data", "original_name", "original_last_modified", "content_type"`,
28
- `- Files can be updated only through ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "update")} and only these properties can be updated: "data", "original_name", "original_last_modified", "content_type"`,
29
- `- Files can be deleted only through ${(0, mcpUtils_1.getProstglesMCPFullToolName)("db", "delete")}`,
30
- `- Actual file data can be accessed by fetching the "url". The "data" column in the database is just a dummy placeholder.`,
31
- `- The "text_content" Markdown page array and "docling_metadata" column can be used for text searching. They are populated by the document (docling) service which extracts text data from applicable file types. $array_element function can be used to access individual elements of the array.`,
32
- ]),
33
46
  `\n`,
34
47
  `When you need to reference records from the database use an anchor to ensure the user can quickly preview them.`,
35
48
  `The tag must be of this format for a single record: `,
@@ -40,7 +53,7 @@ const getFullPrompt = async ({ prompt, schema, connectionId, }) => {
40
53
  const promptWithContext = prompt
41
54
  .replaceAll(llmUtils_1.LLM_PROMPT_VARIABLES.PROSTGLES_SOFTWARE_NAME, (0, electronConfig_1.getElectronConfig)()?.isElectron ? "Prostgles Desktop" : "Prostgles UI")
42
55
  .replace(llmUtils_1.LLM_PROMPT_VARIABLES.TODAY, new Date().toISOString().split("T")[0])
43
- .replace(llmUtils_1.LLM_PROMPT_VARIABLES.SCHEMA, schemaWithInfo)
56
+ .replace(llmUtils_1.LLM_PROMPT_VARIABLES.SCHEMA, [schemaWithInfo, fileStorageInfo].join("\n\n"))
44
57
  .replace(llmUtils_1.LLM_PROMPT_VARIABLES.DB_TYPESCRIPT_SCHEMA, (0, llmUtils_1.wrapCode)("typescript", await (async () => {
45
58
  if (connInfo.is_state_db)
46
59
  return (await startProstgles_1.statePrgl?.getTSSchema())?.tsSchema ?? "";
@@ -1 +1 @@
1
- {"version":3,"file":"getFullPrompt.js","sourceRoot":"","sources":["../../../../../src/serverFunctions/askLLM/getFullPrompt.ts"],"names":[],"mappings":";;;AAAA,+CAAkE;AAClE,+CAA+D;AAC/D,iEAA8D;AAC9D,wDAAwD;AACxD,sCAA+C;AAC/C,6DAAqD;AAE9C,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,MAAM,EACN,MAAM,EACN,YAAY,GAKb,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,MAAM,yBAAiB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACzE,MAAM,gBAAgB,GACpB,yBAAiB,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAChE,MAAM,aAAa,GAAG,gBAAgB,EAAE,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC5E,MAAM,cAAc,GAClB,CAAC,MAAM,CAAC,CAAC;QACP,+DAA+D;QACjE,CAAC,CAAC;YACE,wLAAwL;YACxL,6QAA6Q;YAC7Q,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC;YACvB,IAAI;YACJ,iJAAiJ;YACjJ,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,wBAAwB;YAC1E,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC;gBAClB,EAAE;gBACJ,CAAC,CAAC;oBACE,2DAA2D,aAAa,6EAA6E;oBACrJ,wCAAwC,IAAA,sCAA2B,EAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,IAAA,sCA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"Prostgles UI runtime and configurable PostgreSQL dashboard",
5
5
  "main": "dist/server/src/schemaConfig.js",
6
6
  "bin": {
@@ -59,7 +59,7 @@
59
59
  "pidusage": "^4.0.1",
60
60
  "prettier": "^3.9.9",
61
61
  "prostgles-client": "^4.0.413",
62
- "prostgles-server": "^4.2.665",
62
+ "prostgles-server": "^4.2.667",
63
63
  "qrcode": "^1.5.4",
64
64
  "smtp-server": "^3.19.18",
65
65
  "socket.io": "^4.8.4",