@alisaitteke/photoshop-mcp 0.1.0

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 (115) hide show
  1. package/.prettierrc +9 -0
  2. package/README.md +1300 -0
  3. package/dist/api/batch-play.d.ts +62 -0
  4. package/dist/api/batch-play.d.ts.map +1 -0
  5. package/dist/api/batch-play.js +131 -0
  6. package/dist/api/batch-play.js.map +1 -0
  7. package/dist/api/extendscript.d.ts +258 -0
  8. package/dist/api/extendscript.d.ts.map +1 -0
  9. package/dist/api/extendscript.js +1437 -0
  10. package/dist/api/extendscript.js.map +1 -0
  11. package/dist/api/photoshop-api.d.ts +20 -0
  12. package/dist/api/photoshop-api.d.ts.map +1 -0
  13. package/dist/api/photoshop-api.js +88 -0
  14. package/dist/api/photoshop-api.js.map +1 -0
  15. package/dist/core/server.d.ts +14 -0
  16. package/dist/core/server.d.ts.map +1 -0
  17. package/dist/core/server.js +191 -0
  18. package/dist/core/server.js.map +1 -0
  19. package/dist/core/session.d.ts +24 -0
  20. package/dist/core/session.d.ts.map +1 -0
  21. package/dist/core/session.js +83 -0
  22. package/dist/core/session.js.map +1 -0
  23. package/dist/core/tool-registry.d.ts +23 -0
  24. package/dist/core/tool-registry.d.ts.map +1 -0
  25. package/dist/core/tool-registry.js +55 -0
  26. package/dist/core/tool-registry.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +18 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/platform/connection.d.ts +20 -0
  32. package/dist/platform/connection.d.ts.map +1 -0
  33. package/dist/platform/connection.js +94 -0
  34. package/dist/platform/connection.js.map +1 -0
  35. package/dist/platform/detector.d.ts +19 -0
  36. package/dist/platform/detector.d.ts.map +1 -0
  37. package/dist/platform/detector.js +63 -0
  38. package/dist/platform/detector.js.map +1 -0
  39. package/dist/platform/macos-detector.d.ts +13 -0
  40. package/dist/platform/macos-detector.d.ts.map +1 -0
  41. package/dist/platform/macos-detector.js +145 -0
  42. package/dist/platform/macos-detector.js.map +1 -0
  43. package/dist/platform/macos-executor.d.ts +22 -0
  44. package/dist/platform/macos-executor.d.ts.map +1 -0
  45. package/dist/platform/macos-executor.js +161 -0
  46. package/dist/platform/macos-executor.js.map +1 -0
  47. package/dist/platform/script-executor.d.ts +23 -0
  48. package/dist/platform/script-executor.d.ts.map +1 -0
  49. package/dist/platform/script-executor.js +2 -0
  50. package/dist/platform/script-executor.js.map +1 -0
  51. package/dist/platform/windows-detector.d.ts +14 -0
  52. package/dist/platform/windows-detector.d.ts.map +1 -0
  53. package/dist/platform/windows-detector.js +173 -0
  54. package/dist/platform/windows-detector.js.map +1 -0
  55. package/dist/platform/windows-executor.d.ts +15 -0
  56. package/dist/platform/windows-executor.d.ts.map +1 -0
  57. package/dist/platform/windows-executor.js +148 -0
  58. package/dist/platform/windows-executor.js.map +1 -0
  59. package/dist/tools/action-tools.d.ts +4 -0
  60. package/dist/tools/action-tools.d.ts.map +1 -0
  61. package/dist/tools/action-tools.js +102 -0
  62. package/dist/tools/action-tools.js.map +1 -0
  63. package/dist/tools/adjustment-tools.d.ts +4 -0
  64. package/dist/tools/adjustment-tools.d.ts.map +1 -0
  65. package/dist/tools/adjustment-tools.js +274 -0
  66. package/dist/tools/adjustment-tools.js.map +1 -0
  67. package/dist/tools/document-tools.d.ts +4 -0
  68. package/dist/tools/document-tools.d.ts.map +1 -0
  69. package/dist/tools/document-tools.js +230 -0
  70. package/dist/tools/document-tools.js.map +1 -0
  71. package/dist/tools/filter-tools.d.ts +4 -0
  72. package/dist/tools/filter-tools.d.ts.map +1 -0
  73. package/dist/tools/filter-tools.js +230 -0
  74. package/dist/tools/filter-tools.js.map +1 -0
  75. package/dist/tools/history-tools.d.ts +4 -0
  76. package/dist/tools/history-tools.d.ts.map +1 -0
  77. package/dist/tools/history-tools.js +137 -0
  78. package/dist/tools/history-tools.js.map +1 -0
  79. package/dist/tools/image-placement-tools.d.ts +4 -0
  80. package/dist/tools/image-placement-tools.d.ts.map +1 -0
  81. package/dist/tools/image-placement-tools.js +109 -0
  82. package/dist/tools/image-placement-tools.js.map +1 -0
  83. package/dist/tools/image-tools.d.ts +4 -0
  84. package/dist/tools/image-tools.d.ts.map +1 -0
  85. package/dist/tools/image-tools.js +123 -0
  86. package/dist/tools/image-tools.js.map +1 -0
  87. package/dist/tools/layer-ordering-tools.d.ts +4 -0
  88. package/dist/tools/layer-ordering-tools.d.ts.map +1 -0
  89. package/dist/tools/layer-ordering-tools.js +210 -0
  90. package/dist/tools/layer-ordering-tools.js.map +1 -0
  91. package/dist/tools/layer-properties-tools.d.ts +4 -0
  92. package/dist/tools/layer-properties-tools.d.ts.map +1 -0
  93. package/dist/tools/layer-properties-tools.js +421 -0
  94. package/dist/tools/layer-properties-tools.js.map +1 -0
  95. package/dist/tools/layer-tools.d.ts +4 -0
  96. package/dist/tools/layer-tools.d.ts.map +1 -0
  97. package/dist/tools/layer-tools.js +251 -0
  98. package/dist/tools/layer-tools.js.map +1 -0
  99. package/dist/tools/layer-transform-tools.d.ts +4 -0
  100. package/dist/tools/layer-transform-tools.d.ts.map +1 -0
  101. package/dist/tools/layer-transform-tools.js +199 -0
  102. package/dist/tools/layer-transform-tools.js.map +1 -0
  103. package/dist/tools/selection-tools.d.ts +4 -0
  104. package/dist/tools/selection-tools.d.ts.map +1 -0
  105. package/dist/tools/selection-tools.js +295 -0
  106. package/dist/tools/selection-tools.js.map +1 -0
  107. package/dist/tools/text-tools.d.ts +4 -0
  108. package/dist/tools/text-tools.d.ts.map +1 -0
  109. package/dist/tools/text-tools.js +210 -0
  110. package/dist/tools/text-tools.js.map +1 -0
  111. package/dist/utils/logger.d.ts +17 -0
  112. package/dist/utils/logger.d.ts.map +1 -0
  113. package/dist/utils/logger.js +43 -0
  114. package/dist/utils/logger.js.map +1 -0
  115. package/package.json +47 -0
