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