@roxybrowser/openapi 1.0.13-beta.6 → 1.0.13-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -2120,6 +2120,14 @@ var ListBrowsers = class {
2120
2120
  searchParams.append("page_index", params.pageIndex.toString());
2121
2121
  if (params.pageSize)
2122
2122
  searchParams.append("page_size", params.pageSize.toString());
2123
+ if (params.windowSortNum) {
2124
+ if (params.windowSortNum.includes("-")) {
2125
+ const [_, serialNo] = params.windowSortNum.split("-").map((s) => s.trim());
2126
+ searchParams.append("windowSortNum", serialNo);
2127
+ } else {
2128
+ searchParams.append("windowSortNum", params.windowSortNum);
2129
+ }
2130
+ }
2123
2131
  const result = await request(`/browser/list_v3?${searchParams}`, {
2124
2132
  method: "GET"
2125
2133
  });
@@ -2134,23 +2142,29 @@ var ListBrowsers = class {
2134
2142
  const pageSize = params.pageSize ?? 15;
2135
2143
  const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
2136
2144
  const hasNextPage = currentPage < totalPages;
2137
- text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
2138
-
2139
- ${data.rows.map((browser) => {
2140
- const serialNo = `${browser.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${browser.windowSortNum}`;
2141
- return `**${browser.windowName || "Unnamed"}** (Serial No: ${serialNo})
2142
- - CoreVersion: ${browser.coreVersion} - DirId: ${browser.dirId}
2143
- - OSVersion: ${browser.osVersion}
2144
- - OS: ${browser.os}
2145
- - Remark: ${browser.windowRemark}`;
2146
- }).join("\n\n")}
2147
-
2148
- Pagination:
2149
- - currentPage: ${currentPage}
2150
- - pageSize: ${pageSize}
2151
- - totalPages: ${totalPages}
2152
- - hasNextPage: ${hasNextPage}
2153
- ${hasNextPage ? `- nextPageHint: Call roxy_list_browsers again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
2145
+ const readable = [];
2146
+ if (data.total > 0) {
2147
+ readable.push(`Found ${data.total} browsers in workspace ${params.workspaceId}:`);
2148
+ const browserList = data.rows.map((browser) => {
2149
+ const serialNo = `${browser.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${browser.windowSortNum}`;
2150
+ const info = [
2151
+ `Profile Name: **${browser.windowName || "Unnamed"}** (SN: ${serialNo})`,
2152
+ ` - CoreVersion: ${browser.coreVersion}`,
2153
+ ` - OS: ${browser.os} ${browser.osVersion}`
2154
+ ];
2155
+ if (browser.windowRemark) {
2156
+ info.push(` - Remark: ${browser.windowRemark}`);
2157
+ }
2158
+ return info.join("\n");
2159
+ }).join("\n\n");
2160
+ readable.push(browserList);
2161
+ if (totalPages > 1) {
2162
+ readable.push(`Pagination: page=${currentPage}, totalPages=${totalPages}, hasNext=${hasNextPage}`);
2163
+ }
2164
+ } else {
2165
+ readable.push(`No browsers found in workspace ${params.workspaceId}.`);
2166
+ }
2167
+ text = readable.join("\n\n");
2154
2168
  }
2155
2169
  return {
2156
2170
  content: [
@@ -2314,6 +2328,10 @@ var GetBrowserDetail = class {
2314
2328
  dirId: {
2315
2329
  type: "string",
2316
2330
  description: "Browser directory ID"
2331
+ },
2332
+ windowSortNum: {
2333
+ type: "string",
2334
+ description: "Filter by window `Serial No` (e.g. 1, 102)"
2317
2335
  }
2318
2336
  },
2319
2337
  required: ["workspaceId", "dirId"]
@@ -2339,6 +2357,14 @@ var GetBrowserDetail = class {
2339
2357
  const searchParams = new URLSearchParams();
2340
2358
  searchParams.append("workspaceId", params.workspaceId.toString());
2341
2359
  searchParams.append("dirId", params.dirId);
2360
+ if (params.windowSortNum) {
2361
+ if (params.windowSortNum.includes("-")) {
2362
+ const [_, serialNo] = params.windowSortNum.split("-").map((s) => s.trim());
2363
+ searchParams.append("windowSortNum", serialNo);
2364
+ } else {
2365
+ searchParams.append("windowSortNum", params.windowSortNum);
2366
+ }
2367
+ }
2342
2368
  const result = await request(`/browser/detail?${searchParams}`, {
2343
2369
  method: "GET"
2344
2370
  });
@@ -2771,26 +2797,10 @@ ${ws.project_details.map(
2771
2797
  };
2772
2798
  var HealthCheck = class {
2773
2799
  name = "roxy_health_check";
2774
- description = "Check if the target server is alive and healthy. This tool performs a health check to verify server connectivity and status.";
2800
+ description = "Check whether the RoxyBrowser server is running and reachable.";
2775
2801
  inputSchema = {
2776
2802
  type: "object",
2777
- properties: {
2778
- includeWorkspaceCheck: {
2779
- type: "boolean",
2780
- description: "Include workspace connectivity tests (optional, default: true)",
2781
- default: true
2782
- },
2783
- includeBrowserCheck: {
2784
- type: "boolean",
2785
- description: "Include browser availability checks (optional, default: true)",
2786
- default: true
2787
- },
2788
- verbose: {
2789
- type: "boolean",
2790
- description: "Include detailed diagnostic information (optional, default: false)",
2791
- default: false
2792
- }
2793
- }
2803
+ properties: {}
2794
2804
  };
2795
2805
  get schema() {
2796
2806
  return {
@@ -2799,126 +2809,19 @@ var HealthCheck = class {
2799
2809
  inputSchema: this.inputSchema
2800
2810
  };
2801
2811
  }
2802
- async handle(params) {
2803
- const { includeWorkspaceCheck = true, includeBrowserCheck = true, verbose = false } = params || {};
2804
- let healthStatus = "unknown";
2805
- let healthError = "";
2812
+ async handle(_params) {
2813
+ let text = "";
2806
2814
  try {
2807
- const healthResult = await request("/health", {
2815
+ const result = await request("/health", {
2808
2816
  method: "GET"
2809
2817
  });
2810
- if (healthResult.code === 0 || healthResult.code === void 0) {
2811
- healthStatus = "healthy";
2812
- } else {
2813
- healthStatus = "unhealthy";
2814
- healthError = healthResult.msg || "Health check failed";
2815
- }
2818
+ text = result.code === 0 ? "\u2705 **Server is healthy**\n\nThe RoxyBrowser server is running and reachable." : `\u274C **Server health check failed**
2819
+
2820
+ ${result.msg || "Unknown server response"}`;
2816
2821
  } catch (error) {
2817
- healthStatus = "unhealthy";
2818
- healthError = error.message || "Failed to connect to server";
2819
- }
2820
- let text = `## \u{1F50D} \u5065\u5EB7\u68C0\u67E5\u62A5\u544A / Health Check Report
2822
+ text = `\u274C **Server is unavailable**
2821
2823
 
2822
- `;
2823
- text += `### \u{1F310} \u670D\u52A1\u5668\u72B6\u6001 / Server Status
2824
- `;
2825
- text += `- **\u670D\u52A1\u5668\u8FDE\u63A5 / Server Connection**: ${healthStatus === "healthy" ? "\u2705 \u6B63\u5E38" : "\u274C \u5F02\u5E38"}
2826
- `;
2827
- if (healthStatus !== "healthy" && healthError) {
2828
- text += `- **\u9519\u8BEF\u4FE1\u606F / Error**: ${healthError}
2829
- `;
2830
- }
2831
- if (includeWorkspaceCheck && healthStatus === "healthy") {
2832
- try {
2833
- const workspaceResult = await request("/browser/workspace?page_index=1&page_size=5", {
2834
- method: "GET"
2835
- });
2836
- if (workspaceResult.code === 0) {
2837
- const workspaces = workspaceResult.data;
2838
- text += `
2839
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2840
- `;
2841
- text += `- **\u53EF\u7528\u5DE5\u4F5C\u533A / Available Workspaces**: ${workspaces.total}
2842
- `;
2843
- if (workspaces.rows && workspaces.rows.length > 0) {
2844
- text += `- **\u5DE5\u4F5C\u533A\u8BE6\u60C5 / Workspace Details**:
2845
- `;
2846
- workspaces.rows.slice(0, 3).forEach((ws) => {
2847
- const projectCount = ws.project_details?.length || 0;
2848
- text += ` - ${ws.workspaceName} (ID: ${ws.id}) - ${projectCount} projects
2849
- `;
2850
- });
2851
- if (workspaces.total > 3) {
2852
- text += ` - ... and ${workspaces.total - 3} more
2853
- `;
2854
- }
2855
- }
2856
- } else {
2857
- text += `
2858
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2859
- `;
2860
- text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
2861
- `;
2862
- text += `- **\u9519\u8BEF**: ${workspaceResult.msg}
2863
- `;
2864
- }
2865
- } catch (error) {
2866
- text += `
2867
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2868
- `;
2869
- text += `- **\u72B6\u6001**: \u274C \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
2870
- `;
2871
- text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
2872
- `;
2873
- }
2874
- }
2875
- if (includeBrowserCheck && healthStatus === "healthy") {
2876
- try {
2877
- const workspaceResult = await request("/browser/workspace?page_index=1&page_size=1", {
2878
- method: "GET"
2879
- });
2880
- if (workspaceResult.code === 0 && workspaceResult.data.rows && workspaceResult.data.rows.length > 0) {
2881
- const firstWorkspace = workspaceResult.data.rows[0];
2882
- const browserResult = await request(`/browser/list_v3?workspaceId=${firstWorkspace.id}&page_index=1&page_size=5`, {
2883
- method: "GET"
2884
- });
2885
- if (browserResult.code === 0) {
2886
- const browsers = browserResult.data;
2887
- text += `
2888
- ### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
2889
- `;
2890
- text += `- **\u5DE5\u4F5C\u533A / Workspace**: ${firstWorkspace.workspaceName} (ID: ${firstWorkspace.id})
2891
- `;
2892
- text += `- **\u6D4F\u89C8\u5668\u603B\u6570 / Total Browsers**: ${browsers.total}
2893
- `;
2894
- if (browsers.rows && browsers.rows.length > 0) {
2895
- text += `- **\u6D4F\u89C8\u5668\u793A\u4F8B / Browser Examples**:
2896
- `;
2897
- browsers.rows.slice(0, 3).forEach((browser) => {
2898
- text += ` - ${browser.windowName || "Unnamed"} (ID: ${browser.dirId}) - ${browser.status}
2899
- `;
2900
- });
2901
- }
2902
- }
2903
- }
2904
- } catch (error) {
2905
- text += `
2906
- ### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
2907
- `;
2908
- text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u6D4F\u89C8\u5668\u4FE1\u606F
2909
- `;
2910
- text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
2911
- `;
2912
- }
2913
- }
2914
- if (verbose && healthStatus === "healthy") {
2915
- text += `
2916
- ### \u{1F4CA} \u8BE6\u7EC6\u4FE1\u606F / Detailed Information
2917
- `;
2918
- text += `- **\u5065\u5EB7\u68C0\u67E5\u65F6\u95F4 / Check Time**: ${(/* @__PURE__ */ new Date()).toISOString()}
2919
- `;
2920
- text += `- **\u68C0\u67E5\u6A21\u5F0F / Check Mode**: ${includeWorkspaceCheck ? "Workspace + " : ""}${includeBrowserCheck ? "Browser" : ""}
2921
- `;
2824
+ ${error?.message || "Failed to connect to the server"}`;
2922
2825
  }
2923
2826
  return {
2924
2827
  content: [