flowspec-mcp 4.1.0 → 4.2.1

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.
Files changed (67) hide show
  1. package/README.md +4 -159
  2. package/dist/db.d.ts +0 -26
  3. package/dist/db.js +396 -318
  4. package/dist/db.js.map +1 -1
  5. package/dist/index.js +0 -0
  6. package/dist/server.js +7 -26
  7. package/dist/server.js.map +1 -1
  8. package/dist/tools/createEdge.d.ts +4 -4
  9. package/dist/tools/createNode.d.ts +2 -2
  10. package/dist/tools/deleteEdge.js +4 -20
  11. package/dist/tools/deleteEdge.js.map +1 -1
  12. package/dist/tools/deleteNode.js +4 -20
  13. package/dist/tools/deleteNode.js.map +1 -1
  14. package/dist/tools/updateEdge.d.ts +2 -2
  15. package/dist/tools/updateEdge.js +3 -19
  16. package/dist/tools/updateEdge.js.map +1 -1
  17. package/dist/tools/updateNode.d.ts +2 -2
  18. package/dist/tools/updateNode.js +5 -21
  19. package/dist/tools/updateNode.js.map +1 -1
  20. package/dist/tools/updateProject.d.ts +2 -2
  21. package/dist/types.d.ts +0 -12
  22. package/package.json +2 -2
  23. package/dist/analysis/analysisUtils.d.ts +0 -36
  24. package/dist/analysis/analysisUtils.js +0 -284
  25. package/dist/analysis/analysisUtils.js.map +0 -1
  26. package/dist/export/jsonExporter.d.ts +0 -17
  27. package/dist/export/jsonExporter.js +0 -176
  28. package/dist/export/jsonExporter.js.map +0 -1
  29. package/dist/layout/semanticLayout.d.ts +0 -24
  30. package/dist/layout/semanticLayout.js +0 -233
  31. package/dist/layout/semanticLayout.js.map +0 -1
  32. package/dist/resources/selection.d.ts +0 -5
  33. package/dist/resources/selection.js +0 -88
  34. package/dist/resources/selection.js.map +0 -1
  35. package/dist/tools/captureScreen.d.ts +0 -48
  36. package/dist/tools/captureScreen.js +0 -135
  37. package/dist/tools/captureScreen.js.map +0 -1
  38. package/dist/tools/createSubview.d.ts +0 -50
  39. package/dist/tools/createSubview.js +0 -29
  40. package/dist/tools/createSubview.js.map +0 -1
  41. package/dist/tools/deleteSubview.d.ts +0 -24
  42. package/dist/tools/deleteSubview.js +0 -19
  43. package/dist/tools/deleteSubview.js.map +0 -1
  44. package/dist/tools/generateSpec.d.ts +0 -26
  45. package/dist/tools/generateSpec.js +0 -336
  46. package/dist/tools/generateSpec.js.map +0 -1
  47. package/dist/tools/getJson.d.ts +0 -21
  48. package/dist/tools/getJson.js +0 -24
  49. package/dist/tools/getJson.js.map +0 -1
  50. package/dist/tools/healthCheck.d.ts +0 -8
  51. package/dist/tools/healthCheck.js +0 -16
  52. package/dist/tools/healthCheck.js.map +0 -1
  53. package/dist/tools/ingestCodebase.d.ts +0 -27
  54. package/dist/tools/ingestCodebase.js +0 -516
  55. package/dist/tools/ingestCodebase.js.map +0 -1
  56. package/dist/tools/listSubviews.d.ts +0 -21
  57. package/dist/tools/listSubviews.js +0 -34
  58. package/dist/tools/listSubviews.js.map +0 -1
  59. package/dist/tools/smartLayout.d.ts +0 -30
  60. package/dist/tools/smartLayout.js +0 -74
  61. package/dist/tools/smartLayout.js.map +0 -1
  62. package/dist/tools/updateSubview.d.ts +0 -53
  63. package/dist/tools/updateSubview.js +0 -33
  64. package/dist/tools/updateSubview.js.map +0 -1
  65. package/dist/utils/selectionHelper.d.ts +0 -61
  66. package/dist/utils/selectionHelper.js +0 -111
  67. package/dist/utils/selectionHelper.js.map +0 -1
