@egdesk/next-api-plugin 1.5.7 → 1.5.8

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.
@@ -2165,6 +2165,17 @@ export type AiCallerCallOptions = {
2165
2165
  maxOutputTokens?: number;
2166
2166
  caller?: string;
2167
2167
  responseSchema?: Record<string, any>;
2168
+ /** Base64 strings (raw or data URLs) */
2169
+ images?: string[];
2170
+ /** Absolute paths — images, text files, .pdf, .docx, video (same rules as filesystem MCP) */
2171
+ filePaths?: string[];
2172
+ /** Inline file uploads when callers cannot use filePaths */
2173
+ files?: Array<{
2174
+ name: string;
2175
+ content: string;
2176
+ encoding?: 'utf8' | 'base64';
2177
+ mimeType?: string;
2178
+ }>;
2168
2179
  /** Select a specific Google API key by name (as saved in EGDesk AI Keys Manager). Leave empty to use the default key. */
2169
2180
  keyName?: ${(options.apiKeyNames ?? []).length > 0
2170
2181
  ? (options.apiKeyNames.map(n => `'${n}'`).join(' | ') + ' | (string & {})')
@@ -2173,6 +2184,7 @@ export type AiCallerCallOptions = {
2173
2184
 
2174
2185
  /**
2175
2186
  * Call Gemini and log token usage. Returns the AI response plus a usage summary.
2187
+ * Supports images, filePaths, and inline files (documents, text, video frames).
2176
2188
  */
2177
2189
  export async function callAiCaller(prompt: string, options: AiCallerCallOptions = {}) {
2178
2190
  return callAiCallerTool('ai_caller_call', { prompt, ...options });
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * The minimum EGDesk app version this plugin version is compatible with.
9
9
  * The app checks this at setup time and warns on mismatch.
10
10
  */
11
- export declare const COMPATIBLE_APP_VERSION = "1.4.5";
11
+ export declare const COMPATIBLE_APP_VERSION = "1.4.9";
12
12
  export interface SetupOptions {
13
13
  egdeskUrl?: string;
14
14
  /** Production EGDesk server URL — written to .env.production.local. Falls back to egdeskUrl. */
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ exports.setupNextApiPlugin = setupNextApiPlugin;
46
46
  * The minimum EGDesk app version this plugin version is compatible with.
47
47
  * The app checks this at setup time and warns on mismatch.
48
48
  */
49
- exports.COMPATIBLE_APP_VERSION = '1.4.5';
49
+ exports.COMPATIBLE_APP_VERSION = '1.4.9';
50
50
  const fs = __importStar(require("fs"));
51
51
  const path = __importStar(require("path"));
52
52
  const setup_userdata_1 = require("./setup-userdata");
@@ -92,43 +92,42 @@ async function discoverTables(egdeskUrl = 'http://localhost:8080', apiKey, egdes
92
92
  if (!data || !data.tables) {
93
93
  return [];
94
94
  }
95
- // Fetch schema for each table to get column names
96
- const tablesWithColumns = [];
97
- for (const table of data.tables) {
95
+ // Fetch all schemas in one batch request
96
+ const schemaResponse = await fetch(`${egdeskUrl}/user-data/tools/call`, {
97
+ method: 'POST',
98
+ headers,
99
+ body: JSON.stringify({
100
+ tool: 'user_data_get_schemas_batch',
101
+ arguments: {
102
+ tableNames: data.tables.map((table) => table.tableName)
103
+ }
104
+ })
105
+ });
106
+ const schemaByTableName = new Map();
107
+ if (schemaResponse.ok) {
98
108
  try {
99
- const schemaResponse = await fetch(`${egdeskUrl}/user-data/tools/call`, {
100
- method: 'POST',
101
- headers,
102
- body: JSON.stringify({
103
- tool: 'user_data_get_schema',
104
- arguments: { tableName: table.tableName }
105
- })
106
- });
107
- if (schemaResponse.ok) {
108
- const schemaResult = (await schemaResponse.json());
109
- const schemaContent = schemaResult.result?.content?.[0]?.text;
110
- const schemaData = schemaContent ? JSON.parse(schemaContent) : null;
111
- tablesWithColumns.push({
112
- id: table.id,
113
- tableName: table.tableName,
114
- displayName: table.displayName,
115
- description: table.description,
116
- rowCount: table.rowCount,
117
- columnCount: table.columnCount,
118
- columns: schemaData?.schema?.map((col) => col.name) || []
119
- });
109
+ const schemaResult = (await schemaResponse.json());
110
+ const schemaContent = schemaResult.result?.content?.[0]?.text;
111
+ const schemaData = schemaContent ? JSON.parse(schemaContent) : null;
112
+ const schemas = schemaData?.schemas ?? {};
113
+ for (const [tableName, schemaInfo] of Object.entries(schemas)) {
114
+ const columns = schemaInfo?.schema?.map((col) => col.name) || [];
115
+ schemaByTableName.set(tableName, columns);
120
116
  }
121
117
  }
122
118
  catch (error) {
123
- console.warn(`Failed to fetch schema for ${table.tableName}:`, error);
124
- // Add table without column info
125
- tablesWithColumns.push({
126
- ...table,
127
- columns: []
128
- });
119
+ console.warn('Failed to parse batch schema response:', error);
129
120
  }
130
121
  }
131
- return tablesWithColumns;
122
+ return data.tables.map((table) => ({
123
+ id: table.id,
124
+ tableName: table.tableName,
125
+ displayName: table.displayName,
126
+ description: table.description,
127
+ rowCount: table.rowCount,
128
+ columnCount: table.columnCount,
129
+ columns: schemaByTableName.get(table.tableName) || []
130
+ }));
132
131
  }
133
132
  catch (error) {
134
133
  // Connection refused / server not yet up — treat as no tables rather than a hard failure
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egdesk/next-api-plugin",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",