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