@@ -1,233 +0,0 @@
1
- import nlp from 'compromise';
2
- // ─── Layout Regions (9-grid system for infinite canvas) ─────────
3
- const LAYOUT_REGIONS = {
4
- 'top-left': { x: 0.05, y: 0.05 },
5
- 'top-center': { x: 0.4, y: 0.05 },
6
- 'top-right': { x: 0.7, y: 0.05 },
7
- 'center-left': { x: 0.05, y: 0.4 },
8
- 'center': { x: 0.4, y: 0.4 },
9
- 'center-right': { x: 0.7, y: 0.4 },
10
- 'bottom-left': { x: 0.05, y: 0.7 },
11
- 'bottom-center': { x: 0.4, y: 0.7 },
12
- 'bottom-right': { x: 0.7, y: 0.7 }
13
- };
14
- // Aliases for natural language
15
- const REGION_ALIASES = {
16
- 'top': 'top-center',
17
- 'bottom': 'bottom-center',
18
- 'left': 'center-left',
19
- 'right': 'center-right',
20
- 'upper-left': 'top-left',
21
- 'upper-right': 'top-right',
22
- 'lower-left': 'bottom-left',
23
- 'lower-right': 'bottom-right',
24
- 'middle': 'center'
25
- };
26
- // ─── Natural Language Parsing ────────────────────────────────────
27
- export function parseNaturalLanguageLayout(command, nodes, canvasBounds) {
28
- const doc = nlp(command.toLowerCase());
29
- // Extract action verb (move, arrange, cluster, position)
30
- const verbs = doc.verbs().out('array');
31
- const action = verbs[0] ?? 'move';
32
- // Extract target nodes (by label matching)
33
- const nodeMatches = extractNodeReferences(command, nodes);
34
- if (nodeMatches.length === 0) {
35
- return {
36
- error: `No matching nodes found. Command: "${command}". Try specifying node labels explicitly (e.g., "move user auth nodes to top-right").`
37
- };
38
- }
39
- // Extract target region
40
- const region = extractTargetRegion(command);
41
- if (!region) {
42
- return {
43
- error: `No target region found. Supported regions: ${Object.keys(LAYOUT_REGIONS).join(', ')}. Command: "${command}".`
44
- };
45
- }
46
- // Extract arrangement style (vertical, horizontal, grid, cluster)
47
- const arrangement = extractArrangement(command);
48
- const direction = extractDirection(command);
49
- // Convert region to absolute coordinates
50
- const relativePos = LAYOUT_REGIONS[region];
51
- const targetBounds = {
52
- x: relativePos.x * canvasBounds.width,
53
- y: relativePos.y * canvasBounds.height,
54
- width: canvasBounds.width * 0.25, // 25% of canvas for layout region
55
- height: canvasBounds.height * 0.25
56
- };
57
- return {
58
- nodeIds: nodeMatches,
59
- targetBounds,
60
- arrangement,
61
- direction
62
- };
63
- }
64
- function extractNodeReferences(command, nodes) {
65
- const matches = [];
66
- // Extract potential node label keywords (nouns, adjectives)
67
- const doc = nlp(command);
68
- const keywords = [
69
- ...doc.nouns().out('array'),
70
- ...doc.adjectives().out('array')
71
- ];
72
- // Match keywords against node labels (fuzzy matching)
73
- for (const node of nodes) {
74
- const label = (node.data?.label ?? '').toLowerCase();
75
- if (!label)
76
- continue;
77
- // Check if any keyword appears in label
78
- for (const keyword of keywords) {
79
- if (label.includes(keyword) || keyword.includes(label)) {
80
- matches.push(node.id);
81
- break;
82
- }
83
- }
84
- }
85
- return [...new Set(matches)]; // Deduplicate
86
- }
87
- function extractTargetRegion(command) {
88
- const lowerCommand = command.toLowerCase();
89
- // Check for explicit region names
90
- for (const [alias, canonical] of Object.entries(REGION_ALIASES)) {
91
- if (lowerCommand.includes(alias)) {
92
- return canonical;
93
- }
94
- }
95
- for (const region of Object.keys(LAYOUT_REGIONS)) {
96
- if (lowerCommand.includes(region)) {
97
- return region;
98
- }
99
- }
100
- // Pattern matching: "to the <direction>"
101
- if (lowerCommand.includes('to the top'))
102
- return 'top-center';
103
- if (lowerCommand.includes('to the bottom'))
104
- return 'bottom-center';
105
- if (lowerCommand.includes('to the left'))
106
- return 'center-left';
107
- if (lowerCommand.includes('to the right'))
108
- return 'center-right';
109
- // Pattern matching: "in the <region>"
110
- if (lowerCommand.includes('in the top left'))
111
- return 'top-left';
112
- if (lowerCommand.includes('in the top right'))
113
- return 'top-right';
114
- if (lowerCommand.includes('in the bottom left'))
115
- return 'bottom-left';
116
- if (lowerCommand.includes('in the bottom right'))
117
- return 'bottom-right';
118
- if (lowerCommand.includes('in the center'))
119
- return 'center';
120
- return null;
121
- }
122
- function extractArrangement(command) {
123
- const lowerCommand = command.toLowerCase();
124
- if (lowerCommand.includes('stack') || lowerCommand.includes('column') || lowerCommand.includes('row')) {
125
- return 'stack';
126
- }
127
- if (lowerCommand.includes('grid')) {
128
- return 'grid';
129
- }
130
- if (lowerCommand.includes('flow')) {
131
- return 'flow';
132
- }
133
- if (lowerCommand.includes('cluster') || lowerCommand.includes('group')) {
134
- return 'cluster';
135
- }
136
- // Default: stack for small groups, grid for larger
137
- return 'stack';
138
- }
139
- function extractDirection(command) {
140
- const lowerCommand = command.toLowerCase();
141
- if (lowerCommand.includes('vertical') || lowerCommand.includes('vertically') || lowerCommand.includes('column')) {
142
- return 'vertical';
143
- }
144
- if (lowerCommand.includes('horizontal') || lowerCommand.includes('horizontally') || lowerCommand.includes('row')) {
145
- return 'horizontal';
146
- }
147
- return undefined; // Let arrangement logic decide
148
- }
149
- // ─── Apply Semantic Layout ───────────────────────────────────────
150
- export function applySemanticLayout(nodes, edges, command) {
151
- const positions = new Map();
152
- const targetNodes = nodes.filter((n) => command.nodeIds.includes(n.id));
153
- if (targetNodes.length === 0)
154
- return positions;
155
- const { targetBounds, arrangement, direction } = command;
156
- switch (arrangement) {
157
- case 'stack': {
158
- // Stack vertically or horizontally
159
- const isVertical = direction === 'vertical' || direction === undefined;
160
- const spacing = 60;
161
- targetNodes.forEach((node, index) => {
162
- if (isVertical) {
163
- positions.set(node.id, {
164
- x: targetBounds.x,
165
- y: targetBounds.y + index * spacing
166
- });
167
- }
168
- else {
169
- positions.set(node.id, {
170
- x: targetBounds.x + index * spacing,
171
- y: targetBounds.y
172
- });
173
- }
174
- });
175
- break;
176
- }
177
- case 'grid': {
178
- // Arrange in a grid (3 columns max)
179
- const cols = Math.min(3, Math.ceil(Math.sqrt(targetNodes.length)));
180
- const spacing = 80;
181
- targetNodes.forEach((node, index) => {
182
- const col = index % cols;
183
- const row = Math.floor(index / cols);
184
- positions.set(node.id, {
185
- x: targetBounds.x + col * spacing,
186
- y: targetBounds.y + row * spacing
187
- });
188
- });
189
- break;
190
- }
191
- case 'flow': {
192
- // Flow layout (left-to-right, wrapping)
193
- const maxWidth = targetBounds.width;
194
- const spacing = 70;
195
- let currentX = targetBounds.x;
196
- let currentY = targetBounds.y;
197
- for (const node of targetNodes) {
198
- positions.set(node.id, { x: currentX, y: currentY });
199
- currentX += spacing;
200
- if (currentX - targetBounds.x > maxWidth) {
201
- currentX = targetBounds.x;
202
- currentY += spacing;
203
- }
204
- }
205
- break;
206
- }
207
- case 'cluster': {
208
- // Cluster in a compact circle/ellipse
209
- const centerX = targetBounds.x + targetBounds.width / 2;
210
- const centerY = targetBounds.y + targetBounds.height / 2;
211
- const radius = Math.min(targetBounds.width, targetBounds.height) / 3;
212
- targetNodes.forEach((node, index) => {
213
- const angle = (index / targetNodes.length) * 2 * Math.PI;
214
- positions.set(node.id, {
215
- x: centerX + radius * Math.cos(angle),
216
- y: centerY + radius * Math.sin(angle)
217
- });
218
- });
219
- break;
220
- }
221
- }
222
- return positions;
223
- }
224
- // ─── Supported Commands (for tool description) ───────────────────
225
- export const SUPPORTED_COMMANDS = [
226
- 'move <nodes> to <region>',
227
- 'arrange <nodes> vertically/horizontally in <region>',
228
- 'cluster <nodes> in <region>',
229
- 'position <nodes> at <region>',
230
- 'stack <nodes> in <region>'
231
- ];
232
- export const SUPPORTED_REGIONS = Object.keys(LAYOUT_REGIONS);
233
- //# sourceMappingURL=semanticLayout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semanticLayout.js","sourceRoot":"","sources":["../../src/layout/semanticLayout.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAY7B,mEAAmE;AAEnE,MAAM,cAAc,GAA6C;IAChE,UAAU,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;IAChC,YAAY,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACjC,WAAW,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IAChC,aAAa,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE;IAClC,QAAQ,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;IAC5B,cAAc,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;IAClC,aAAa,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE;IAClC,eAAe,EAAE,EAAE,CAAC,EAAE,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owspec://selection/current
4
- */
5
- export declare const handleReadSelection: ReadResourceCallback;
@@ -1,88 +0,0 @@
1
- import { MODE, LOCAL_API_BASE, getLocalAuthToken } from '../config.js';
2
- /**
3
- * Fetch current selection state from desktop server
4
- */
5
- async function fetchLocalSelection() {
6
- if (MODE !== 'local') {
7
- throw new Error('Selection resource only available in local mode');
8
- }
9
- const token = getLocalAuthToken();
10
- const headers = {
11
- 'Content-Type': 'application/json',
12
- };
13
- if (token) {
14
- headers['Authorization'] = `Bearer ${token}`;
15
- }
16
- const res = await fetch(`${LOCAL_API_BASE}/api/selection/current`, {
17
- headers,
18
- signal: AbortSignal.timeout(2000)
19
- });
20
- if (!res.ok) {
21
- throw new Error(`Failed to fetch selection: ${res.status} ${res.statusText}`);
22
- }
23
- return res.json();
24
- }
25
- /**
26
- * MCP Resource handler for flowspec://selection/current
27
- */
28
- export const handleReadSelection = async (uri, extra) => {
29
- try {
30
- const selection = await fetchLocalSelection();
31
- // Format for better readability
32
- let text = '';
33
- if (selection.type === 'none' || (!selection.selectedNodes?.length && !selection.selectedEdges?.length)) {
34
- text = 'No nodes or edges currently selected in FlowSpec editor.';
35
- if (selection.stale) {
36
- text += '\n\n_Note: Selection state is stale (>60s old). Make sure the FlowSpec desktop app is open._';
37
- }
38
- }
39
- else {
40
- text = `## FlowSpec Selection State\n\n`;
41
- text += `**Project:** ${selection.projectName || 'Unknown'} (${selection.projectId || 'N/A'})\n`;
42
- text += `**Updated:** ${selection.timestamp}\n\n`;
43
- if (selection.selectedNodes?.length > 0) {
44
- text += `### Selected Nodes (${selection.selectedNodes.length})\n\n`;
45
- for (const node of selection.selectedNodes) {
46
- text += `- **${node.label}** (${node.type})\n`;
47
- text += ` - ID: \`${node.id}\`\n`;
48
- text += ` - Position: (${node.position.x.toFixed(0)}, ${node.position.y.toFixed(0)})\n`;
49
- text += ` - Data: \`${JSON.stringify(node.data)}\`\n\n`;
50
- }
51
- }
52
- if (selection.selectedEdges?.length > 0) {
53
- text += `### Selected Edges (${selection.selectedEdges.length})\n\n`;
54
- for (const edge of selection.selectedEdges) {
55
- text += `- **${edge.edgeType}**: \`${edge.source}\` → \`${edge.target}\`\n`;
56
- text += ` - ID: \`${edge.id}\`\n`;
57
- if (edge.sourceHandle)
58
- text += ` - Source Handle: ${edge.sourceHandle}\n`;
59
- if (edge.targetHandle)
60
- text += ` - Target Handle: ${edge.targetHandle}\n`;
61
- text += `\n`;
62
- }
63
- }
64
- if (selection.viewport) {
65
- text += `### Viewport\n\n`;
66
- text += `- Position: (${selection.viewport.x.toFixed(1)}, ${selection.viewport.y.toFixed(1)})\n`;
67
- text += `- Zoom: ${(selection.viewport.zoom * 100).toFixed(0)}%\n`;
68
- }
69
- }
70
- return {
71
- contents: [{
72
- uri: uri.toString(),
73
- mimeType: 'text/markdown',
74
- text
75
- }]
76
- };
77
- }
78
- catch (err) {
79
- return {
80
- contents: [{
81
- uri: uri.toString(),
82
- mimeType: 'text/plain',
83
- text: `Error reading selection state: ${err instanceof Error ? err.message : String(err)}\n\nMake sure the FlowSpec desktop app is running.`
84
- }]
85
- };
86
- }
87
- };
88
- //# sourceMappingURL=selection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/resources/selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEvE;;GAEG;AACH,KAAK,UAAU,mBAAmB;IACjC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,OAAO,GAA2B;QACvC,cAAc,EAAE,kBAAkB;KAClC,CAAC;IACF,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,G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AC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;gBACjG,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;YACpE,CAAC;QACF,CAAC;QAED,OAAO;YACN,QAAQ,EAAE,CAAC;oBACV,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;oBACnB,QAAQ,EAAE,eAAe;oBACzB,IAAI;iBACJ,CAAC;SACF,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO;YACN,QAAQ,EAAE,CAAC;oBACV,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;oBACnB,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,kCAAkC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oDAAoD;iBAC5I,CAAC;SACF,CAAC;IACH,CAAC;AACF,CAAC,CAAC"}
@@ -1,48 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const captureScreenSchema: z.ZodObject<{
3
- url: z.ZodString;
4
- selector: z.ZodOptional<z.ZodString>;
5
- viewport: z.ZodOptional<z.ZodObject<{
6
- width: z.ZodNumber;
7
- height: z.ZodNumber;
8
- }, "strip", z.ZodTypeAny, {
9
- width: number;
10
- height: number;
11
- }, {
12
- width: number;
13
- height: number;
14
- }>>;
15
- waitFor: z.ZodOptional<z.ZodString>;
16
- fullPage: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
17
- }, "strip", z.ZodTypeAny, {
18
- url: string;
19
- fullPage: boolean;
20
- selector?: string | undefined;
21
- viewport?: {
22
- width: number;
23
- height: number;
24
- } | undefined;
25
- waitFor?: string | undefined;
26
- }, {
27
- url: string;
28
- selector?: string | undefined;
29
- viewport?: {
30
- width: number;
31
- height: number;
32
- } | undefined;
33
- waitFor?: string | undefined;
34
- fullPage?: boolean | undefined;
35
- }>;
36
- export declare function handleCaptureScreen(args: z.infer<typeof captureScreenSchema>): Promise<{
37
- content: {
38
- type: "text";
39
- text: string;
40
- }[];
41
- isError: boolean;
42
- } | {
43
- content: {
44
- type: "text";
45
- text: string;
46
- }[];
47
- isError?: undefined;
48
- }>;
@@ -1,135 +0,0 @@
1
- import { z } from 'zod';
2
- import { uploadImageViaApi } from '../db.js';
3
- import { detectImageDimensions } from '../image/dimensions.js';
4
- export const captureScreenSchema = z.object({
5
- url: z.string().describe('URL to screenshot (http:// or https://)'),
6
- selector: z.string().optional().describe('CSS selector for specific element (full page if omitted)'),
7
- viewport: z
8
- .object({
9
- width: z.number(),
10
- height: z.number()
11
- })
12
- .optional()
13
- .describe('Viewport size (default: 1920x1080)'),
14
- waitFor: z
15
- .string()
16
- .optional()
17
- .describe('CSS selector to wait for before screenshot, or timeout in ms (e.g., "3000")'),
18
- fullPage: z.boolean().optional().default(false).describe('Capture full page height (default: false)')
19
- });
20
- export async function handleCaptureScreen(args) {
21
- // Validate URL
22
- if (!args.url.startsWith('http://') && !args.url.startsWith('https://')) {
23
- return {
24
- content: [{ type: 'text', text: `Invalid URL. Must start with http:// or https://` }],
25
- isError: true
26
- };
27
- }
28
- let browser;
29
- try {
30
- // Dynamically import playwright (cloud-only dependency)
31
- const { chromium } = await import('playwright');
32
- // Launch browser
33
- browser = await chromium.launch({ headless: true });
34
- const context = await browser.newContext({
35
- viewport: args.viewport ?? { width: 1920, height: 1080 }
36
- });
37
- const page = await context.newPage();
38
- // Navigate to URL
39
- await page.goto(args.url, { waitUntil: 'networkidle' });
40
- // Wait for selector or timeout if specified
41
- if (args.waitFor) {
42
- const timeoutMs = parseInt(args.waitFor, 10);
43
- if (!isNaN(timeoutMs)) {
44
- // Wait for timeout
45
- await page.waitForTimeout(timeoutMs);
46
- }
47
- else {
48
- // Wait for selector
49
- try {
50
- await page.waitForSelector(args.waitFor, { timeout: 10000 });
51
- }
52
- catch (e) {
53
- return {
54
- content: [
55
- {
56
- type: 'text',
57
- text: `Selector "${args.waitFor}" not found within 10s. Screenshot may be incomplete.`
58
- }
59
- ],
60
- isError: true
61
- };
62
- }
63
- }
64
- }
65
- // Take screenshot
66
- let screenshotBuffer;
67
- if (args.selector) {
68
- // Screenshot specific element
69
- const element = await page.$(args.selector);
70
- if (!element) {
71
- return {
72
- content: [
73
- {
74
- type: 'text',
75
- text: `Element not found: ${args.selector}`
76
- }
77
- ],
78
- isError: true
79
- };
80
- }
81
- screenshotBuffer = await element.screenshot({ type: 'png' });
82
- }
83
- else {
84
- // Screenshot full page or viewport
85
- screenshotBuffer = await page.screenshot({
86
- type: 'png',
87
- fullPage: args.fullPage
88
- });
89
- }
90
- await browser.close();
91
- // Detect dimensions from screenshot
92
- const detected = detectImageDimensions(new Uint8Array(screenshotBuffer));
93
- const width = detected?.width ?? args.viewport?.width ?? 1920;
94
- const height = detected?.height ?? args.viewport?.height ?? 1080;
95
- // Upload to Vercel Blob (via API)
96
- const base64Data = screenshotBuffer.toString('base64');
97
- const filename = `screenshot_${Date.now()}.png`;
98
- const result = await uploadImageViaApi(base64Data, filename, 'image/png');
99
- if (!result) {
100
- return {
101
- content: [
102
- {
103
- type: 'text',
104
- text: `Failed to upload screenshot. In cloud mode, image upload is not yet supported.`
105
- }
106
- ],
107
- isError: true
108
- };
109
- }
110
- // Return result in same format as uploadImage
111
- return {
112
- content: [
113
- {
114
- type: 'text',
115
- text: JSON.stringify({ url: result.url, width, height, filename }, null, 2)
116
- }
117
- ]
118
- };
119
- }
120
- catch (error) {
121
- if (browser) {
122
- await browser.close();
123
- }
124
- return {
125
- content: [
126
- {
127
- type: 'text',
128
- text: `Screenshot capture failed: ${error.message}`
129
- }
130
- ],
131
- isError: true
132
- };
133
- }
134
- }
135
- //# sourceMappingURL=captureScreen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"captureScreen.js","sourceRoot":"","sources":["../../src/tools/captureScreen.ts"],"names":[],"mappings":"AAAA,OAA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AAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,gFAAgF;qBACtF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC3E;aACD;SACD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QAED,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA+B,KAAe,CAAC,OAAO,EAAE;iBAC9D;aACD;YACD,OAAO,EAAE,IAAI;SACb,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -1,50 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const createSubviewSchema: z.ZodObject<{
3
- projectId: z.ZodString;
4
- name: z.ZodString;
5
- description: z.ZodOptional<z.ZodString>;
6
- nodePositions: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
- nodeId: z.ZodString;
8
- x: z.ZodNumber;
9
- y: z.ZodNumber;
10
- }, "strip", z.ZodTypeAny, {
11
- x: number;
12
- y: number;
13
- nodeId: string;
14
- }, {
15
- x: number;
16
- y: number;
17
- nodeId: string;
18
- }>, "many">>;
19
- }, "strip", z.ZodTypeAny, {
20
- name: string;
21
- projectId: string;
22
- description?: string | undefined;
23
- nodePositions?: {
24
- x: number;
25
- y: number;
26
- nodeId: string;
27
- }[] | undefined;
28
- }, {
29
- name: string;
30
- projectId: string;
31
- description?: string | undefined;
32
- nodePositions?: {
33
- x: number;
34
- y: number;
35
- nodeId: string;
36
- }[] | undefined;
37
- }>;
38
- export declare function handleCreateSubview(args: z.infer<typeof createSubviewSchema>): Promise<{
39
- content: {
40
- type: "text";
41
- text: string;
42
- }[];
43
- isError: boolean;
44
- } | {
45
- content: {
46
- type: "text";
47
- text: string;
48
- }[];
49
- isError?: undefined;
50
- }>;
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubviewViaApi } from '../db.js';
3
- export const createSubviewSchema = z.object({
4
- projectId: z.string().describe('UUID of the project'),
5
- name: z.string().describe('Subview name'),
6
- description: z.string().optional().describe('Optional subview description'),
7
- nodePositions: z.array(z.object({
8
- nodeId: z.string().describe('Node ID from the main canvas'),
9
- x: z.number().describe('X position in subview canvas'),
10
- y: z.number().describe('Y position in subview canvas'),
11
- })).optional().describe('Initial nodes and their positions in the subview'),
12
- });
13
- export async function handleCreateSubview(args) {
14
- const subview = await createSubviewViaApi(args.projectId, args.name, args.description, args.nodePositions ?? []);
15
- if (!subview) {
16
- return {
17
- content: [{ type: 'text', text: `Failed to create subview — project not found: ${args.projectId}` }],
18
- isError: true,
19
- };
20
- }
21
- const nodeCount = args.nodePositions?.length ?? 0;
22
- return {
23
- content: [{
24
- type: 'text',
25
- text: `Created subview **${args.name}** (id: ${subview.id}) with ${nodeCount} node${nodeCount === 1 ? '' : 's'}`,
26
- }],
27
- };
28
- }
29
- //# sourceMappingURL=createSubview.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createSubview.js","sourceRoot":"","sources":["../../src/tools/createSubview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACrD,IAAI,EAAE,CAA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EAAE;aACjH,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -1,24 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const deleteSubviewSchema: z.ZodObject<{
3
- projectId: z.ZodString;
4
- subviewId: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- projectId: string;
7
- subviewId: string;
8
- }, {
9
- projectId: string;
10
- subviewId: string;
11
- }>;
12
- export declare function handleDeleteSubview(args: z.infer<typeof deleteSubviewSchema>): Promise<{
13
- content: {
14
- type: "text";
15
- text: string;
16
- }[];
17
- isError: boolean;
18
- } | {
19
- content: {
20
- type: "text";
21
- text: string;
22
- }[];
23
- isError?: undefined;
24
- }>;