@@ -0,0 +1,251 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createLayerTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_create_layer',
8
+ description: 'Create a new layer in the active document',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ name: {
13
+ type: 'string',
14
+ description: 'Name for the new layer (optional)',
15
+ },
16
+ },
17
+ },
18
+ },
19
+ handler: async (args) => createLayer(connection, args),
20
+ },
21
+ {
22
+ tool: {
23
+ name: 'photoshop_delete_layer',
24
+ description: 'Delete the active layer',
25
+ inputSchema: {
26
+ type: 'object',
27
+ properties: {},
28
+ },
29
+ },
30
+ handler: async () => deleteLayer(connection),
31
+ },
32
+ {
33
+ tool: {
34
+ name: 'photoshop_create_text_layer',
35
+ description: 'Create a text layer with specified content',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ text: {
40
+ type: 'string',
41
+ description: 'Text content',
42
+ },
43
+ x: {
44
+ type: 'number',
45
+ description: 'X position in pixels (default: 100)',
46
+ default: 100,
47
+ },
48
+ y: {
49
+ type: 'number',
50
+ description: 'Y position in pixels (default: 100)',
51
+ default: 100,
52
+ },
53
+ fontSize: {
54
+ type: 'number',
55
+ description: 'Font size in points (default: 24)',
56
+ default: 24,
57
+ },
58
+ },
59
+ required: ['text'],
60
+ },
61
+ },
62
+ handler: async (args) => createTextLayer(connection, args),
63
+ },
64
+ {
65
+ tool: {
66
+ name: 'photoshop_fill_layer',
67
+ description: 'Fill the active layer with a color',
68
+ inputSchema: {
69
+ type: 'object',
70
+ properties: {
71
+ red: {
72
+ type: 'number',
73
+ description: 'Red component (0-255)',
74
+ minimum: 0,
75
+ maximum: 255,
76
+ },
77
+ green: {
78
+ type: 'number',
79
+ description: 'Green component (0-255)',
80
+ minimum: 0,
81
+ maximum: 255,
82
+ },
83
+ blue: {
84
+ type: 'number',
85
+ description: 'Blue component (0-255)',
86
+ minimum: 0,
87
+ maximum: 255,
88
+ },
89
+ },
90
+ required: ['red', 'green', 'blue'],
91
+ },
92
+ },
93
+ handler: async (args) => fillLayer(connection, args),
94
+ },
95
+ {
96
+ tool: {
97
+ name: 'photoshop_get_layers',
98
+ description: 'Get list of all layers in the active document',
99
+ inputSchema: {
100
+ type: 'object',
101
+ properties: {},
102
+ },
103
+ },
104
+ handler: async () => getLayers(connection),
105
+ },
106
+ ];
107
+ }
108
+ async function createLayer(connection, args) {
109
+ const name = args.name;
110
+ try {
111
+ const apiFactory = new PhotoshopAPIFactory(connection);
112
+ const api = await apiFactory.createAPI();
113
+ const script = ExtendScriptSnippets.newLayer(name);
114
+ await api.executeScript(script);
115
+ return {
116
+ content: [
117
+ {
118
+ type: 'text',
119
+ text: `Layer created${name ? `: ${name}` : ''}`,
120
+ },
121
+ ],
122
+ };
123
+ }
124
+ catch (error) {
125
+ return {
126
+ content: [
127
+ {
128
+ type: 'text',
129
+ text: `Error creating layer: ${error instanceof Error ? error.message : String(error)}`,
130
+ },
131
+ ],
132
+ isError: true,
133
+ };
134
+ }
135
+ }
136
+ async function deleteLayer(connection) {
137
+ try {
138
+ const apiFactory = new PhotoshopAPIFactory(connection);
139
+ const api = await apiFactory.createAPI();
140
+ const script = ExtendScriptSnippets.deleteLayer();
141
+ await api.executeScript(script);
142
+ return {
143
+ content: [
144
+ {
145
+ type: 'text',
146
+ text: 'Layer deleted successfully',
147
+ },
148
+ ],
149
+ };
150
+ }
151
+ catch (error) {
152
+ return {
153
+ content: [
154
+ {
155
+ type: 'text',
156
+ text: `Error deleting layer: ${error instanceof Error ? error.message : String(error)}`,
157
+ },
158
+ ],
159
+ isError: true,
160
+ };
161
+ }
162
+ }
163
+ async function createTextLayer(connection, args) {
164
+ const text = args.text;
165
+ const x = args.x || 100;
166
+ const y = args.y || 100;
167
+ const fontSize = args.fontSize || 24;
168
+ try {
169
+ const apiFactory = new PhotoshopAPIFactory(connection);
170
+ const api = await apiFactory.createAPI();
171
+ const script = ExtendScriptSnippets.createTextLayer(text, x, y, fontSize);
172
+ await api.executeScript(script);
173
+ return {
174
+ content: [
175
+ {
176
+ type: 'text',
177
+ text: `Text layer created: "${text}" at (${x}, ${y})`,
178
+ },
179
+ ],
180
+ };
181
+ }
182
+ catch (error) {
183
+ return {
184
+ content: [
185
+ {
186
+ type: 'text',
187
+ text: `Error creating text layer: ${error instanceof Error ? error.message : String(error)}`,
188
+ },
189
+ ],
190
+ isError: true,
191
+ };
192
+ }
193
+ }
194
+ async function fillLayer(connection, args) {
195
+ const red = args.red;
196
+ const green = args.green;
197
+ const blue = args.blue;
198
+ try {
199
+ const apiFactory = new PhotoshopAPIFactory(connection);
200
+ const api = await apiFactory.createAPI();
201
+ const script = ExtendScriptSnippets.fillLayer(red, green, blue);
202
+ await api.executeScript(script);
203
+ return {
204
+ content: [
205
+ {
206
+ type: 'text',
207
+ text: `Layer filled with RGB(${red}, ${green}, ${blue})`,
208
+ },
209
+ ],
210
+ };
211
+ }
212
+ catch (error) {
213
+ return {
214
+ content: [
215
+ {
216
+ type: 'text',
217
+ text: `Error filling layer: ${error instanceof Error ? error.message : String(error)}`,
218
+ },
219
+ ],
220
+ isError: true,
221
+ };
222
+ }
223
+ }
224
+ async function getLayers(connection) {
225
+ try {
226
+ const apiFactory = new PhotoshopAPIFactory(connection);
227
+ const api = await apiFactory.createAPI();
228
+ const script = ExtendScriptSnippets.getLayerNames();
229
+ const result = await api.executeScript(script);
230
+ return {
231
+ content: [
232
+ {
233
+ type: 'text',
234
+ text: `Layers:\n${JSON.stringify(result, null, 2)}`,
235
+ },
236
+ ],
237
+ };
238
+ }
239
+ catch (error) {
240
+ return {
241
+ content: [
242
+ {
243
+ type: 'text',
244
+ text: `Error getting layers: ${error instanceof Error ? error.message : String(error)}`,
245
+ },
246
+ ],
247
+ isError: true,
248
+ };
249
+ }
250
+ }
251
+ //# sourceMappingURL=layer-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-tools.js","sourceRoot":"","sources":["../../src/tools/layer-tools.ts"],"names":[],"mapp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QAE/C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;iBACpD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACxF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createLayerTransformTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=layer-transform-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-transform-tools.d.ts","sourceRoot":"","sources":["../../src/tools/layer-transform-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAmF3F"}
@@ -0,0 +1,199 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createLayerTransformTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_fit_layer_to_document',
8
+ description: 'Scale the active layer to fit the document canvas while maintaining aspect ratio',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ fillDocument: {
13
+ type: 'boolean',
14
+ description: 'If true, fills entire canvas (may crop). If false, fits within canvas (may have margins). Default: false',
15
+ default: false,
16
+ },
17
+ },
18
+ },
19
+ },
20
+ handler: async (args) => fitLayerToDocument(connection, args),
21
+ },
22
+ {
23
+ tool: {
24
+ name: 'photoshop_scale_layer',
25
+ description: 'Scale the active layer by a percentage',
26
+ inputSchema: {
27
+ type: 'object',
28
+ properties: {
29
+ scalePercent: {
30
+ type: 'number',
31
+ description: 'Scale percentage (e.g., 50 for 50%, 200 for 200%)',
32
+ minimum: 1,
33
+ },
34
+ centerAnchor: {
35
+ type: 'boolean',
36
+ description: 'Scale from center (true) or top-left (false). Default: true',
37
+ default: true,
38
+ },
39
+ },
40
+ required: ['scalePercent'],
41
+ },
42
+ },
43
+ handler: async (args) => scaleLayer(connection, args),
44
+ },
45
+ {
46
+ tool: {
47
+ name: 'photoshop_move_layer',
48
+ description: 'Move the active layer by specified offset',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {
52
+ deltaX: {
53
+ type: 'number',
54
+ description: 'Horizontal offset in pixels (can be negative)',
55
+ },
56
+ deltaY: {
57
+ type: 'number',
58
+ description: 'Vertical offset in pixels (can be negative)',
59
+ },
60
+ },
61
+ required: ['deltaX', 'deltaY'],
62
+ },
63
+ },
64
+ handler: async (args) => moveLayer(connection, args),
65
+ },
66
+ {
67
+ tool: {
68
+ name: 'photoshop_rotate_layer',
69
+ description: 'Rotate the active layer',
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {
73
+ degrees: {
74
+ type: 'number',
75
+ description: 'Rotation angle in degrees (positive = clockwise, negative = counter-clockwise)',
76
+ },
77
+ },
78
+ required: ['degrees'],
79
+ },
80
+ },
81
+ handler: async (args) => rotateLayer(connection, args),
82
+ },
83
+ ];
84
+ }
85
+ async function fitLayerToDocument(connection, args) {
86
+ const fillDocument = args.fillDocument || false;
87
+ try {
88
+ const apiFactory = new PhotoshopAPIFactory(connection);
89
+ const api = await apiFactory.createAPI();
90
+ const script = ExtendScriptSnippets.fitLayerToDocument(fillDocument);
91
+ const result = await api.executeScript(script);
92
+ return {
93
+ content: [
94
+ {
95
+ type: 'text',
96
+ text: `Layer ${fillDocument ? 'filled' : 'fitted'} to document\nResult: ${JSON.stringify(result)}`,
97
+ },
98
+ ],
99
+ };
100
+ }
101
+ catch (error) {
102
+ return {
103
+ content: [
104
+ {
105
+ type: 'text',
106
+ text: `Error fitting layer to document: ${error instanceof Error ? error.message : String(error)}`,
107
+ },
108
+ ],
109
+ isError: true,
110
+ };
111
+ }
112
+ }
113
+ async function scaleLayer(connection, args) {
114
+ const scalePercent = args.scalePercent;
115
+ const centerAnchor = args.centerAnchor !== undefined ? args.centerAnchor : true;
116
+ try {
117
+ const apiFactory = new PhotoshopAPIFactory(connection);
118
+ const api = await apiFactory.createAPI();
119
+ const script = ExtendScriptSnippets.scaleLayer(scalePercent, centerAnchor);
120
+ const result = await api.executeScript(script);
121
+ return {
122
+ content: [
123
+ {
124
+ type: 'text',
125
+ text: `Layer scaled to ${scalePercent}%\nResult: ${JSON.stringify(result)}`,
126
+ },
127
+ ],
128
+ };
129
+ }
130
+ catch (error) {
131
+ return {
132
+ content: [
133
+ {
134
+ type: 'text',
135
+ text: `Error scaling layer: ${error instanceof Error ? error.message : String(error)}`,
136
+ },
137
+ ],
138
+ isError: true,
139
+ };
140
+ }
141
+ }
142
+ async function moveLayer(connection, args) {
143
+ const deltaX = args.deltaX;
144
+ const deltaY = args.deltaY;
145
+ try {
146
+ const apiFactory = new PhotoshopAPIFactory(connection);
147
+ const api = await apiFactory.createAPI();
148
+ const script = ExtendScriptSnippets.moveLayer(deltaX, deltaY);
149
+ const result = await api.executeScript(script);
150
+ return {
151
+ content: [
152
+ {
153
+ type: 'text',
154
+ text: `Layer moved by (${deltaX}, ${deltaY})px\nResult: ${JSON.stringify(result)}`,
155
+ },
156
+ ],
157
+ };
158
+ }
159
+ catch (error) {
160
+ return {
161
+ content: [
162
+ {
163
+ type: 'text',
164
+ text: `Error moving layer: ${error instanceof Error ? error.message : String(error)}`,
165
+ },
166
+ ],
167
+ isError: true,
168
+ };
169
+ }
170
+ }
171
+ async function rotateLayer(connection, args) {
172
+ const degrees = args.degrees;
173
+ try {
174
+ const apiFactory = new PhotoshopAPIFactory(connection);
175
+ const api = await apiFactory.createAPI();
176
+ const script = ExtendScriptSnippets.rotateLayer(degrees);
177
+ const result = await api.executeScript(script);
178
+ return {
179
+ content: [
180
+ {
181
+ type: 'text',
182
+ text: `Layer rotated ${degrees} degrees\nResult: ${JSON.stringify(result)}`,
183
+ },
184
+ ],
185
+ };
186
+ }
187
+ catch (error) {
188
+ return {
189
+ content: [
190
+ {
191
+ type: 'text',
192
+ text: `Error rotating layer: ${error instanceof Error ? error.message : String(error)}`,
193
+ },
194
+ ],
195
+ isError: true,
196
+ };
197
+ }
198
+ }
199
+ //# sourceMappingURL=layer-transform-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-transform-tools.js","sourceRoot":"","sources":["../../src/tools/layer-transform-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,yBAAyB,CAAC,UAA+B;IACvE,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,iCAAiC;gBACvC,WAAW,EACT,kFAAkF;gBACpF,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,YAAY,EAAE;4BACZ,IAAI,EAAE,SAAS;4BACf,WAAW,EACT,0GAA0G;4BAC5G,OAAO,EAAE,KAAK;yBACf;qBACF;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC;SAC9D;QACD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,uBAAuB;gBAC7B,WAAW,EAAE,wCAAwC;gBAC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AC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createSelectionTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=selection-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-tools.d.ts","sourceRoot":"","sources":["../../src/tools/selection-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAkGtF"}