@egdesk/next-api-plugin 1.5.61 → 1.5.69
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/README.md +7 -8
- package/dist/generate-helpers.js +329 -179
- package/dist/generate-middleware.js +3 -3
- package/dist/generate-proxy.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Next.js plugin for EGDesk database proxy integration. Provides middleware-based
|
|
|
6
6
|
|
|
7
7
|
- 🔒 CORS-free database access via Next.js middleware (or `proxy.ts` on Next.js 16+)
|
|
8
8
|
- 🌐 Works in both local and tunneled environments
|
|
9
|
-
- 📝 Type-safe table definitions and helper functions (user data, FinanceHub,
|
|
9
|
+
- 📝 Type-safe table definitions and helper functions (user data, FinanceHub, business identity / company research, browser recording replay + live browse)
|
|
10
10
|
- 🚀 Auto-discovery of database tables
|
|
11
11
|
- 🔧 Zero configuration after setup
|
|
12
12
|
|
|
@@ -170,7 +170,7 @@ The plugin generates `middleware.ts` or `proxy.ts` that intercepts special paths
|
|
|
170
170
|
| `__browser_recording_proxy` | `POST /browser-recording/tools/call` |
|
|
171
171
|
|
|
172
172
|
**Browser recording file upload:** `listBrowserRecordingSites` → `openBrowserRecordingAccount` (navigate-only sites use `accountKey: "__unknown_account__"`) → `inspectBrowserRecordingPage` → `uploadBrowserRecordingFile(sessionId, absPath, elementIndex?)`. Prefer the hidden `[file input]` index. `filePath` must exist on the EGDesk machine. Persist with `saveBrowserRecordingSession`. Replay override: `fileUploadsByIndex`.
|
|
173
|
-
| `
|
|
173
|
+
| `__business_identity_proxy` | `POST /business-identity/tools/call` (snapshots, product catalog, brand faces, company research) |
|
|
174
174
|
|
|
175
175
|
**User-data request flow:**
|
|
176
176
|
1. Your code calls `queryTable()` or another helper
|
|
@@ -210,16 +210,15 @@ listTables()
|
|
|
210
210
|
// Get table schema
|
|
211
211
|
getTableSchema(tableName: string)
|
|
212
212
|
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
listKnowledgeDocuments(snapshotId: string, category?: 'hierarchy' | 'process' | 'policy' | 'note')
|
|
216
|
-
getKnowledgeDocument(documentId: string)
|
|
217
|
-
searchKnowledgeContent(snapshotId: string, searchText: string, category?: ...)
|
|
218
|
-
getKnowledgeByCategory(snapshotId: string, category: ...)
|
|
213
|
+
// Business Identity / Company Research (MCP)
|
|
214
|
+
callBusinessIdentityTool(toolName: string, args?: Record<string, any>)
|
|
219
215
|
listBusinessIdentitySnapshots(brandKey?: string)
|
|
220
216
|
getBusinessIdentitySnapshot(snapshotId: string)
|
|
221
217
|
getBusinessIdentityCompanyInfo(snapshotId: string)
|
|
222
218
|
getBusinessIdentityServicesProducts(snapshotId: string)
|
|
219
|
+
listBusinessIdentityCatalogProducts(snapshotId: string)
|
|
220
|
+
getBusinessIdentityCatalogProduct(snapshotId: string, productIdOrName: string, includeImages?: boolean)
|
|
221
|
+
listBusinessIdentityFaces(snapshotId: string, includePortraitBase64?: boolean)
|
|
223
222
|
listCompanyResearch(status?: 'completed' | 'failed' | 'in_progress')
|
|
224
223
|
getCompanyResearchById(researchId: string)
|
|
225
224
|
getCompanyResearchByDomain(domain: string)
|
package/dist/generate-helpers.js
CHANGED
|
@@ -218,6 +218,8 @@ export type WorkspaceVisitorCallOptions = {
|
|
|
218
218
|
visitorSessionId?: string;
|
|
219
219
|
/** Origin the visitor logged in from. Required on the server (no window). */
|
|
220
220
|
visitorOrigin?: string;
|
|
221
|
+
/** Owner MCP: use personal Google login before service account when both are configured. */
|
|
222
|
+
preferOAuth?: boolean;
|
|
221
223
|
};
|
|
222
224
|
|
|
223
225
|
function getBrowserVisitorSessionId(): string | null {
|
|
@@ -276,8 +278,10 @@ function withVisitorToolArgs(
|
|
|
276
278
|
args: Record<string, any>,
|
|
277
279
|
options: WorkspaceVisitorCallOptions = {},
|
|
278
280
|
): Record<string, any> {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
const out = { ...args };
|
|
282
|
+
if (options.asVisitor) out.asVisitor = true;
|
|
283
|
+
if (options.preferOAuth !== undefined) out.preferOAuth = options.preferOAuth;
|
|
284
|
+
return out;
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
async function callWorkspaceMcpTool(
|
|
@@ -315,7 +319,30 @@ async function callWorkspaceMcpTool(
|
|
|
315
319
|
|
|
316
320
|
/**
|
|
317
321
|
* Parse EGDesk MCP \`/tools/call\` JSON so \`error\` is shown even when HTTP status is 500.
|
|
322
|
+
* Envelope \`success: true\` is not enough — add_account uses accountAdded.
|
|
318
323
|
*/
|
|
324
|
+
function finalizeEgdeskMcpPayload(parsed: any): any {
|
|
325
|
+
const pending =
|
|
326
|
+
parsed &&
|
|
327
|
+
typeof parsed === 'object' &&
|
|
328
|
+
(parsed.requiresConfirmation === true ||
|
|
329
|
+
(Array.isArray(parsed.needs_more_fields) && parsed.needs_more_fields.length > 0));
|
|
330
|
+
if (
|
|
331
|
+
parsed &&
|
|
332
|
+
typeof parsed === 'object' &&
|
|
333
|
+
parsed.accountAdded === false &&
|
|
334
|
+
!pending
|
|
335
|
+
) {
|
|
336
|
+
throw new Error(
|
|
337
|
+
parsed.agentFeedback ||
|
|
338
|
+
parsed.message ||
|
|
339
|
+
parsed.error ||
|
|
340
|
+
'browser_recording_add_account did not add the account'
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
return parsed;
|
|
344
|
+
}
|
|
345
|
+
|
|
319
346
|
async function parseEgdeskMcpToolResponse(response: Response): Promise<any> {
|
|
320
347
|
const result = await response.json().catch(() => null);
|
|
321
348
|
|
|
@@ -349,13 +376,17 @@ async function parseEgdeskMcpToolResponse(response: Response): Promise<any> {
|
|
|
349
376
|
}
|
|
350
377
|
|
|
351
378
|
const content = result.result?.content?.[0]?.text;
|
|
352
|
-
if (!content)
|
|
379
|
+
if (!content) {
|
|
380
|
+
if (result.result?.isError) throw new Error('EGDesk tool failed');
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
let parsed: any;
|
|
353
384
|
try {
|
|
354
|
-
|
|
385
|
+
parsed = JSON.parse(content);
|
|
355
386
|
} catch {
|
|
356
|
-
|
|
357
|
-
return content;
|
|
387
|
+
parsed = content;
|
|
358
388
|
}
|
|
389
|
+
return finalizeEgdeskMcpPayload(parsed);
|
|
359
390
|
}
|
|
360
391
|
|
|
361
392
|
async function parseEgdeskHttpResponse(response: Response): Promise<any> {
|
|
@@ -1589,16 +1620,16 @@ export async function deleteFinanceHubBankProductRows(options: {
|
|
|
1589
1620
|
}
|
|
1590
1621
|
|
|
1591
1622
|
// ==========================================
|
|
1592
|
-
//
|
|
1623
|
+
// BUSINESS IDENTITY / COMPANY RESEARCH (MCP)
|
|
1593
1624
|
// ==========================================
|
|
1594
1625
|
|
|
1595
1626
|
/**
|
|
1596
|
-
* Call EGDesk
|
|
1627
|
+
* Call EGDesk Business Identity MCP tool (snapshots, product catalog, brand faces).
|
|
1597
1628
|
*
|
|
1598
|
-
* - Server: \`POST {apiUrl}/
|
|
1599
|
-
* - Client: \`POST /
|
|
1629
|
+
* - Server: \`POST {apiUrl}/business-identity/tools/call\`
|
|
1630
|
+
* - Client: \`POST /__business_identity_proxy\` (see proxy.ts / middleware)
|
|
1600
1631
|
*/
|
|
1601
|
-
export async function
|
|
1632
|
+
export async function callBusinessIdentityTool(
|
|
1602
1633
|
toolName: string,
|
|
1603
1634
|
args: Record<string, any> = {}
|
|
1604
1635
|
): Promise<any> {
|
|
@@ -1611,13 +1642,13 @@ export async function callInternalKnowledgeTool(
|
|
|
1611
1642
|
const apiUrl =
|
|
1612
1643
|
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
|
|
1613
1644
|
EGDESK_CONFIG.apiUrl;
|
|
1614
|
-
response = await fetch(\`\${apiUrl}/
|
|
1645
|
+
response = await fetch(\`\${apiUrl}/business-identity/tools/call\`, {
|
|
1615
1646
|
method: 'POST',
|
|
1616
1647
|
headers: buildServerEgdeskHeaders(),
|
|
1617
1648
|
body
|
|
1618
1649
|
});
|
|
1619
1650
|
} else {
|
|
1620
|
-
response = await apiFetch('/
|
|
1651
|
+
response = await apiFetch('/__business_identity_proxy', {
|
|
1621
1652
|
method: 'POST',
|
|
1622
1653
|
headers: { 'Content-Type': 'application/json' },
|
|
1623
1654
|
body
|
|
@@ -1627,93 +1658,57 @@ export async function callInternalKnowledgeTool(
|
|
|
1627
1658
|
return parseEgdeskMcpToolResponse(response);
|
|
1628
1659
|
}
|
|
1629
1660
|
|
|
1630
|
-
/** List
|
|
1631
|
-
export async function
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
) {
|
|
1635
|
-
return callInternalKnowledgeTool('knowledge_list_documents', {
|
|
1636
|
-
snapshotId,
|
|
1637
|
-
...(category != null ? { category } : {})
|
|
1661
|
+
/** List business identity snapshots (optional brand filter) */
|
|
1662
|
+
export async function listBusinessIdentitySnapshots(brandKey?: string) {
|
|
1663
|
+
return callBusinessIdentityTool('bi_list_snapshots', {
|
|
1664
|
+
...(brandKey != null ? { brandKey } : {})
|
|
1638
1665
|
});
|
|
1639
1666
|
}
|
|
1640
1667
|
|
|
1641
|
-
/**
|
|
1642
|
-
export async function
|
|
1643
|
-
return
|
|
1668
|
+
/** Full snapshot by ID (identity JSON, SEO/SSL analysis, etc.) */
|
|
1669
|
+
export async function getBusinessIdentitySnapshot(snapshotId: string) {
|
|
1670
|
+
return callBusinessIdentityTool('bi_get_snapshot', { snapshotId });
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
/** Company info slice from a snapshot (contact, structure, partners, industries) */
|
|
1674
|
+
export async function getBusinessIdentityCompanyInfo(snapshotId: string) {
|
|
1675
|
+
return callBusinessIdentityTool('bi_get_company_info', { snapshotId });
|
|
1644
1676
|
}
|
|
1645
1677
|
|
|
1646
|
-
/**
|
|
1647
|
-
export async function
|
|
1648
|
-
snapshotId
|
|
1649
|
-
searchText: string,
|
|
1650
|
-
category?: 'hierarchy' | 'process' | 'policy' | 'note'
|
|
1651
|
-
) {
|
|
1652
|
-
return callInternalKnowledgeTool('knowledge_search_content', {
|
|
1653
|
-
snapshotId,
|
|
1654
|
-
searchText,
|
|
1655
|
-
...(category != null ? { category } : {})
|
|
1656
|
-
});
|
|
1678
|
+
/** Services and products from a snapshot */
|
|
1679
|
+
export async function getBusinessIdentityServicesProducts(snapshotId: string) {
|
|
1680
|
+
return callBusinessIdentityTool('bi_get_services_products', { snapshotId });
|
|
1657
1681
|
}
|
|
1658
1682
|
|
|
1659
|
-
/**
|
|
1660
|
-
export async function
|
|
1661
|
-
snapshotId
|
|
1662
|
-
category: 'hierarchy' | 'process' | 'policy' | 'note'
|
|
1663
|
-
) {
|
|
1664
|
-
return callInternalKnowledgeTool('knowledge_get_by_category', { snapshotId, category });
|
|
1683
|
+
/** List managed catalog products for a BI snapshot */
|
|
1684
|
+
export async function listBusinessIdentityCatalogProducts(snapshotId: string) {
|
|
1685
|
+
return callBusinessIdentityTool('bi_catalog_list_products', { snapshotId });
|
|
1665
1686
|
}
|
|
1666
1687
|
|
|
1667
|
-
/**
|
|
1668
|
-
export async function
|
|
1688
|
+
/** Get one catalog product by id or name */
|
|
1689
|
+
export async function getBusinessIdentityCatalogProduct(
|
|
1669
1690
|
snapshotId: string,
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
content?: string
|
|
1691
|
+
productIdOrName: string,
|
|
1692
|
+
includeImages?: boolean
|
|
1673
1693
|
) {
|
|
1674
|
-
return
|
|
1694
|
+
return callBusinessIdentityTool('bi_catalog_get_product', {
|
|
1675
1695
|
snapshotId,
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
...(content != null ? { content } : {})
|
|
1696
|
+
productIdOrName,
|
|
1697
|
+
includeImages
|
|
1679
1698
|
});
|
|
1680
1699
|
}
|
|
1681
1700
|
|
|
1682
|
-
/**
|
|
1683
|
-
export async function
|
|
1684
|
-
|
|
1685
|
-
|
|
1701
|
+
/** List AI brand faces / spokespersons for a BI snapshot */
|
|
1702
|
+
export async function listBusinessIdentityFaces(
|
|
1703
|
+
snapshotId: string,
|
|
1704
|
+
includePortraitBase64?: boolean
|
|
1686
1705
|
) {
|
|
1687
|
-
return
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
/** Delete a knowledge document */
|
|
1691
|
-
export async function deleteKnowledgeDocument(documentId: string) {
|
|
1692
|
-
return callInternalKnowledgeTool('knowledge_delete_document', { documentId });
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
/** List business identity snapshots (optional brand filter) */
|
|
1696
|
-
export async function listBusinessIdentitySnapshots(brandKey?: string) {
|
|
1697
|
-
return callInternalKnowledgeTool('businessidentity_list_snapshots', {
|
|
1698
|
-
...(brandKey != null ? { brandKey } : {})
|
|
1706
|
+
return callBusinessIdentityTool('bi_face_list', {
|
|
1707
|
+
snapshotId,
|
|
1708
|
+
includePortraitBase64
|
|
1699
1709
|
});
|
|
1700
1710
|
}
|
|
1701
1711
|
|
|
1702
|
-
/** Full snapshot by ID (identity JSON, SEO/SSL analysis, etc.) */
|
|
1703
|
-
export async function getBusinessIdentitySnapshot(snapshotId: string) {
|
|
1704
|
-
return callInternalKnowledgeTool('businessidentity_get_snapshot', { snapshotId });
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
/** Company info slice from a snapshot (contact, structure, partners, industries) */
|
|
1708
|
-
export async function getBusinessIdentityCompanyInfo(snapshotId: string) {
|
|
1709
|
-
return callInternalKnowledgeTool('businessidentity_get_company_info', { snapshotId });
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
/** Services and products from a snapshot */
|
|
1713
|
-
export async function getBusinessIdentityServicesProducts(snapshotId: string) {
|
|
1714
|
-
return callInternalKnowledgeTool('businessidentity_get_services_products', { snapshotId });
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
1712
|
/**
|
|
1718
1713
|
* Call EGDesk Company Research MCP tool (run workflows and query saved research).
|
|
1719
1714
|
*
|
|
@@ -1953,6 +1948,24 @@ export async function listBrowserRecordingSites(site?: string) {
|
|
|
1953
1948
|
return callBrowserRecordingTool('browser_recording_list_sites', site ? { site } : {});
|
|
1954
1949
|
}
|
|
1955
1950
|
|
|
1951
|
+
/**
|
|
1952
|
+
* Add a site+login to the Browser Recorder catalog.
|
|
1953
|
+
* Throws unless accountAdded is true (confirmation / needs_more_fields are returned, not thrown).
|
|
1954
|
+
* First call without confirmed; after the user approves, call again with confirmed: true.
|
|
1955
|
+
* Discover misses iframe logins (no_login_form). Do not mask sheet passwords on throw.
|
|
1956
|
+
*/
|
|
1957
|
+
export async function addBrowserRecordingAccount(options: {
|
|
1958
|
+
url: string;
|
|
1959
|
+
password: string;
|
|
1960
|
+
user?: string;
|
|
1961
|
+
id?: string;
|
|
1962
|
+
company?: string;
|
|
1963
|
+
email?: string;
|
|
1964
|
+
confirmed?: boolean;
|
|
1965
|
+
}) {
|
|
1966
|
+
return callBrowserRecordingTool('browser_recording_add_account', options);
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1956
1969
|
/** One recorded login: identity + login vs post-login actions (no passwords) */
|
|
1957
1970
|
export async function getBrowserRecordingAccount(siteKey: string, accountKey: string) {
|
|
1958
1971
|
return callBrowserRecordingTool('browser_recording_get_account', { siteKey, accountKey });
|
|
@@ -1965,12 +1978,14 @@ export async function getBrowserRecordingAccount(siteKey: string, accountKey: st
|
|
|
1965
1978
|
export async function openBrowserRecordingAccount(
|
|
1966
1979
|
siteKey: string,
|
|
1967
1980
|
accountKey: string,
|
|
1968
|
-
scriptPath?: string
|
|
1981
|
+
scriptPath?: string,
|
|
1982
|
+
confirmed?: boolean,
|
|
1969
1983
|
) {
|
|
1970
1984
|
return callBrowserRecordingTool('browser_recording_open_account', {
|
|
1971
1985
|
siteKey,
|
|
1972
1986
|
accountKey,
|
|
1973
|
-
...(scriptPath ? { scriptPath } : {})
|
|
1987
|
+
...(scriptPath ? { scriptPath } : {}),
|
|
1988
|
+
...(confirmed ? { confirmed: true } : {}),
|
|
1974
1989
|
});
|
|
1975
1990
|
}
|
|
1976
1991
|
|
|
@@ -2029,6 +2044,20 @@ export async function fillBrowserRecordingForm(
|
|
|
2029
2044
|
return callBrowserRecordingTool('browser_recording_fill_form', { sessionId, fields });
|
|
2030
2045
|
}
|
|
2031
2046
|
|
|
2047
|
+
/**
|
|
2048
|
+
* Set a start/end date range filter (startDate/endDate as YYYY-MM-DD), trying a preset
|
|
2049
|
+
* button (exact-range match only), a plain start/end input pair, then an ecount-style
|
|
2050
|
+
* composite day picker (day-only, gated on year/month already matching). Returns
|
|
2051
|
+
* strategy="unsupported" with a message rather than guessing when none apply.
|
|
2052
|
+
*/
|
|
2053
|
+
export async function setBrowserRecordingDateRange(
|
|
2054
|
+
sessionId: string,
|
|
2055
|
+
startDate: string,
|
|
2056
|
+
endDate: string
|
|
2057
|
+
) {
|
|
2058
|
+
return callBrowserRecordingTool('browser_recording_set_date_range', { sessionId, startDate, endDate });
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2032
2061
|
/** Type into a lookup/search field (does not bind hidden id). Then inspect and double-click a row. */
|
|
2033
2062
|
export async function typeIntoBrowserRecording(
|
|
2034
2063
|
sessionId: string,
|
|
@@ -2056,7 +2085,7 @@ export async function listBrowserRecordingSessions() {
|
|
|
2056
2085
|
return callBrowserRecordingTool('browser_recording_list_sessions', {});
|
|
2057
2086
|
}
|
|
2058
2087
|
|
|
2059
|
-
|
|
2088
|
+
/** Close Chrome. Does not save a recording or page HTML — only when fully done. */
|
|
2060
2089
|
export async function closeBrowserRecordingSession(sessionId: string) {
|
|
2061
2090
|
return callBrowserRecordingTool('browser_recording_close_session', { sessionId });
|
|
2062
2091
|
}
|
|
@@ -2112,11 +2141,16 @@ export async function saveBrowserRecordingPageHtml(sessionId: string, name?: str
|
|
|
2112
2141
|
});
|
|
2113
2142
|
}
|
|
2114
2143
|
|
|
2115
|
-
/** After walking one row cycle, bind that recipe to every remaining matching list key. */
|
|
2144
|
+
/** After walking one row cycle, bind that recipe to every remaining matching list key. Optional nextPage walks list pagers. */
|
|
2116
2145
|
export async function forEachBrowserRecordingRow(
|
|
2117
2146
|
sessionId: string,
|
|
2118
2147
|
query: string,
|
|
2119
|
-
opts?: {
|
|
2148
|
+
opts?: {
|
|
2149
|
+
namePrefix?: string;
|
|
2150
|
+
skipExisting?: boolean;
|
|
2151
|
+
maxRows?: number;
|
|
2152
|
+
nextPage?: { elementIndex?: number; selector?: string; maxPages?: number };
|
|
2153
|
+
}
|
|
2120
2154
|
) {
|
|
2121
2155
|
return callBrowserRecordingTool('browser_recording_for_each_row', {
|
|
2122
2156
|
sessionId,
|
|
@@ -2124,6 +2158,7 @@ export async function forEachBrowserRecordingRow(
|
|
|
2124
2158
|
...(opts?.namePrefix ? { namePrefix: opts.namePrefix } : {}),
|
|
2125
2159
|
...(opts?.skipExisting === false ? { skipExisting: false } : {}),
|
|
2126
2160
|
...(opts?.maxRows !== undefined ? { maxRows: opts.maxRows } : {}),
|
|
2161
|
+
...(opts?.nextPage ? { nextPage: opts.nextPage } : {}),
|
|
2127
2162
|
});
|
|
2128
2163
|
}
|
|
2129
2164
|
|
|
@@ -2695,16 +2730,16 @@ export async function getSeoIssuesSummary(reportId: string) {
|
|
|
2695
2730
|
}
|
|
2696
2731
|
|
|
2697
2732
|
// ==========================================
|
|
2698
|
-
//
|
|
2733
|
+
// HOSTING & CODING (MCP)
|
|
2699
2734
|
// ==========================================
|
|
2700
2735
|
|
|
2701
2736
|
/**
|
|
2702
|
-
* Call EGDesk
|
|
2737
|
+
* Call EGDesk Hosting & Coding MCP tool (SSL, certificates, and local dev servers).
|
|
2703
2738
|
*
|
|
2704
|
-
* - Server: \`POST {apiUrl}/
|
|
2705
|
-
* - Client: \`POST /
|
|
2739
|
+
* - Server: \`POST {apiUrl}/hosting-coding/tools/call\`
|
|
2740
|
+
* - Client: \`POST /__hosting_coding_proxy\` (see proxy.ts / middleware)
|
|
2706
2741
|
*/
|
|
2707
|
-
export async function
|
|
2742
|
+
export async function callHostingCodingTool(
|
|
2708
2743
|
toolName: string,
|
|
2709
2744
|
args: Record<string, any> = {}
|
|
2710
2745
|
): Promise<any> {
|
|
@@ -2717,13 +2752,13 @@ export async function callSslTool(
|
|
|
2717
2752
|
const apiUrl =
|
|
2718
2753
|
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
|
|
2719
2754
|
EGDESK_CONFIG.apiUrl;
|
|
2720
|
-
response = await fetch(\`\${apiUrl}/
|
|
2755
|
+
response = await fetch(\`\${apiUrl}/hosting-coding/tools/call\`, {
|
|
2721
2756
|
method: 'POST',
|
|
2722
2757
|
headers: buildServerEgdeskHeaders(),
|
|
2723
2758
|
body
|
|
2724
2759
|
});
|
|
2725
2760
|
} else {
|
|
2726
|
-
response = await apiFetch('/
|
|
2761
|
+
response = await apiFetch('/__hosting_coding_proxy', {
|
|
2727
2762
|
method: 'POST',
|
|
2728
2763
|
headers: { 'Content-Type': 'application/json' },
|
|
2729
2764
|
body
|
|
@@ -2734,65 +2769,105 @@ export async function callSslTool(
|
|
|
2734
2769
|
}
|
|
2735
2770
|
|
|
2736
2771
|
/** Full SSL/security audit: cert, headers, and letter grade (A+ to F) */
|
|
2737
|
-
export async function
|
|
2738
|
-
return
|
|
2772
|
+
export async function analyzeHostingSite(url: string, save: boolean = true) {
|
|
2773
|
+
return callHostingCodingTool('hosting_analyze_site', { url, save });
|
|
2739
2774
|
}
|
|
2740
2775
|
|
|
2741
2776
|
/** Inspect TLS certificate for a URL (expiry, issuer, SANs) */
|
|
2742
|
-
export async function
|
|
2743
|
-
return
|
|
2777
|
+
export async function checkHostingCertificate(url: string) {
|
|
2778
|
+
return callHostingCodingTool('hosting_check_certificate', { url });
|
|
2744
2779
|
}
|
|
2745
2780
|
|
|
2746
2781
|
/** Check security headers (HSTS, CSP, X-Frame-Options, etc.) */
|
|
2747
|
-
export async function
|
|
2748
|
-
return
|
|
2782
|
+
export async function checkHostingSecurityHeaders(url: string) {
|
|
2783
|
+
return callHostingCodingTool('hosting_check_security_headers', { url });
|
|
2749
2784
|
}
|
|
2750
2785
|
|
|
2751
2786
|
/** List saved SSL analysis history entries */
|
|
2752
|
-
export async function
|
|
2753
|
-
return
|
|
2787
|
+
export async function listHostingAnalyses(options: { websiteUrl?: string; limit?: number } = {}) {
|
|
2788
|
+
return callHostingCodingTool('hosting_list_analyses', options);
|
|
2754
2789
|
}
|
|
2755
2790
|
|
|
2756
2791
|
/** Get a saved SSL analysis by ID */
|
|
2757
|
-
export async function
|
|
2758
|
-
return
|
|
2792
|
+
export async function getHostingAnalysis(id: string) {
|
|
2793
|
+
return callHostingCodingTool('hosting_get_analysis', { id });
|
|
2759
2794
|
}
|
|
2760
2795
|
|
|
2761
2796
|
/** List stored SSL certificates (metadata only, no private keys) */
|
|
2762
|
-
export async function
|
|
2763
|
-
return
|
|
2797
|
+
export async function listHostingCertificates() {
|
|
2798
|
+
return callHostingCodingTool('hosting_list_certificates', {});
|
|
2764
2799
|
}
|
|
2765
2800
|
|
|
2766
2801
|
/** Get stored certificate metadata by ID */
|
|
2767
|
-
export async function
|
|
2768
|
-
return
|
|
2802
|
+
export async function getHostingCertificate(id: string) {
|
|
2803
|
+
return callHostingCodingTool('hosting_get_certificate', { id });
|
|
2769
2804
|
}
|
|
2770
2805
|
|
|
2771
2806
|
/** Generate a self-signed certificate for local development */
|
|
2772
|
-
export async function
|
|
2773
|
-
return
|
|
2807
|
+
export async function generateHostingSelfSignedCertificate(domain: string) {
|
|
2808
|
+
return callHostingCodingTool('hosting_generate_self_signed', { domain });
|
|
2774
2809
|
}
|
|
2775
2810
|
|
|
2776
2811
|
/** Generate a mkcert-trusted local development certificate (macOS) */
|
|
2777
|
-
export async function
|
|
2778
|
-
return
|
|
2812
|
+
export async function generateHostingTrustedLocalCertificate(domain: string = 'egdesk.local') {
|
|
2813
|
+
return callHostingCodingTool('hosting_generate_trusted_local', { domain });
|
|
2779
2814
|
}
|
|
2780
2815
|
|
|
2781
2816
|
/** Request a Let's Encrypt certificate via ACME HTTP-01 */
|
|
2782
|
-
export async function
|
|
2783
|
-
return
|
|
2817
|
+
export async function generateHostingLetsEncryptCertificate(domain: string, email?: string) {
|
|
2818
|
+
return callHostingCodingTool('hosting_generate_lets_encrypt', { domain, email });
|
|
2784
2819
|
}
|
|
2785
2820
|
|
|
2786
2821
|
/** Set the active certificate used by EGDesk dev servers */
|
|
2787
|
-
export async function
|
|
2788
|
-
return
|
|
2822
|
+
export async function setActiveHostingCertificate(certificateId: string | null) {
|
|
2823
|
+
return callHostingCodingTool('hosting_set_active_certificate', { certificateId });
|
|
2789
2824
|
}
|
|
2790
2825
|
|
|
2791
2826
|
/** Delete a stored certificate by ID */
|
|
2792
|
-
export async function
|
|
2793
|
-
return
|
|
2827
|
+
export async function deleteHostingCertificate(id: string) {
|
|
2828
|
+
return callHostingCodingTool('hosting_delete_certificate', { id });
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
/** List all registered projects and their current hosting/server status */
|
|
2832
|
+
export async function listHostingProjects() {
|
|
2833
|
+
return callHostingCodingTool('coding_list_projects', {});
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
/** Start a development or production server for a project folder */
|
|
2837
|
+
export async function startHostingServer(folderPath: string, options: { mode?: 'dev' | 'production', forceBuild?: boolean, watch?: boolean } = {}) {
|
|
2838
|
+
return callHostingCodingTool('coding_start_server', { folderPath, ...options });
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
/** Stop a running development or production server */
|
|
2842
|
+
export async function stopHostingServer(folderPath: string, mode?: 'dev' | 'production') {
|
|
2843
|
+
return callHostingCodingTool('coding_stop_server', { folderPath, mode });
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
/** Get details and status for a specific project mode */
|
|
2847
|
+
export async function getHostingServerStatus(folderPath: string, mode: 'dev' | 'production') {
|
|
2848
|
+
return callHostingCodingTool('coding_get_server_status', { folderPath, mode });
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
/** Update project access mode between public (tunneled) and private (local only) */
|
|
2852
|
+
export async function updateHostingAccessMode(projectName: string, accessMode: 'public' | 'private') {
|
|
2853
|
+
return callHostingCodingTool('coding_update_access_mode', { projectName, accessMode });
|
|
2794
2854
|
}
|
|
2795
2855
|
|
|
2856
|
+
/** Alias for compatibility with old SSL calls */
|
|
2857
|
+
export const callSslTool = callHostingCodingTool;
|
|
2858
|
+
export const analyzeSslSite = analyzeHostingSite;
|
|
2859
|
+
export const checkSslCertificate = checkHostingCertificate;
|
|
2860
|
+
export const checkSecurityHeaders = checkHostingSecurityHeaders;
|
|
2861
|
+
export const listSslAnalyses = listHostingAnalyses;
|
|
2862
|
+
export const getSslAnalysis = getHostingAnalysis;
|
|
2863
|
+
export const listSslCertificates = listHostingCertificates;
|
|
2864
|
+
export const getSslCertificate = getHostingCertificate;
|
|
2865
|
+
export const generateSelfSignedCertificate = generateHostingSelfSignedCertificate;
|
|
2866
|
+
export const generateTrustedLocalCertificate = generateHostingTrustedLocalCertificate;
|
|
2867
|
+
export const generateLetsEncryptCertificate = generateHostingLetsEncryptCertificate;
|
|
2868
|
+
export const setActiveSslCertificate = setActiveHostingCertificate;
|
|
2869
|
+
export const deleteSslCertificate = deleteHostingCertificate;
|
|
2870
|
+
|
|
2796
2871
|
// ==========================================
|
|
2797
2872
|
// Local Agent AI (MCP)
|
|
2798
2873
|
// ==========================================
|
|
@@ -3370,63 +3445,80 @@ export async function setDriveTargetFolders(folderIds: string[]) {
|
|
|
3370
3445
|
return callDriveTool('drive_set_target_folders', { folderIds });
|
|
3371
3446
|
}
|
|
3372
3447
|
|
|
3373
|
-
/**
|
|
3448
|
+
/**
|
|
3449
|
+
* Upload a local file into a Drive folder (local → Workspace).
|
|
3450
|
+
* Pass preferOAuth: true to upload as the signed-in Google user instead of the
|
|
3451
|
+
* service account — needed when the service account has no Drive storage of its
|
|
3452
|
+
* own (e.g. writing into a personal Gmail account without domain-wide delegation).
|
|
3453
|
+
*/
|
|
3374
3454
|
export async function uploadDriveFile(options: {
|
|
3375
3455
|
filePath: string;
|
|
3376
3456
|
folderId?: string;
|
|
3377
3457
|
destName?: string;
|
|
3378
3458
|
mimeType?: string;
|
|
3459
|
+
preferOAuth?: boolean;
|
|
3379
3460
|
}) {
|
|
3380
3461
|
return callDriveTool('drive_upload', options);
|
|
3381
3462
|
}
|
|
3382
3463
|
|
|
3383
3464
|
/** List Drive files by folder and/or query */
|
|
3384
|
-
export async function listDriveFiles(
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3465
|
+
export async function listDriveFiles(
|
|
3466
|
+
options: {
|
|
3467
|
+
folderId?: string;
|
|
3468
|
+
query?: string;
|
|
3469
|
+
pageSize?: number;
|
|
3470
|
+
pageToken?: string;
|
|
3471
|
+
} = {},
|
|
3472
|
+
callOptions: WorkspaceVisitorCallOptions = {},
|
|
3473
|
+
) {
|
|
3474
|
+
const preferOAuth = callOptions.preferOAuth ?? true;
|
|
3475
|
+
return callDriveTool('drive_list_files', { ...options, preferOAuth }, { ...callOptions, preferOAuth });
|
|
3391
3476
|
}
|
|
3392
3477
|
|
|
3393
3478
|
/** Get Drive file or folder metadata */
|
|
3394
|
-
export async function getDriveFile(fileId: string) {
|
|
3395
|
-
|
|
3479
|
+
export async function getDriveFile(fileId: string, options: WorkspaceVisitorCallOptions = {}) {
|
|
3480
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3481
|
+
return callDriveTool('drive_get_file', { fileId, preferOAuth }, { ...options, preferOAuth });
|
|
3396
3482
|
}
|
|
3397
3483
|
|
|
3398
|
-
/**
|
|
3399
|
-
|
|
3400
|
-
|
|
3484
|
+
/**
|
|
3485
|
+
* Create a Drive folder.
|
|
3486
|
+
* Pass preferOAuth: true to create it as the signed-in Google user instead of
|
|
3487
|
+
* the service account — needed when the service account has no Drive storage of
|
|
3488
|
+
* its own (e.g. creating in a personal Gmail account without domain-wide delegation).
|
|
3489
|
+
*/
|
|
3490
|
+
export async function createDriveFolder(name: string, parentId?: string, preferOAuth?: boolean) {
|
|
3491
|
+
return callDriveTool('drive_create_folder', { name, parentId, preferOAuth });
|
|
3401
3492
|
}
|
|
3402
3493
|
|
|
3403
|
-
/** Download a Drive file to a local path */
|
|
3404
|
-
export async function downloadDriveFile(fileId: string, destPath: string) {
|
|
3405
|
-
return callDriveTool('drive_download', { fileId, destPath });
|
|
3494
|
+
/** Download a Drive file to a local path. Pass preferOAuth: true to act as the signed-in Google user. */
|
|
3495
|
+
export async function downloadDriveFile(fileId: string, destPath: string, preferOAuth?: boolean) {
|
|
3496
|
+
return callDriveTool('drive_download', { fileId, destPath, preferOAuth });
|
|
3406
3497
|
}
|
|
3407
3498
|
|
|
3408
|
-
/** Move a file or folder into destFolderId */
|
|
3409
|
-
export async function moveDriveFile(fileId: string, destFolderId: string) {
|
|
3410
|
-
return callDriveTool('drive_move', { fileId, destFolderId });
|
|
3499
|
+
/** Move a file or folder into destFolderId. Pass preferOAuth: true to act as the signed-in Google user. */
|
|
3500
|
+
export async function moveDriveFile(fileId: string, destFolderId: string, preferOAuth?: boolean) {
|
|
3501
|
+
return callDriveTool('drive_move', { fileId, destFolderId, preferOAuth });
|
|
3411
3502
|
}
|
|
3412
3503
|
|
|
3413
|
-
/** Copy a Drive file */
|
|
3504
|
+
/** Copy a Drive file. Pass preferOAuth: true to act as the signed-in Google user. */
|
|
3414
3505
|
export async function copyDriveFile(options: {
|
|
3415
3506
|
fileId: string;
|
|
3416
3507
|
destName?: string;
|
|
3417
3508
|
destFolderId?: string;
|
|
3509
|
+
preferOAuth?: boolean;
|
|
3418
3510
|
}) {
|
|
3419
3511
|
return callDriveTool('drive_copy', options);
|
|
3420
3512
|
}
|
|
3421
3513
|
|
|
3422
|
-
/** Rename a Drive file or folder */
|
|
3423
|
-
export async function renameDriveFile(fileId: string, name: string) {
|
|
3424
|
-
return callDriveTool('drive_rename', { fileId, name });
|
|
3514
|
+
/** Rename a Drive file or folder. Pass preferOAuth: true to act as the signed-in Google user. */
|
|
3515
|
+
export async function renameDriveFile(fileId: string, name: string, preferOAuth?: boolean) {
|
|
3516
|
+
return callDriveTool('drive_rename', { fileId, name, preferOAuth });
|
|
3425
3517
|
}
|
|
3426
3518
|
|
|
3427
|
-
/** Move a Drive file or folder to trash */
|
|
3428
|
-
export async function trashDriveFile(fileId: string) {
|
|
3429
|
-
return callDriveTool('drive_trash', { fileId });
|
|
3519
|
+
/** Move a Drive file or folder to trash. Pass preferOAuth: true to act as the signed-in Google user. */
|
|
3520
|
+
export async function trashDriveFile(fileId: string, preferOAuth?: boolean) {
|
|
3521
|
+
return callDriveTool('drive_trash', { fileId, preferOAuth });
|
|
3430
3522
|
}
|
|
3431
3523
|
|
|
3432
3524
|
/** Find or create the top-level EGDesk Drive folder */
|
|
@@ -3484,6 +3576,7 @@ export async function syncDrive(options: {
|
|
|
3484
3576
|
* Call EGDesk Sheets MCP tool.
|
|
3485
3577
|
*
|
|
3486
3578
|
* Auth: personal OAuth, service account, or domain-wide delegation (call getSheetsAuthStatus() first).
|
|
3579
|
+
* Read helpers default preferOAuth: true when both credentials exist.
|
|
3487
3580
|
* Pass { asVisitor: true } to act as the website visitor from startVisitorGoogleLogin().
|
|
3488
3581
|
* On the server also pass visitorSessionId and visitorOrigin (or NEXT_PUBLIC_EGDESK_VISITOR_ORIGIN).
|
|
3489
3582
|
* - Server: \`POST {apiUrl}/sheets/tools/call\`
|
|
@@ -3503,37 +3596,73 @@ export async function getSheetsAuthStatus() {
|
|
|
3503
3596
|
}
|
|
3504
3597
|
|
|
3505
3598
|
/** Spreadsheet metadata (tabs, dimensions) */
|
|
3506
|
-
export async function getSpreadsheet(
|
|
3507
|
-
|
|
3599
|
+
export async function getSpreadsheet(
|
|
3600
|
+
spreadsheetId: string,
|
|
3601
|
+
options: WorkspaceVisitorCallOptions = {},
|
|
3602
|
+
) {
|
|
3603
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3604
|
+
return callSheetsTool('sheets_get_spreadsheet', { spreadsheetId, preferOAuth }, options);
|
|
3508
3605
|
}
|
|
3509
3606
|
|
|
3510
3607
|
/** Read a range (A1 notation) */
|
|
3511
|
-
export async function getSheetRange(
|
|
3512
|
-
|
|
3608
|
+
export async function getSheetRange(
|
|
3609
|
+
spreadsheetId: string,
|
|
3610
|
+
range: string,
|
|
3611
|
+
options: WorkspaceVisitorCallOptions = {},
|
|
3612
|
+
) {
|
|
3613
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3614
|
+
return callSheetsTool('sheets_get_range', { spreadsheetId, range, preferOAuth }, options);
|
|
3513
3615
|
}
|
|
3514
3616
|
|
|
3515
3617
|
/** Read a range including formula vs literal per cell */
|
|
3516
|
-
export async function getSheetRangeWithFormulas(
|
|
3517
|
-
|
|
3618
|
+
export async function getSheetRangeWithFormulas(
|
|
3619
|
+
spreadsheetId: string,
|
|
3620
|
+
range: string,
|
|
3621
|
+
options: WorkspaceVisitorCallOptions = {},
|
|
3622
|
+
) {
|
|
3623
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3624
|
+
return callSheetsTool(
|
|
3625
|
+
'sheets_get_range_with_formulas',
|
|
3626
|
+
{ spreadsheetId, range, preferOAuth },
|
|
3627
|
+
options,
|
|
3628
|
+
);
|
|
3518
3629
|
}
|
|
3519
3630
|
|
|
3520
3631
|
/** Header row of a tab */
|
|
3521
|
-
export async function getSheetHeaders(
|
|
3522
|
-
|
|
3632
|
+
export async function getSheetHeaders(
|
|
3633
|
+
spreadsheetId: string,
|
|
3634
|
+
sheetName?: string,
|
|
3635
|
+
options: WorkspaceVisitorCallOptions = {},
|
|
3636
|
+
) {
|
|
3637
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3638
|
+
return callSheetsTool('sheets_get_headers', { spreadsheetId, sheetName, preferOAuth }, options);
|
|
3523
3639
|
}
|
|
3524
3640
|
|
|
3525
3641
|
/** First N rows of a tab */
|
|
3526
|
-
export async function getSheetSampleData(
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3642
|
+
export async function getSheetSampleData(
|
|
3643
|
+
options: {
|
|
3644
|
+
spreadsheetId: string;
|
|
3645
|
+
sheetName?: string;
|
|
3646
|
+
rows?: number;
|
|
3647
|
+
},
|
|
3648
|
+
callOptions: WorkspaceVisitorCallOptions = {},
|
|
3649
|
+
) {
|
|
3650
|
+
const preferOAuth = callOptions.preferOAuth ?? true;
|
|
3651
|
+
return callSheetsTool('sheets_get_sample_data', { ...options, preferOAuth }, callOptions);
|
|
3532
3652
|
}
|
|
3533
3653
|
|
|
3534
3654
|
/** Metadata + headers + sample rows for every tab */
|
|
3535
|
-
export async function getSpreadsheetFullContext(
|
|
3536
|
-
|
|
3655
|
+
export async function getSpreadsheetFullContext(
|
|
3656
|
+
spreadsheetId: string,
|
|
3657
|
+
sampleRows?: number,
|
|
3658
|
+
options: WorkspaceVisitorCallOptions = {},
|
|
3659
|
+
) {
|
|
3660
|
+
const preferOAuth = options.preferOAuth ?? true;
|
|
3661
|
+
return callSheetsTool(
|
|
3662
|
+
'sheets_get_full_context',
|
|
3663
|
+
{ spreadsheetId, sampleRows, preferOAuth },
|
|
3664
|
+
options,
|
|
3665
|
+
);
|
|
3537
3666
|
}
|
|
3538
3667
|
|
|
3539
3668
|
/** Create a spreadsheet, optionally seeding Sheet1 */
|
|
@@ -3768,6 +3897,10 @@ export async function sendGmailMessage(options: {
|
|
|
3768
3897
|
/**
|
|
3769
3898
|
* Call EGDesk Apps Script MCP tool.
|
|
3770
3899
|
*
|
|
3900
|
+
* Owner MCP: personal Google login is used by default (service accounts cannot
|
|
3901
|
+
* call Apps Script as themselves).
|
|
3902
|
+
* Pass { asVisitor: true } to act as the website visitor from startVisitorGoogleLogin().
|
|
3903
|
+
*
|
|
3771
3904
|
* - Server: \`POST {apiUrl}/apps-script/tools/call\`
|
|
3772
3905
|
* - Client: \`POST /__apps_script_proxy\`
|
|
3773
3906
|
*/
|
|
@@ -3798,29 +3931,46 @@ export async function pullAppsScriptFromGoogle(projectId: string) {
|
|
|
3798
3931
|
}
|
|
3799
3932
|
|
|
3800
3933
|
/** Create a container-bound Apps Script on a Sheet, Doc, Slide, or Form and register it */
|
|
3801
|
-
export async function createAppsScriptBound(
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3934
|
+
export async function createAppsScriptBound(
|
|
3935
|
+
options: {
|
|
3936
|
+
fileId: string;
|
|
3937
|
+
title?: string;
|
|
3938
|
+
scriptCode?: string;
|
|
3939
|
+
force?: boolean;
|
|
3940
|
+
},
|
|
3941
|
+
callOptions: WorkspaceVisitorCallOptions = {},
|
|
3942
|
+
) {
|
|
3943
|
+
const preferOAuth = callOptions.preferOAuth ?? true;
|
|
3944
|
+
return callAppsScriptTool(
|
|
3945
|
+
'apps_script_create_bound',
|
|
3946
|
+
{ ...options, preferOAuth },
|
|
3947
|
+
{ ...callOptions, preferOAuth },
|
|
3948
|
+
);
|
|
3808
3949
|
}
|
|
3809
3950
|
|
|
3810
3951
|
/** Alias of createAppsScriptBound */
|
|
3811
|
-
export async function createAppsScriptForSpreadsheet(
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3952
|
+
export async function createAppsScriptForSpreadsheet(
|
|
3953
|
+
options: {
|
|
3954
|
+
spreadsheetId?: string;
|
|
3955
|
+
fileId?: string;
|
|
3956
|
+
title?: string;
|
|
3957
|
+
scriptCode?: string;
|
|
3958
|
+
force?: boolean;
|
|
3959
|
+
},
|
|
3960
|
+
callOptions: WorkspaceVisitorCallOptions = {},
|
|
3961
|
+
) {
|
|
3962
|
+
const preferOAuth = callOptions.preferOAuth ?? true;
|
|
3963
|
+
return callAppsScriptTool(
|
|
3964
|
+
'apps_script_create_bound',
|
|
3965
|
+
{
|
|
3966
|
+
fileId: options.fileId || options.spreadsheetId,
|
|
3967
|
+
title: options.title,
|
|
3968
|
+
scriptCode: options.scriptCode,
|
|
3969
|
+
force: options.force,
|
|
3970
|
+
preferOAuth,
|
|
3971
|
+
},
|
|
3972
|
+
{ ...callOptions, preferOAuth },
|
|
3973
|
+
);
|
|
3824
3974
|
}
|
|
3825
3975
|
|
|
3826
3976
|
/**
|
|
@@ -73,7 +73,7 @@ import type { NextRequest } from 'next/server';
|
|
|
73
73
|
/**
|
|
74
74
|
* EGDesk Database Proxy Middleware
|
|
75
75
|
*
|
|
76
|
-
* Intercepts __user_data_proxy, __browser_recording_proxy,
|
|
76
|
+
* Intercepts __user_data_proxy, __browser_recording_proxy, __business_identity_proxy, __company_research_proxy, __kakao_proxy, __drive_proxy, __sheets_proxy, __docs_proxy, __slides_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
77
77
|
* and forwards them to the EGDesk MCP HTTP server.
|
|
78
78
|
* This allows CORS-free database access in both local and tunneled environments.
|
|
79
79
|
*
|
|
@@ -184,7 +184,7 @@ export async function middleware(request: NextRequest) {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
if (pathname.includes('
|
|
187
|
+
if (pathname.includes('__business_identity_proxy')) {
|
|
188
188
|
try {
|
|
189
189
|
const body = await request.text();
|
|
190
190
|
|
|
@@ -199,7 +199,7 @@ export async function middleware(request: NextRequest) {
|
|
|
199
199
|
headers['X-Api-Key'] = apiKey;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
const response = await fetch(\`\${apiUrl}/
|
|
202
|
+
const response = await fetch(\`\${apiUrl}/business-identity/tools/call\`, {
|
|
203
203
|
method: 'POST',
|
|
204
204
|
headers,
|
|
205
205
|
body,
|
package/dist/generate-proxy.js
CHANGED
|
@@ -75,7 +75,7 @@ import type { NextRequest } from 'next/server';
|
|
|
75
75
|
/**
|
|
76
76
|
* EGDesk Database Proxy (Next.js 16+)
|
|
77
77
|
*
|
|
78
|
-
* Intercepts __user_data_proxy, __browser_recording_proxy,
|
|
78
|
+
* Intercepts __user_data_proxy, __browser_recording_proxy, __business_identity_proxy, __company_research_proxy, __ai_center_proxy, __korean_law_proxy, __bizinfo_proxy, __nps_proxy, __seo_proxy, __hosting_coding_proxy, __local_agent_proxy, __pageindex_proxy, __drive_proxy, __sheets_proxy, __docs_proxy, __slides_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __knowledge_wiki_proxy, __egdesk_config_proxy, __ai_caller_proxy, __kakao_proxy, __phone_proxy, __instagram_proxy, __financehub_proxy, __blog_proxy, __youtube_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
79
79
|
* and forwards them to the EGDesk MCP HTTP server. This avoids CORS in local and tunneled environments.
|
|
80
80
|
*
|
|
81
81
|
* Generated by @egdesk/next-api-plugin
|
|
@@ -171,12 +171,12 @@ export async function proxy(request: NextRequest) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
if (pathname.includes('
|
|
174
|
+
if (pathname.includes('__business_identity_proxy')) {
|
|
175
175
|
try {
|
|
176
176
|
const body = await request.text();
|
|
177
177
|
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
178
178
|
|
|
179
|
-
const response = await fetch(\`\${apiUrl}/
|
|
179
|
+
const response = await fetch(\`\${apiUrl}/business-identity/tools/call\`, {
|
|
180
180
|
method: 'POST',
|
|
181
181
|
headers: buildEgdeskHeaders(),
|
|
182
182
|
body,
|
|
@@ -347,12 +347,12 @@ export async function proxy(request: NextRequest) {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
if (pathname.includes('
|
|
350
|
+
if (pathname.includes('__hosting_coding_proxy')) {
|
|
351
351
|
try {
|
|
352
352
|
const body = await request.text();
|
|
353
353
|
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
354
354
|
|
|
355
|
-
const response = await fetch(\`\${apiUrl}/
|
|
355
|
+
const response = await fetch(\`\${apiUrl}/hosting-coding/tools/call\`, {
|
|
356
356
|
method: 'POST',
|
|
357
357
|
headers: buildEgdeskHeaders(),
|
|
358
358
|
body,
|
|
@@ -845,7 +845,7 @@ export const config = {
|
|
|
845
845
|
matcher: [
|
|
846
846
|
/*
|
|
847
847
|
* Match all paths except static assets
|
|
848
|
-
* The proxy function filters for __user_data_proxy / __browser_recording_proxy /
|
|
848
|
+
* The proxy function filters for __user_data_proxy / __browser_recording_proxy / __business_identity_proxy / __company_research_proxy / __ai_center_proxy / __korean_law_proxy / __bizinfo_proxy / __nps_proxy / __seo_proxy / __hosting_coding_proxy / __local_agent_proxy / __pageindex_proxy / __drive_proxy / __sheets_proxy / __docs_proxy / __slides_proxy / __egdesk_http_proxy / __gmail_proxy / __apps_script_proxy / __knowledge_wiki_proxy / __egdesk_config_proxy / __ai_caller_proxy / __kakao_proxy / __phone_proxy / __instagram_proxy / __financehub_proxy / __blog_proxy / __youtube_proxy / __visitor_auth_proxy / __visitor_google_proxy
|
|
849
849
|
*/
|
|
850
850
|
'/:path*',
|
|
851
851
|
],
|
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.74";
|
|
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.74';
|
|
50
50
|
const fs = __importStar(require("fs"));
|
|
51
51
|
const path = __importStar(require("path"));
|
|
52
52
|
const setup_userdata_1 = require("./setup-userdata");
|