@egdesk/next-api-plugin 1.5.7 → 1.5.9
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/dist/generate-helpers.js +19 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/setup-userdata.js +30 -31
- package/package.json +1 -1
package/dist/generate-helpers.js
CHANGED
|
@@ -2165,6 +2165,24 @@ export type AiCallerCallOptions = {
|
|
|
2165
2165
|
maxOutputTokens?: number;
|
|
2166
2166
|
caller?: string;
|
|
2167
2167
|
responseSchema?: Record<string, any>;
|
|
2168
|
+
/** Gemini function declarations for tool use */
|
|
2169
|
+
tools?: Array<Record<string, any>>;
|
|
2170
|
+
/** Function-calling mode and restrictions */
|
|
2171
|
+
toolConfig?: {
|
|
2172
|
+
mode?: 'AUTO' | 'ANY' | 'NONE' | 'MODE_UNSPECIFIED';
|
|
2173
|
+
allowedFunctionNames?: string[];
|
|
2174
|
+
};
|
|
2175
|
+
/** Base64 strings (raw or data URLs) */
|
|
2176
|
+
images?: string[];
|
|
2177
|
+
/** Absolute paths — images, text files, .pdf, .docx, video (same rules as filesystem MCP) */
|
|
2178
|
+
filePaths?: string[];
|
|
2179
|
+
/** Inline file uploads when callers cannot use filePaths */
|
|
2180
|
+
files?: Array<{
|
|
2181
|
+
name: string;
|
|
2182
|
+
content: string;
|
|
2183
|
+
encoding?: 'utf8' | 'base64';
|
|
2184
|
+
mimeType?: string;
|
|
2185
|
+
}>;
|
|
2168
2186
|
/** Select a specific Google API key by name (as saved in EGDesk AI Keys Manager). Leave empty to use the default key. */
|
|
2169
2187
|
keyName?: ${(options.apiKeyNames ?? []).length > 0
|
|
2170
2188
|
? (options.apiKeyNames.map(n => `'${n}'`).join(' | ') + ' | (string & {})')
|
|
@@ -2173,6 +2191,7 @@ export type AiCallerCallOptions = {
|
|
|
2173
2191
|
|
|
2174
2192
|
/**
|
|
2175
2193
|
* Call Gemini and log token usage. Returns the AI response plus a usage summary.
|
|
2194
|
+
* Supports images, filePaths, and inline files (documents, text, video frames).
|
|
2176
2195
|
*/
|
|
2177
2196
|
export async function callAiCaller(prompt: string, options: AiCallerCallOptions = {}) {
|
|
2178
2197
|
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.
|
|
11
|
+
export declare const COMPATIBLE_APP_VERSION = "1.4.10";
|
|
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.
|
|
49
|
+
exports.COMPATIBLE_APP_VERSION = '1.4.10';
|
|
50
50
|
const fs = __importStar(require("fs"));
|
|
51
51
|
const path = __importStar(require("path"));
|
|
52
52
|
const setup_userdata_1 = require("./setup-userdata");
|
package/dist/setup-userdata.js
CHANGED
|
@@ -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
|
|
96
|
-
const
|
|
97
|
-
|
|
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
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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(
|
|
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
|
|
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
|