viewgate-wrapper 1.10.26 → 1.10.28

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.
@@ -60,7 +60,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
60
60
  switch (request.params.name) {
61
61
  case "get_annotations": {
62
62
  try {
63
- const response = await fetch(`${BACKEND_URL}/api/annotations?full=true&status=pending`, {
63
+ const statuses = 'pending,bug_fixing';
64
+ const response = await fetch(`${BACKEND_URL}/api/annotations?full=true&status=${statuses}`, {
64
65
  headers: {
65
66
  'x-api-key': process.env.API_KEY || ''
66
67
  }
@@ -69,20 +70,41 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
69
70
  throw new Error(`Backend responded with ${response.status}`);
70
71
  }
71
72
  const data = await response.json();
72
- // Handle both direct array (legacy) and { data: [...] } (paginated) format
73
73
  const rawAnnotations = Array.isArray(data) ? data : (data?.data || []);
74
74
  if (!Array.isArray(rawAnnotations)) {
75
75
  return {
76
- content: [
77
- {
78
- type: "text",
79
- text: `Error: Backend returned invalid annotations format. Expected array but got: ${typeof rawAnnotations}`,
80
- },
81
- ],
82
- isError: true,
76
+ content: [{ type: "text", text: "Error: Invalid format" }],
77
+ isError: true
83
78
  };
84
79
  }
85
- const annotationsWithTips = rawAnnotations.map((ann) => {
80
+ const priorityMap = {
81
+ 'urgent': 4,
82
+ 'urgente': 4,
83
+ 'high': 3,
84
+ 'alta': 3,
85
+ 'medium': 2,
86
+ 'media': 2,
87
+ 'low': 1,
88
+ 'baja': 1
89
+ };
90
+ const sortedAnnotations = rawAnnotations.sort((a, b) => {
91
+ // 1. Primary Sort: Status (Pending > Bug Fixing)
92
+ const statusOrder = {
93
+ 'pending': 2,
94
+ 'bug_fixing': 1
95
+ };
96
+ const statusA = (a.status || 'pending').toLowerCase();
97
+ const statusB = (b.status || 'pending').toLowerCase();
98
+ if (statusOrder[statusA] !== statusOrder[statusB]) {
99
+ // Higher number = Higher priority
100
+ return (statusOrder[statusB] || 0) - (statusOrder[statusA] || 0);
101
+ }
102
+ // 2. Secondary Sort: Priority (Urgent > Alta > Media > Baja)
103
+ const prioA = priorityMap[(a.priority || 'medium').toLowerCase()] || 0;
104
+ const prioB = priorityMap[(b.priority || 'medium').toLowerCase()] || 0;
105
+ return prioB - prioA;
106
+ });
107
+ const annotationsWithTips = sortedAnnotations.map((ann) => {
86
108
  const source = ann.reference?.source;
87
109
  const hasSource = source && source !== 'unknown:0';
88
110
  const [file, line] = hasSource ? source.split(':') : [null, null];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-wrapper",
3
- "version": "1.10.26",
3
+ "version": "1.10.28",
4
4
  "type": "module",
5
5
  "main": "./dist/viewgate-wrapper.umd.cjs",
6
6
  "module": "./dist/viewgate-wrapper.js",
@@ -37,9 +37,10 @@
37
37
  "dependencies": {
38
38
  "@modelcontextprotocol/sdk": "^1.27.1",
39
39
  "html-to-image": "^1.11.13",
40
- "html2canvas": "^1.4.1",
40
+ "html2canvas-pro": "^2.0.2",
41
41
  "lucide-react": "^0.577.0",
42
- "node-fetch": "^2.7.0"
42
+ "node-fetch": "^2.7.0",
43
+ "swr": "^2.4.1"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@types/node": "^22.0.0",