@egdesk/next-api-plugin 1.5.38 → 1.5.40

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
@@ -99,6 +99,8 @@ The plugin generates `middleware.ts` or `proxy.ts` that intercepts special paths
99
99
  |------|-------------|
100
100
  | `__user_data_proxy` | `POST /user-data/tools/call` |
101
101
  | `__browser_recording_proxy` | `POST /browser-recording/tools/call` |
102
+
103
+ **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`.
102
104
  | `__internal_knowledge_proxy` | `POST /internal-knowledge/tools/call` (knowledge docs, business identity snapshots, company research) |
103
105
 
104
106
  **User-data request flow:**
@@ -1659,6 +1659,10 @@ export async function searchCompanyResearch(searchText: string) {
1659
1659
  *
1660
1660
  * - Server: \`POST {apiUrl}/browser-recording/tools/call\`
1661
1661
  * - Client: \`POST /__browser_recording_proxy\` (see proxy.ts / middleware)
1662
+ *
1663
+ * File upload (standalone, not only download-chain):
1664
+ * list_sites → open_account → inspect_page → uploadBrowserRecordingFile(sessionId, absPath, elementIndex?)
1665
+ * See uploadBrowserRecordingFile() for the full caller recipe.
1662
1666
  */
1663
1667
  export async function callBrowserRecordingTool(
1664
1668
  toolName: string,
@@ -1708,6 +1712,8 @@ export type BrowserRecordingRunOptions = {
1708
1712
  datePickersByIndex?: string[];
1709
1713
  /** Per captureLabeledFields step, values in field order */
1710
1714
  labeledFieldFills?: (string | undefined)[][];
1715
+ /** Per fileUpload step — absolute path override (empty uses the recorded path) */
1716
+ fileUploadsByIndex?: (string | undefined)[];
1711
1717
  };
1712
1718
 
1713
1719
  export type BrowserRecordingScheduleOptions = {
@@ -1855,7 +1861,7 @@ export async function searchBrowserRecordingElements(sessionId: string, query: s
1855
1861
  return callBrowserRecordingTool('browser_recording_search_elements', { sessionId, query });
1856
1862
  }
1857
1863
 
1858
- /** Visible form fields; password values redacted */
1864
+ /** Visible form fields (dialog-scoped). lookup = type_into then double-click a row. */
1859
1865
  export async function getBrowserRecordingForms(
1860
1866
  sessionId: string,
1861
1867
  scroll?: 'none' | 'up' | 'down'
@@ -1866,12 +1872,20 @@ export async function getBrowserRecordingForms(
1866
1872
  });
1867
1873
  }
1868
1874
 
1869
- /** Click by last-inspect index (prefers the real link over a wrapping table cell) */
1870
- export async function clickBrowserRecordingElement(sessionId: string, elementIndex: number) {
1871
- return callBrowserRecordingTool('browser_recording_click_element', { sessionId, elementIndex });
1875
+ /** Click by last-inspect index. clickCount=2 double-clicks a lookup row. */
1876
+ export async function clickBrowserRecordingElement(
1877
+ sessionId: string,
1878
+ elementIndex: number,
1879
+ clickCount?: 1 | 2
1880
+ ) {
1881
+ return callBrowserRecordingTool('browser_recording_click_element', {
1882
+ sessionId,
1883
+ elementIndex,
1884
+ ...(clickCount === 2 ? { clickCount: 2 } : {}),
1885
+ });
1872
1886
  }
1873
1887
 
1874
- /** Fill by field_id from getBrowserRecordingForms. Password fields are rejected. */
1888
+ /** Fill free-text/select by field_id (locator + verify). Rejected: passwords, lookups, file inputs. */
1875
1889
  export async function fillBrowserRecordingForm(
1876
1890
  sessionId: string,
1877
1891
  fields: Array<{ field_id: string; value: string }>
@@ -1879,6 +1893,20 @@ export async function fillBrowserRecordingForm(
1879
1893
  return callBrowserRecordingTool('browser_recording_fill_form', { sessionId, fields });
1880
1894
  }
1881
1895
 
1896
+ /** Type into a lookup/search field (does not bind hidden id). Then inspect and double-click a row. */
1897
+ export async function typeIntoBrowserRecording(
1898
+ sessionId: string,
1899
+ opts: { field_id?: string; elementIndex?: number; text: string; submit?: boolean }
1900
+ ) {
1901
+ return callBrowserRecordingTool('browser_recording_type_into', {
1902
+ sessionId,
1903
+ text: opts.text,
1904
+ ...(opts.field_id ? { field_id: opts.field_id } : {}),
1905
+ ...(opts.elementIndex !== undefined ? { elementIndex: opts.elementIndex } : {}),
1906
+ ...(opts.submit ? { submit: true } : {}),
1907
+ });
1908
+ }
1909
+
1882
1910
  /** Press Enter / Escape / arrows in the open live session (e.g. after 메뉴검색) */
1883
1911
  export async function pressBrowserRecordingKey(
1884
1912
  sessionId: string,
@@ -1902,6 +1930,39 @@ export async function listBrowserRecordingSessionActions(sessionId: string) {
1902
1930
  return callBrowserRecordingTool('browser_recording_list_session_actions', { sessionId });
1903
1931
  }
1904
1932
 
1933
+ /**
1934
+ * Attach a local file in an open live session (standalone fileUpload).
1935
+ *
1936
+ * How to call this from an MCP / helper caller:
1937
+ * 1. Enable the browser-recording service and start the EGDesk HTTP server.
1938
+ * 2. listBrowserRecordingSites() — navigate-only recordings (no login) use
1939
+ * accountKey: "__unknown_account__".
1940
+ * 3. openBrowserRecordingAccount(siteKey, accountKey) — replays login if one
1941
+ * was recorded, otherwise just opens the first navigate URL. Keep Chrome open.
1942
+ * 4. inspectBrowserRecordingPage(sessionId) (or search). Pick the
1943
+ * input / "[file input]" index, not a heading. Styled "Select PDF files"
1944
+ * buttons often do not fire a file chooser; the hidden file input does.
1945
+ * 5. Call this helper with an absolute path on the EGDesk machine.
1946
+ * Omit elementIndex to use the first input[type=file].
1947
+ * 6. Re-inspect, then listBrowserRecordingSessionActions → saveBrowserRecordingSession
1948
+ * to persist the upload. Replay uses the recorded path; override with
1949
+ * fileUploadsByIndex on runBrowserRecording.
1950
+ *
1951
+ * HTTP equivalent: POST /browser-recording/tools/call
1952
+ * { tool: "browser_recording_upload_file", arguments: { sessionId, filePath, elementIndex? } }
1953
+ */
1954
+ export async function uploadBrowserRecordingFile(
1955
+ sessionId: string,
1956
+ filePath: string,
1957
+ elementIndex?: number
1958
+ ) {
1959
+ return callBrowserRecordingTool('browser_recording_upload_file', {
1960
+ sessionId,
1961
+ filePath,
1962
+ ...(elementIndex !== undefined ? { elementIndex } : {}),
1963
+ });
1964
+ }
1965
+
1905
1966
  /** Save the live session as a new *.spec.js (login prefix + logged workflow). Does not close Chrome. */
1906
1967
  export async function saveBrowserRecordingSession(sessionId: string, name: string) {
1907
1968
  return callBrowserRecordingTool('browser_recording_save_session', { sessionId, name });
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.48";
11
+ export declare const COMPATIBLE_APP_VERSION = "1.4.49";
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.48';
49
+ exports.COMPATIBLE_APP_VERSION = '1.4.49';
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.38",
3
+ "version": "1.5.40",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",