@egdesk/next-api-plugin 1.5.64 → 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 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, internal knowledge / business identity / company research, browser recording replay + live browse)
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
- | `__internal_knowledge_proxy` | `POST /internal-knowledge/tools/call` (knowledge docs, business identity snapshots, company research) |
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
- // Internal Knowledge / Business Identity / Company Research (MCP)
214
- callInternalKnowledgeTool(toolName: string, args?: Record<string, any>)
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)
@@ -1620,16 +1620,16 @@ export async function deleteFinanceHubBankProductRows(options: {
1620
1620
  }
1621
1621
 
1622
1622
  // ==========================================
1623
- // INTERNAL KNOWLEDGE / BUSINESS IDENTITY / COMPANY RESEARCH (MCP)
1623
+ // BUSINESS IDENTITY / COMPANY RESEARCH (MCP)
1624
1624
  // ==========================================
1625
1625
 
1626
1626
  /**
1627
- * Call EGDesk Internal Knowledge MCP tool (knowledge docs, business identity snapshots, company research).
1627
+ * Call EGDesk Business Identity MCP tool (snapshots, product catalog, brand faces).
1628
1628
  *
1629
- * - Server: \`POST {apiUrl}/internal-knowledge/tools/call\`
1630
- * - Client: \`POST /__internal_knowledge_proxy\` (see proxy.ts / middleware)
1629
+ * - Server: \`POST {apiUrl}/business-identity/tools/call\`
1630
+ * - Client: \`POST /__business_identity_proxy\` (see proxy.ts / middleware)
1631
1631
  */
1632
- export async function callInternalKnowledgeTool(
1632
+ export async function callBusinessIdentityTool(
1633
1633
  toolName: string,
1634
1634
  args: Record<string, any> = {}
1635
1635
  ): Promise<any> {
@@ -1642,13 +1642,13 @@ export async function callInternalKnowledgeTool(
1642
1642
  const apiUrl =
1643
1643
  (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
1644
1644
  EGDESK_CONFIG.apiUrl;
1645
- response = await fetch(\`\${apiUrl}/internal-knowledge/tools/call\`, {
1645
+ response = await fetch(\`\${apiUrl}/business-identity/tools/call\`, {
1646
1646
  method: 'POST',
1647
1647
  headers: buildServerEgdeskHeaders(),
1648
1648
  body
1649
1649
  });
1650
1650
  } else {
1651
- response = await apiFetch('/__internal_knowledge_proxy', {
1651
+ response = await apiFetch('/__business_identity_proxy', {
1652
1652
  method: 'POST',
1653
1653
  headers: { 'Content-Type': 'application/json' },
1654
1654
  body
@@ -1658,93 +1658,57 @@ export async function callInternalKnowledgeTool(
1658
1658
  return parseEgdeskMcpToolResponse(response);
1659
1659
  }
1660
1660
 
1661
- /** List internal knowledge documents for a business identity snapshot */
1662
- export async function listKnowledgeDocuments(
1663
- snapshotId: string,
1664
- category?: 'hierarchy' | 'process' | 'policy' | 'note'
1665
- ) {
1666
- return callInternalKnowledgeTool('knowledge_list_documents', {
1667
- snapshotId,
1668
- ...(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 } : {})
1669
1665
  });
1670
1666
  }
1671
1667
 
1672
- /** Get one knowledge document by ID (full markdown content) */
1673
- export async function getKnowledgeDocument(documentId: string) {
1674
- return callInternalKnowledgeTool('knowledge_get_document', { documentId });
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 });
1675
1671
  }
1676
1672
 
1677
- /** Search knowledge documents by text in title or content */
1678
- export async function searchKnowledgeContent(
1679
- snapshotId: string,
1680
- searchText: string,
1681
- category?: 'hierarchy' | 'process' | 'policy' | 'note'
1682
- ) {
1683
- return callInternalKnowledgeTool('knowledge_search_content', {
1684
- snapshotId,
1685
- searchText,
1686
- ...(category != null ? { category } : {})
1687
- });
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 });
1688
1676
  }
1689
1677
 
1690
- /** Get all documents of a single category for a snapshot */
1691
- export async function getKnowledgeByCategory(
1692
- snapshotId: string,
1693
- category: 'hierarchy' | 'process' | 'policy' | 'note'
1694
- ) {
1695
- return callInternalKnowledgeTool('knowledge_get_by_category', { snapshotId, category });
1678
+ /** Services and products from a snapshot */
1679
+ export async function getBusinessIdentityServicesProducts(snapshotId: string) {
1680
+ return callBusinessIdentityTool('bi_get_services_products', { snapshotId });
1681
+ }
1682
+
1683
+ /** List managed catalog products for a BI snapshot */
1684
+ export async function listBusinessIdentityCatalogProducts(snapshotId: string) {
1685
+ return callBusinessIdentityTool('bi_catalog_list_products', { snapshotId });
1696
1686
  }
1697
1687
 
1698
- /** Create a new knowledge document */
1699
- export async function createKnowledgeDocument(
1688
+ /** Get one catalog product by id or name */
1689
+ export async function getBusinessIdentityCatalogProduct(
1700
1690
  snapshotId: string,
1701
- title: string,
1702
- category: 'hierarchy' | 'process' | 'policy' | 'note',
1703
- content?: string
1691
+ productIdOrName: string,
1692
+ includeImages?: boolean
1704
1693
  ) {
1705
- return callInternalKnowledgeTool('knowledge_create_document', {
1694
+ return callBusinessIdentityTool('bi_catalog_get_product', {
1706
1695
  snapshotId,
1707
- title,
1708
- category,
1709
- ...(content != null ? { content } : {})
1696
+ productIdOrName,
1697
+ includeImages
1710
1698
  });
1711
1699
  }
1712
1700
 
1713
- /** Update an existing knowledge document */
1714
- export async function updateKnowledgeDocument(
1715
- documentId: string,
1716
- updates: { title?: string; category?: 'hierarchy' | 'process' | 'policy' | 'note'; content?: string }
1701
+ /** List AI brand faces / spokespersons for a BI snapshot */
1702
+ export async function listBusinessIdentityFaces(
1703
+ snapshotId: string,
1704
+ includePortraitBase64?: boolean
1717
1705
  ) {
1718
- return callInternalKnowledgeTool('knowledge_update_document', { documentId, ...updates });
1719
- }
1720
-
1721
- /** Delete a knowledge document */
1722
- export async function deleteKnowledgeDocument(documentId: string) {
1723
- return callInternalKnowledgeTool('knowledge_delete_document', { documentId });
1724
- }
1725
-
1726
- /** List business identity snapshots (optional brand filter) */
1727
- export async function listBusinessIdentitySnapshots(brandKey?: string) {
1728
- return callInternalKnowledgeTool('businessidentity_list_snapshots', {
1729
- ...(brandKey != null ? { brandKey } : {})
1706
+ return callBusinessIdentityTool('bi_face_list', {
1707
+ snapshotId,
1708
+ includePortraitBase64
1730
1709
  });
1731
1710
  }
1732
1711
 
1733
- /** Full snapshot by ID (identity JSON, SEO/SSL analysis, etc.) */
1734
- export async function getBusinessIdentitySnapshot(snapshotId: string) {
1735
- return callInternalKnowledgeTool('businessidentity_get_snapshot', { snapshotId });
1736
- }
1737
-
1738
- /** Company info slice from a snapshot (contact, structure, partners, industries) */
1739
- export async function getBusinessIdentityCompanyInfo(snapshotId: string) {
1740
- return callInternalKnowledgeTool('businessidentity_get_company_info', { snapshotId });
1741
- }
1742
-
1743
- /** Services and products from a snapshot */
1744
- export async function getBusinessIdentityServicesProducts(snapshotId: string) {
1745
- return callInternalKnowledgeTool('businessidentity_get_services_products', { snapshotId });
1746
- }
1747
-
1748
1712
  /**
1749
1713
  * Call EGDesk Company Research MCP tool (run workflows and query saved research).
1750
1714
  *
@@ -2080,6 +2044,20 @@ export async function fillBrowserRecordingForm(
2080
2044
  return callBrowserRecordingTool('browser_recording_fill_form', { sessionId, fields });
2081
2045
  }
2082
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
+
2083
2061
  /** Type into a lookup/search field (does not bind hidden id). Then inspect and double-click a row. */
2084
2062
  export async function typeIntoBrowserRecording(
2085
2063
  sessionId: string,
@@ -2163,11 +2141,16 @@ export async function saveBrowserRecordingPageHtml(sessionId: string, name?: str
2163
2141
  });
2164
2142
  }
2165
2143
 
2166
- /** 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. */
2167
2145
  export async function forEachBrowserRecordingRow(
2168
2146
  sessionId: string,
2169
2147
  query: string,
2170
- opts?: { namePrefix?: string; skipExisting?: boolean; maxRows?: number }
2148
+ opts?: {
2149
+ namePrefix?: string;
2150
+ skipExisting?: boolean;
2151
+ maxRows?: number;
2152
+ nextPage?: { elementIndex?: number; selector?: string; maxPages?: number };
2153
+ }
2171
2154
  ) {
2172
2155
  return callBrowserRecordingTool('browser_recording_for_each_row', {
2173
2156
  sessionId,
@@ -2175,6 +2158,7 @@ export async function forEachBrowserRecordingRow(
2175
2158
  ...(opts?.namePrefix ? { namePrefix: opts.namePrefix } : {}),
2176
2159
  ...(opts?.skipExisting === false ? { skipExisting: false } : {}),
2177
2160
  ...(opts?.maxRows !== undefined ? { maxRows: opts.maxRows } : {}),
2161
+ ...(opts?.nextPage ? { nextPage: opts.nextPage } : {}),
2178
2162
  });
2179
2163
  }
2180
2164
 
@@ -2746,16 +2730,16 @@ export async function getSeoIssuesSummary(reportId: string) {
2746
2730
  }
2747
2731
 
2748
2732
  // ==========================================
2749
- // SSL (MCP)
2733
+ // HOSTING & CODING (MCP)
2750
2734
  // ==========================================
2751
2735
 
2752
2736
  /**
2753
- * Call EGDesk SSL MCP tool (TLS/security analysis and certificate management).
2737
+ * Call EGDesk Hosting & Coding MCP tool (SSL, certificates, and local dev servers).
2754
2738
  *
2755
- * - Server: \`POST {apiUrl}/ssl/tools/call\`
2756
- * - Client: \`POST /__ssl_proxy\` (see proxy.ts / middleware)
2739
+ * - Server: \`POST {apiUrl}/hosting-coding/tools/call\`
2740
+ * - Client: \`POST /__hosting_coding_proxy\` (see proxy.ts / middleware)
2757
2741
  */
2758
- export async function callSslTool(
2742
+ export async function callHostingCodingTool(
2759
2743
  toolName: string,
2760
2744
  args: Record<string, any> = {}
2761
2745
  ): Promise<any> {
@@ -2768,13 +2752,13 @@ export async function callSslTool(
2768
2752
  const apiUrl =
2769
2753
  (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
2770
2754
  EGDESK_CONFIG.apiUrl;
2771
- response = await fetch(\`\${apiUrl}/ssl/tools/call\`, {
2755
+ response = await fetch(\`\${apiUrl}/hosting-coding/tools/call\`, {
2772
2756
  method: 'POST',
2773
2757
  headers: buildServerEgdeskHeaders(),
2774
2758
  body
2775
2759
  });
2776
2760
  } else {
2777
- response = await apiFetch('/__ssl_proxy', {
2761
+ response = await apiFetch('/__hosting_coding_proxy', {
2778
2762
  method: 'POST',
2779
2763
  headers: { 'Content-Type': 'application/json' },
2780
2764
  body
@@ -2785,65 +2769,105 @@ export async function callSslTool(
2785
2769
  }
2786
2770
 
2787
2771
  /** Full SSL/security audit: cert, headers, and letter grade (A+ to F) */
2788
- export async function analyzeSslSite(url: string, save: boolean = true) {
2789
- return callSslTool('ssl_analyze_site', { url, save });
2772
+ export async function analyzeHostingSite(url: string, save: boolean = true) {
2773
+ return callHostingCodingTool('hosting_analyze_site', { url, save });
2790
2774
  }
2791
2775
 
2792
2776
  /** Inspect TLS certificate for a URL (expiry, issuer, SANs) */
2793
- export async function checkSslCertificate(url: string) {
2794
- return callSslTool('ssl_check_certificate', { url });
2777
+ export async function checkHostingCertificate(url: string) {
2778
+ return callHostingCodingTool('hosting_check_certificate', { url });
2795
2779
  }
2796
2780
 
2797
2781
  /** Check security headers (HSTS, CSP, X-Frame-Options, etc.) */
2798
- export async function checkSecurityHeaders(url: string) {
2799
- return callSslTool('ssl_check_security_headers', { url });
2782
+ export async function checkHostingSecurityHeaders(url: string) {
2783
+ return callHostingCodingTool('hosting_check_security_headers', { url });
2800
2784
  }
2801
2785
 
2802
2786
  /** List saved SSL analysis history entries */
2803
- export async function listSslAnalyses(options: { websiteUrl?: string; limit?: number } = {}) {
2804
- return callSslTool('ssl_list_analyses', options);
2787
+ export async function listHostingAnalyses(options: { websiteUrl?: string; limit?: number } = {}) {
2788
+ return callHostingCodingTool('hosting_list_analyses', options);
2805
2789
  }
2806
2790
 
2807
2791
  /** Get a saved SSL analysis by ID */
2808
- export async function getSslAnalysis(id: string) {
2809
- return callSslTool('ssl_get_analysis', { id });
2792
+ export async function getHostingAnalysis(id: string) {
2793
+ return callHostingCodingTool('hosting_get_analysis', { id });
2810
2794
  }
2811
2795
 
2812
2796
  /** List stored SSL certificates (metadata only, no private keys) */
2813
- export async function listSslCertificates() {
2814
- return callSslTool('ssl_list_certificates', {});
2797
+ export async function listHostingCertificates() {
2798
+ return callHostingCodingTool('hosting_list_certificates', {});
2815
2799
  }
2816
2800
 
2817
2801
  /** Get stored certificate metadata by ID */
2818
- export async function getSslCertificate(id: string) {
2819
- return callSslTool('ssl_get_certificate', { id });
2802
+ export async function getHostingCertificate(id: string) {
2803
+ return callHostingCodingTool('hosting_get_certificate', { id });
2820
2804
  }
2821
2805
 
2822
2806
  /** Generate a self-signed certificate for local development */
2823
- export async function generateSelfSignedCertificate(domain: string) {
2824
- return callSslTool('ssl_generate_self_signed', { domain });
2807
+ export async function generateHostingSelfSignedCertificate(domain: string) {
2808
+ return callHostingCodingTool('hosting_generate_self_signed', { domain });
2825
2809
  }
2826
2810
 
2827
2811
  /** Generate a mkcert-trusted local development certificate (macOS) */
2828
- export async function generateTrustedLocalCertificate(domain: string = 'egdesk.local') {
2829
- return callSslTool('ssl_generate_trusted_local', { domain });
2812
+ export async function generateHostingTrustedLocalCertificate(domain: string = 'egdesk.local') {
2813
+ return callHostingCodingTool('hosting_generate_trusted_local', { domain });
2830
2814
  }
2831
2815
 
2832
2816
  /** Request a Let's Encrypt certificate via ACME HTTP-01 */
2833
- export async function generateLetsEncryptCertificate(domain: string, email?: string) {
2834
- return callSslTool('ssl_generate_lets_encrypt', { domain, email });
2817
+ export async function generateHostingLetsEncryptCertificate(domain: string, email?: string) {
2818
+ return callHostingCodingTool('hosting_generate_lets_encrypt', { domain, email });
2835
2819
  }
2836
2820
 
2837
2821
  /** Set the active certificate used by EGDesk dev servers */
2838
- export async function setActiveSslCertificate(certificateId: string | null) {
2839
- return callSslTool('ssl_set_active_certificate', { certificateId });
2822
+ export async function setActiveHostingCertificate(certificateId: string | null) {
2823
+ return callHostingCodingTool('hosting_set_active_certificate', { certificateId });
2840
2824
  }
2841
2825
 
2842
2826
  /** Delete a stored certificate by ID */
2843
- export async function deleteSslCertificate(id: string) {
2844
- return callSslTool('ssl_delete_certificate', { id });
2827
+ export async function deleteHostingCertificate(id: string) {
2828
+ return callHostingCodingTool('hosting_delete_certificate', { id });
2845
2829
  }
2846
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 });
2854
+ }
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
+
2847
2871
  // ==========================================
2848
2872
  // Local Agent AI (MCP)
2849
2873
  // ==========================================
@@ -3421,12 +3445,18 @@ export async function setDriveTargetFolders(folderIds: string[]) {
3421
3445
  return callDriveTool('drive_set_target_folders', { folderIds });
3422
3446
  }
3423
3447
 
3424
- /** Upload a local file into a Drive folder (local → Workspace) */
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
+ */
3425
3454
  export async function uploadDriveFile(options: {
3426
3455
  filePath: string;
3427
3456
  folderId?: string;
3428
3457
  destName?: string;
3429
3458
  mimeType?: string;
3459
+ preferOAuth?: boolean;
3430
3460
  }) {
3431
3461
  return callDriveTool('drive_upload', options);
3432
3462
  }
@@ -3451,38 +3481,44 @@ export async function getDriveFile(fileId: string, options: WorkspaceVisitorCall
3451
3481
  return callDriveTool('drive_get_file', { fileId, preferOAuth }, { ...options, preferOAuth });
3452
3482
  }
3453
3483
 
3454
- /** Create a Drive folder */
3455
- export async function createDriveFolder(name: string, parentId?: string) {
3456
- return callDriveTool('drive_create_folder', { name, parentId });
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 });
3457
3492
  }
3458
3493
 
3459
- /** Download a Drive file to a local path */
3460
- export async function downloadDriveFile(fileId: string, destPath: string) {
3461
- 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 });
3462
3497
  }
3463
3498
 
3464
- /** Move a file or folder into destFolderId */
3465
- export async function moveDriveFile(fileId: string, destFolderId: string) {
3466
- 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 });
3467
3502
  }
3468
3503
 
3469
- /** Copy a Drive file */
3504
+ /** Copy a Drive file. Pass preferOAuth: true to act as the signed-in Google user. */
3470
3505
  export async function copyDriveFile(options: {
3471
3506
  fileId: string;
3472
3507
  destName?: string;
3473
3508
  destFolderId?: string;
3509
+ preferOAuth?: boolean;
3474
3510
  }) {
3475
3511
  return callDriveTool('drive_copy', options);
3476
3512
  }
3477
3513
 
3478
- /** Rename a Drive file or folder */
3479
- export async function renameDriveFile(fileId: string, name: string) {
3480
- 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 });
3481
3517
  }
3482
3518
 
3483
- /** Move a Drive file or folder to trash */
3484
- export async function trashDriveFile(fileId: string) {
3485
- 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 });
3486
3522
  }
3487
3523
 
3488
3524
  /** Find or create the top-level EGDesk Drive folder */
@@ -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, __internal_knowledge_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
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('__internal_knowledge_proxy')) {
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}/internal-knowledge/tools/call\`, {
202
+ const response = await fetch(\`\${apiUrl}/business-identity/tools/call\`, {
203
203
  method: 'POST',
204
204
  headers,
205
205
  body,
@@ -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, __internal_knowledge_proxy, __company_research_proxy, __ai_center_proxy, __korean_law_proxy, __bizinfo_proxy, __nps_proxy, __seo_proxy, __ssl_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
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('__internal_knowledge_proxy')) {
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}/internal-knowledge/tools/call\`, {
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('__ssl_proxy')) {
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}/ssl/tools/call\`, {
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 / __internal_knowledge_proxy / __company_research_proxy / __ai_center_proxy / __korean_law_proxy / __bizinfo_proxy / __nps_proxy / __seo_proxy / __ssl_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
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.71";
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.71';
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egdesk/next-api-plugin",
3
- "version": "1.5.64",
3
+ "version": "1.5.69",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",