@roxybrowser/openapi 1.0.13-beta.7 → 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
@@ -2142,23 +2142,29 @@ var ListBrowsers = class {
2142
2142
  const pageSize = params.pageSize ?? 15;
2143
2143
  const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
2144
2144
  const hasNextPage = currentPage < totalPages;
2145
- text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
2146
-
2147
- ${data.rows.map((browser) => {
2148
- const serialNo = `${browser.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${browser.windowSortNum}`;
2149
- return `**${browser.windowName || "Unnamed"}** (Serial No: ${serialNo})
2150
- - CoreVersion: ${browser.coreVersion} - DirId: ${browser.dirId}
2151
- - OSVersion: ${browser.osVersion}
2152
- - OS: ${browser.os}
2153
- - Remark: ${browser.windowRemark}`;
2154
- }).join("\n\n")}
2155
-
2156
- Pagination:
2157
- - currentPage: ${currentPage}
2158
- - pageSize: ${pageSize}
2159
- - totalPages: ${totalPages}
2160
- - hasNextPage: ${hasNextPage}
2161
- ${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");
2162
2168
  }
2163
2169
  return {
2164
2170
  content: [
@@ -2791,26 +2797,10 @@ ${ws.project_details.map(
2791
2797
  };
2792
2798
  var HealthCheck = class {
2793
2799
  name = "roxy_health_check";
2794
- 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.";
2795
2801
  inputSchema = {
2796
2802
  type: "object",
2797
- properties: {
2798
- includeWorkspaceCheck: {
2799
- type: "boolean",
2800
- description: "Include workspace connectivity tests (optional, default: true)",
2801
- default: true
2802
- },
2803
- includeBrowserCheck: {
2804
- type: "boolean",
2805
- description: "Include browser availability checks (optional, default: true)",
2806
- default: true
2807
- },
2808
- verbose: {
2809
- type: "boolean",
2810
- description: "Include detailed diagnostic information (optional, default: false)",
2811
- default: false
2812
- }
2813
- }
2803
+ properties: {}
2814
2804
  };
2815
2805
  get schema() {
2816
2806
  return {
@@ -2819,126 +2809,19 @@ var HealthCheck = class {
2819
2809
  inputSchema: this.inputSchema
2820
2810
  };
2821
2811
  }
2822
- async handle(params) {
2823
- const { includeWorkspaceCheck = true, includeBrowserCheck = true, verbose = false } = params || {};
2824
- let healthStatus = "unknown";
2825
- let healthError = "";
2812
+ async handle(_params) {
2813
+ let text = "";
2826
2814
  try {
2827
- const healthResult = await request("/health", {
2815
+ const result = await request("/health", {
2828
2816
  method: "GET"
2829
2817
  });
2830
- if (healthResult.code === 0 || healthResult.code === void 0) {
2831
- healthStatus = "healthy";
2832
- } else {
2833
- healthStatus = "unhealthy";
2834
- healthError = healthResult.msg || "Health check failed";
2835
- }
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"}`;
2836
2821
  } catch (error) {
2837
- healthStatus = "unhealthy";
2838
- healthError = error.message || "Failed to connect to server";
2839
- }
2840
- let text = `## \u{1F50D} \u5065\u5EB7\u68C0\u67E5\u62A5\u544A / Health Check Report
2822
+ text = `\u274C **Server is unavailable**
2841
2823
 
2842
- `;
2843
- text += `### \u{1F310} \u670D\u52A1\u5668\u72B6\u6001 / Server Status
2844
- `;
2845
- text += `- **\u670D\u52A1\u5668\u8FDE\u63A5 / Server Connection**: ${healthStatus === "healthy" ? "\u2705 \u6B63\u5E38" : "\u274C \u5F02\u5E38"}
2846
- `;
2847
- if (healthStatus !== "healthy" && healthError) {
2848
- text += `- **\u9519\u8BEF\u4FE1\u606F / Error**: ${healthError}
2849
- `;
2850
- }
2851
- if (includeWorkspaceCheck && healthStatus === "healthy") {
2852
- try {
2853
- const workspaceResult = await request("/browser/workspace?page_index=1&page_size=5", {
2854
- method: "GET"
2855
- });
2856
- if (workspaceResult.code === 0) {
2857
- const workspaces = workspaceResult.data;
2858
- text += `
2859
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2860
- `;
2861
- text += `- **\u53EF\u7528\u5DE5\u4F5C\u533A / Available Workspaces**: ${workspaces.total}
2862
- `;
2863
- if (workspaces.rows && workspaces.rows.length > 0) {
2864
- text += `- **\u5DE5\u4F5C\u533A\u8BE6\u60C5 / Workspace Details**:
2865
- `;
2866
- workspaces.rows.slice(0, 3).forEach((ws) => {
2867
- const projectCount = ws.project_details?.length || 0;
2868
- text += ` - ${ws.workspaceName} (ID: ${ws.id}) - ${projectCount} projects
2869
- `;
2870
- });
2871
- if (workspaces.total > 3) {
2872
- text += ` - ... and ${workspaces.total - 3} more
2873
- `;
2874
- }
2875
- }
2876
- } else {
2877
- text += `
2878
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2879
- `;
2880
- text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
2881
- `;
2882
- text += `- **\u9519\u8BEF**: ${workspaceResult.msg}
2883
- `;
2884
- }
2885
- } catch (error) {
2886
- text += `
2887
- ### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
2888
- `;
2889
- text += `- **\u72B6\u6001**: \u274C \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
2890
- `;
2891
- text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
2892
- `;
2893
- }
2894
- }
2895
- if (includeBrowserCheck && healthStatus === "healthy") {
2896
- try {
2897
- const workspaceResult = await request("/browser/workspace?page_index=1&page_size=1", {
2898
- method: "GET"
2899
- });
2900
- if (workspaceResult.code === 0 && workspaceResult.data.rows && workspaceResult.data.rows.length > 0) {
2901
- const firstWorkspace = workspaceResult.data.rows[0];
2902
- const browserResult = await request(`/browser/list_v3?workspaceId=${firstWorkspace.id}&page_index=1&page_size=5`, {
2903
- method: "GET"
2904
- });
2905
- if (browserResult.code === 0) {
2906
- const browsers = browserResult.data;
2907
- text += `
2908
- ### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
2909
- `;
2910
- text += `- **\u5DE5\u4F5C\u533A / Workspace**: ${firstWorkspace.workspaceName} (ID: ${firstWorkspace.id})
2911
- `;
2912
- text += `- **\u6D4F\u89C8\u5668\u603B\u6570 / Total Browsers**: ${browsers.total}
2913
- `;
2914
- if (browsers.rows && browsers.rows.length > 0) {
2915
- text += `- **\u6D4F\u89C8\u5668\u793A\u4F8B / Browser Examples**:
2916
- `;
2917
- browsers.rows.slice(0, 3).forEach((browser) => {
2918
- text += ` - ${browser.windowName || "Unnamed"} (ID: ${browser.dirId}) - ${browser.status}
2919
- `;
2920
- });
2921
- }
2922
- }
2923
- }
2924
- } catch (error) {
2925
- text += `
2926
- ### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
2927
- `;
2928
- text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u6D4F\u89C8\u5668\u4FE1\u606F
2929
- `;
2930
- text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
2931
- `;
2932
- }
2933
- }
2934
- if (verbose && healthStatus === "healthy") {
2935
- text += `
2936
- ### \u{1F4CA} \u8BE6\u7EC6\u4FE1\u606F / Detailed Information
2937
- `;
2938
- text += `- **\u5065\u5EB7\u68C0\u67E5\u65F6\u95F4 / Check Time**: ${(/* @__PURE__ */ new Date()).toISOString()}
2939
- `;
2940
- text += `- **\u68C0\u67E5\u6A21\u5F0F / Check Mode**: ${includeWorkspaceCheck ? "Workspace + " : ""}${includeBrowserCheck ? "Browser" : ""}
2941
- `;
2824
+ ${error?.message || "Failed to connect to the server"}`;
2942
2825
  }
2943
2826
  return {
2944
2827
  content: [