illustrator-mcp-server 1.1.1 → 1.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.
- package/README.ja.md +15 -10
- package/README.md +14 -9
- package/dist/executor/file-transport.d.ts +6 -2
- package/dist/executor/file-transport.d.ts.map +1 -1
- package/dist/executor/file-transport.js +25 -10
- package/dist/executor/file-transport.js.map +1 -1
- package/dist/executor/jsx-runner.d.ts +5 -1
- package/dist/executor/jsx-runner.d.ts.map +1 -1
- package/dist/executor/jsx-runner.js +93 -39
- package/dist/executor/jsx-runner.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/jsx/helpers/common.jsx +3 -1
- package/dist/tools/modify/apply-color-profile.d.ts.map +1 -1
- package/dist/tools/modify/apply-color-profile.js +0 -17
- package/dist/tools/modify/apply-color-profile.js.map +1 -1
- package/dist/tools/modify/convert-to-outlines.d.ts.map +1 -1
- package/dist/tools/modify/convert-to-outlines.js +0 -20
- package/dist/tools/modify/convert-to-outlines.js.map +1 -1
- package/dist/tools/modify/create-text-frame.d.ts.map +1 -1
- package/dist/tools/modify/create-text-frame.js +21 -9
- package/dist/tools/modify/create-text-frame.js.map +1 -1
- package/dist/tools/modify/modify-object.d.ts.map +1 -1
- package/dist/tools/modify/modify-object.js +14 -7
- package/dist/tools/modify/modify-object.js.map +1 -1
- package/dist/tools/modify/shared.d.ts +1 -0
- package/dist/tools/modify/shared.d.ts.map +1 -1
- package/dist/tools/modify/shared.js +15 -0
- package/dist/tools/modify/shared.js.map +1 -1
- package/dist/tools/read/get-colors.d.ts.map +1 -1
- package/dist/tools/read/get-colors.js +28 -31
- package/dist/tools/read/get-colors.js.map +1 -1
- package/dist/tools/read/get-images.d.ts.map +1 -1
- package/dist/tools/read/get-images.js +4 -2
- package/dist/tools/read/get-images.js.map +1 -1
- package/dist/tools/read/get-path-items.d.ts.map +1 -1
- package/dist/tools/read/get-path-items.js +5 -4
- package/dist/tools/read/get-path-items.js.map +1 -1
- package/dist/utils/image-header.d.ts +1 -1
- package/dist/utils/image-header.d.ts.map +1 -1
- package/dist/utils/image-header.js +107 -1
- package/dist/utils/image-header.js.map +1 -1
- package/package.json +1 -2
package/README.ja.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/illustrator-mcp-server)
|
|
6
6
|
[](LICENSE)
|
|
7
|
-
[]()
|
|
7
|
+
[]()
|
|
8
8
|
[](https://www.adobe.com/products/illustrator.html)
|
|
9
9
|
[](https://modelcontextprotocol.io/)
|
|
10
10
|
|
|
@@ -64,11 +64,11 @@ Claude: → create_rectangle を実行
|
|
|
64
64
|
|
|
65
65
|
| 要件 | バージョン |
|
|
66
66
|
|---|---|
|
|
67
|
-
| macOS | osascript
|
|
67
|
+
| macOS または Windows | macOS: osascript / Windows: PowerShell COM(実機未検証) |
|
|
68
68
|
| Adobe Illustrator | CC 2024 以降 |
|
|
69
69
|
| Node.js | 20 以降 |
|
|
70
70
|
|
|
71
|
-
> **
|
|
71
|
+
> **macOS:** 初回実行時にオートメーション権限ダイアログが表示されます。
|
|
72
72
|
> システム設定 > プライバシーとセキュリティ > オートメーション で許可してください。
|
|
73
73
|
|
|
74
74
|
> **Note:** 操作系・書き出し系ツールの実行時、Illustrator がフォアグラウンドに切り替わります。Illustrator はアクティブな状態でないとこれらの処理を実行できないためです。
|
|
@@ -85,7 +85,9 @@ claude mcp add illustrator-mcp -- npx illustrator-mcp-server
|
|
|
85
85
|
|
|
86
86
|
### Claude Desktop
|
|
87
87
|
|
|
88
|
-
`claude_desktop_config.json
|
|
88
|
+
`claude_desktop_config.json` に追加:
|
|
89
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
90
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
89
91
|
|
|
90
92
|
```json
|
|
91
93
|
{
|
|
@@ -183,15 +185,17 @@ npx @modelcontextprotocol/inspector npx illustrator-mcp-server
|
|
|
183
185
|
```mermaid
|
|
184
186
|
flowchart LR
|
|
185
187
|
Claude <-->|MCP Protocol| Server["MCP Server\n(TypeScript/Node.js)"]
|
|
186
|
-
Server <-->|execFile| osascript
|
|
188
|
+
Server <-->|"execFile (macOS)"| osascript
|
|
189
|
+
Server <-->|"execFile (Windows)"| PS["powershell.exe\n(COM Automation)"]
|
|
187
190
|
osascript <-->|do javascript| AI["Adobe Illustrator\n(ExtendScript/JSX)"]
|
|
191
|
+
PS <-->|DoJavaScript| AI
|
|
188
192
|
|
|
189
193
|
Server -.->|write| PF["params-{uuid}.json"]
|
|
190
194
|
PF -.->|read| AI
|
|
191
195
|
AI -.->|write| RF["result-{uuid}.json"]
|
|
192
196
|
RF -.->|read| Server
|
|
193
197
|
Server -.->|generate| JSX["script-{uuid}.jsx\n(BOM UTF-8)"]
|
|
194
|
-
Server -.->|generate|
|
|
198
|
+
Server -.->|generate| Runner["run-{uuid}.scpt / .ps1"]
|
|
195
199
|
```
|
|
196
200
|
|
|
197
201
|
### 通信フロー
|
|
@@ -199,7 +203,7 @@ flowchart LR
|
|
|
199
203
|
1. Claude が MCP Server のツールを呼び出す
|
|
200
204
|
2. MCP Server がパラメータを JSON ファイルに書き出す
|
|
201
205
|
3. 共通ヘルパー + ツール固有コードを結合して BOM 付き UTF-8 の JSX ファイルを生成
|
|
202
|
-
4. AppleScript
|
|
206
|
+
4. macOS: AppleScript (.scpt) を生成し `osascript` で実行 / Windows: PowerShell (.ps1) を生成し COM 経由で実行
|
|
203
207
|
5. JSX が結果を JSON ファイルに書き出す
|
|
204
208
|
6. MCP Server が結果を読み取り、Claude に返す
|
|
205
209
|
7. 一時ファイルを `try/finally` でクリーンアップ
|
|
@@ -233,7 +237,7 @@ E2E テストは全 30 ケース(読み取り 16 + 書き出し 4 + ユーテ
|
|
|
233
237
|
|
|
234
238
|
| 制約 | 詳細 |
|
|
235
239
|
|---|---|
|
|
236
|
-
| macOS
|
|
240
|
+
| macOS / Windows | macOS は osascript、Windows は PowerShell COM を使用(Windows は実機未検証) |
|
|
237
241
|
| ライブエフェクト | ExtendScript DOM の制約により、ドロップシャドウ等のパラメータ取得不可 |
|
|
238
242
|
| カラープロファイル変換 | プロファイル割り当てのみ。完全な ICC 変換は非対応 |
|
|
239
243
|
| 裁ち落とし設定 | ExtendScript API で非公開のため取得不可 |
|
|
@@ -250,8 +254,8 @@ illustrator-mcp-server/
|
|
|
250
254
|
│ ├── index.ts # エントリポイント
|
|
251
255
|
│ ├── server.ts # MCP サーバー
|
|
252
256
|
│ ├── executor/
|
|
253
|
-
│ │ ├── jsx-runner.ts #
|
|
254
|
-
│ │ └── file-transport.ts # 一時ファイル管理
|
|
257
|
+
│ │ ├── jsx-runner.ts # トランスポート選択 + 排他制御
|
|
258
|
+
│ │ └── file-transport.ts # 一時ファイル管理 (macOS/Windows)
|
|
255
259
|
│ ├── tools/
|
|
256
260
|
│ │ ├── registry.ts # ツール登録
|
|
257
261
|
│ │ ├── read/ # 読み取り系 15 ツール
|
|
@@ -262,6 +266,7 @@ illustrator-mcp-server/
|
|
|
262
266
|
│ └── helpers/
|
|
263
267
|
│ └── common.jsx # ExtendScript 共通ヘルパー
|
|
264
268
|
├── test/
|
|
269
|
+
│ ├── unit/ # ユニットテスト
|
|
265
270
|
│ └── e2e/
|
|
266
271
|
│ └── smoke-test.ts # E2E スモークテスト
|
|
267
272
|
└── docs/ # 設計ドキュメント
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/illustrator-mcp-server)
|
|
6
6
|
[](LICENSE)
|
|
7
|
-
[]()
|
|
7
|
+
[]()
|
|
8
8
|
[](https://www.adobe.com/products/illustrator.html)
|
|
9
9
|
[](https://modelcontextprotocol.io/)
|
|
10
10
|
|
|
@@ -61,10 +61,10 @@ Claude: → create_rectangle
|
|
|
61
61
|
|
|
62
62
|
## Prerequisites
|
|
63
63
|
|
|
64
|
-
- **macOS** (osascript)
|
|
64
|
+
- **macOS** (osascript) or **Windows** (PowerShell COM automation — not yet tested on real hardware)
|
|
65
65
|
- **Adobe Illustrator CC 2024+**
|
|
66
66
|
|
|
67
|
-
> On first run, allow automation access in System Settings > Privacy & Security > Automation.
|
|
67
|
+
> **macOS:** On first run, allow automation access in System Settings > Privacy & Security > Automation.
|
|
68
68
|
|
|
69
69
|
> **Note:** Modify and export tools will bring Illustrator to the foreground during execution. Illustrator requires being the active application to process these operations.
|
|
70
70
|
|
|
@@ -80,7 +80,9 @@ claude mcp add illustrator-mcp -- npx illustrator-mcp-server
|
|
|
80
80
|
|
|
81
81
|
### Claude Desktop
|
|
82
82
|
|
|
83
|
-
Add to `claude_desktop_config.json
|
|
83
|
+
Add to `claude_desktop_config.json`:
|
|
84
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
85
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
84
86
|
|
|
85
87
|
```json
|
|
86
88
|
{
|
|
@@ -178,15 +180,17 @@ npx @modelcontextprotocol/inspector npx illustrator-mcp-server
|
|
|
178
180
|
```mermaid
|
|
179
181
|
flowchart LR
|
|
180
182
|
Claude <-->|MCP Protocol| Server["MCP Server\n(TypeScript/Node.js)"]
|
|
181
|
-
Server <-->|execFile| osascript
|
|
183
|
+
Server <-->|"execFile (macOS)"| osascript
|
|
184
|
+
Server <-->|"execFile (Windows)"| PS["powershell.exe\n(COM Automation)"]
|
|
182
185
|
osascript <-->|do javascript| AI["Adobe Illustrator\n(ExtendScript/JSX)"]
|
|
186
|
+
PS <-->|DoJavaScript| AI
|
|
183
187
|
|
|
184
188
|
Server -.->|write| PF["params-{uuid}.json"]
|
|
185
189
|
PF -.->|read| AI
|
|
186
190
|
AI -.->|write| RF["result-{uuid}.json"]
|
|
187
191
|
RF -.->|read| Server
|
|
188
192
|
Server -.->|generate| JSX["script-{uuid}.jsx\n(BOM UTF-8)"]
|
|
189
|
-
Server -.->|generate|
|
|
193
|
+
Server -.->|generate| Runner["run-{uuid}.scpt / .ps1"]
|
|
190
194
|
```
|
|
191
195
|
|
|
192
196
|
### Coordinate System
|
|
@@ -218,7 +222,7 @@ The E2E test suite runs all 30 cases automatically (16 read + 4 export + 2 utili
|
|
|
218
222
|
|
|
219
223
|
| Limitation | Details |
|
|
220
224
|
|---|---|
|
|
221
|
-
| macOS
|
|
225
|
+
| macOS / Windows | macOS uses osascript, Windows uses PowerShell COM automation (not yet tested on real hardware) |
|
|
222
226
|
| Live effects | ExtendScript DOM limitations prevent reading parameters for drop shadows, etc. |
|
|
223
227
|
| Color profile conversion | Only profile assignment is supported; full ICC conversion is not available |
|
|
224
228
|
| Bleed settings | Not accessible via the ExtendScript API (undocumented) |
|
|
@@ -235,8 +239,8 @@ illustrator-mcp-server/
|
|
|
235
239
|
│ ├── index.ts # Entry point
|
|
236
240
|
│ ├── server.ts # MCP server
|
|
237
241
|
│ ├── executor/
|
|
238
|
-
│ │ ├── jsx-runner.ts #
|
|
239
|
-
│ │ └── file-transport.ts # Temp file management
|
|
242
|
+
│ │ ├── jsx-runner.ts # Transport selection + concurrency control
|
|
243
|
+
│ │ └── file-transport.ts # Temp file management (macOS/Windows)
|
|
240
244
|
│ ├── tools/
|
|
241
245
|
│ │ ├── registry.ts # Tool registration
|
|
242
246
|
│ │ ├── read/ # 15 read tools
|
|
@@ -247,6 +251,7 @@ illustrator-mcp-server/
|
|
|
247
251
|
│ └── helpers/
|
|
248
252
|
│ └── common.jsx # ExtendScript common helpers
|
|
249
253
|
├── test/
|
|
254
|
+
│ ├── unit/ # Unit tests
|
|
250
255
|
│ └── e2e/
|
|
251
256
|
│ └── smoke-test.ts # E2E smoke test
|
|
252
257
|
└── docs/ # Design documents
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
export declare const TMP_DIR
|
|
1
|
+
export declare const TMP_DIR: string;
|
|
2
2
|
export interface TempFiles {
|
|
3
3
|
id: string;
|
|
4
4
|
paramsPath: string;
|
|
5
5
|
scriptPath: string;
|
|
6
|
-
|
|
6
|
+
/** macOS: AppleScript (.scpt) / Windows: PowerShell (.ps1) */
|
|
7
|
+
runnerPath: string;
|
|
7
8
|
resultPath: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function ensureTmpDir(): Promise<void>;
|
|
10
11
|
export declare function createTempFiles(): TempFiles;
|
|
11
12
|
export declare function writeParams(paramsPath: string, params: unknown): Promise<void>;
|
|
12
13
|
export declare function writeJsx(scriptPath: string, jsxCode: string): Promise<void>;
|
|
14
|
+
/** macOS 用 AppleScript 生成 */
|
|
13
15
|
export declare function writeAppleScript(scptPath: string, scriptPath: string, options?: {
|
|
14
16
|
activate?: boolean;
|
|
15
17
|
}): Promise<void>;
|
|
18
|
+
/** Windows 用 PowerShell スクリプト生成 */
|
|
19
|
+
export declare function writePowerShellScript(ps1Path: string, scriptPath: string): Promise<void>;
|
|
16
20
|
export declare function readResult(resultPath: string): Promise<unknown>;
|
|
17
21
|
export declare function cleanupTempFiles(files: TempFiles): Promise<void>;
|
|
18
22
|
export declare function cleanupTmpDirSync(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-transport.d.ts","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-transport.d.ts","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,QAA4C,CAAC;AAGjE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAElD;AAED,wBAAgB,eAAe,IAAI,SAAS,CAU3C;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF;AAED,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;AAED,6BAA6B;AAC7B,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CASf;AAED,mCAAmC;AACnC,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrE;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAatE;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import { rmSync } from 'fs';
|
|
4
|
+
import * as os from 'os';
|
|
4
5
|
import * as path from 'path';
|
|
5
|
-
export const TMP_DIR = '
|
|
6
|
+
export const TMP_DIR = path.join(os.tmpdir(), 'illustrator-mcp');
|
|
6
7
|
const BOM = '\uFEFF';
|
|
7
8
|
export async function ensureTmpDir() {
|
|
8
9
|
await fs.mkdir(TMP_DIR, { recursive: true });
|
|
9
10
|
}
|
|
10
11
|
export function createTempFiles() {
|
|
11
12
|
const id = randomUUID();
|
|
13
|
+
const ext = process.platform === 'win32' ? 'ps1' : 'scpt';
|
|
12
14
|
return {
|
|
13
15
|
id,
|
|
14
16
|
paramsPath: path.join(TMP_DIR, `params-${id}.json`),
|
|
15
17
|
scriptPath: path.join(TMP_DIR, `script-${id}.jsx`),
|
|
16
|
-
|
|
18
|
+
runnerPath: path.join(TMP_DIR, `run-${id}.${ext}`),
|
|
17
19
|
resultPath: path.join(TMP_DIR, `result-${id}.json`),
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -23,15 +25,33 @@ export async function writeParams(paramsPath, params) {
|
|
|
23
25
|
export async function writeJsx(scriptPath, jsxCode) {
|
|
24
26
|
await fs.writeFile(scriptPath, BOM + jsxCode, 'utf-8');
|
|
25
27
|
}
|
|
28
|
+
/** macOS 用 AppleScript 生成 */
|
|
26
29
|
export async function writeAppleScript(scptPath, scriptPath, options) {
|
|
27
30
|
const lines = ['tell application "Adobe Illustrator"'];
|
|
28
31
|
if (options?.activate) {
|
|
29
32
|
lines.push(' activate');
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
const escaped = scriptPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
35
|
+
lines.push(` do javascript of file "${escaped}"`);
|
|
32
36
|
lines.push('end tell');
|
|
33
37
|
await fs.writeFile(scptPath, lines.join('\n'), 'utf-8');
|
|
34
38
|
}
|
|
39
|
+
/** Windows 用 PowerShell スクリプト生成 */
|
|
40
|
+
export async function writePowerShellScript(ps1Path, scriptPath) {
|
|
41
|
+
// ExtendScript の File() はスラッシュ区切りを要求
|
|
42
|
+
const jsxPathForward = scriptPath.replace(/\\/g, '/');
|
|
43
|
+
const jsxPathEscaped = jsxPathForward.replace(/'/g, "\\'");
|
|
44
|
+
const lines = [
|
|
45
|
+
'try {',
|
|
46
|
+
' $ai = New-Object -ComObject "Illustrator.Application" -ErrorAction Stop',
|
|
47
|
+
` $ai.DoJavaScript("$.evalFile(new File('${jsxPathEscaped}'))")`,
|
|
48
|
+
'} catch {',
|
|
49
|
+
' Write-Error "Illustrator COM automation failed: $_"',
|
|
50
|
+
' exit 1',
|
|
51
|
+
'}',
|
|
52
|
+
];
|
|
53
|
+
await fs.writeFile(ps1Path, lines.join('\n'), 'utf-8');
|
|
54
|
+
}
|
|
35
55
|
export async function readResult(resultPath) {
|
|
36
56
|
const raw = await fs.readFile(resultPath, 'utf-8');
|
|
37
57
|
return JSON.parse(raw.replace(/^\uFEFF/, ''));
|
|
@@ -40,15 +60,10 @@ export async function cleanupTempFiles(files) {
|
|
|
40
60
|
const paths = [
|
|
41
61
|
files.paramsPath,
|
|
42
62
|
files.scriptPath,
|
|
43
|
-
files.
|
|
63
|
+
files.runnerPath,
|
|
44
64
|
files.resultPath,
|
|
45
65
|
];
|
|
46
|
-
const results = await Promise.allSettled(
|
|
47
|
-
fs.unlink(files.paramsPath),
|
|
48
|
-
fs.unlink(files.scriptPath),
|
|
49
|
-
fs.unlink(files.scptPath),
|
|
50
|
-
fs.unlink(files.resultPath),
|
|
51
|
-
]);
|
|
66
|
+
const results = await Promise.allSettled(paths.map((p) => fs.unlink(p)));
|
|
52
67
|
results.forEach((result, index) => {
|
|
53
68
|
if (result.status === 'rejected' && !isIgnorableCleanupError(result.reason)) {
|
|
54
69
|
console.warn('Failed to clean up temp file:', paths[index], result.reason);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-transport.js","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"file-transport.js","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,KAA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AI,KAAK,QAAQ,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ExecFileException } from 'child_process';
|
|
2
|
+
export type Transport = 'osascript' | 'powershell';
|
|
3
|
+
export declare function resolveTransport(platform?: string, envVar?: string | undefined): Transport;
|
|
4
|
+
declare const TRANSPORT: Transport;
|
|
2
5
|
/**
|
|
3
6
|
* 実行中の JSX がすべて完了するまで待機する(シャットダウン用)
|
|
4
7
|
*/
|
|
@@ -9,7 +12,7 @@ export interface JsxResult {
|
|
|
9
12
|
line?: number;
|
|
10
13
|
[key: string]: unknown;
|
|
11
14
|
}
|
|
12
|
-
export declare function getExecFailureMessage(error: ExecFileException, stderr: string, timeout: number): string;
|
|
15
|
+
export declare function getExecFailureMessage(error: ExecFileException, stderr: string, timeout: number, transport?: Transport): string;
|
|
13
16
|
/**
|
|
14
17
|
* JSX を実行する(排他制御付き — 公開 API)
|
|
15
18
|
*/
|
|
@@ -21,4 +24,5 @@ export declare function executeJsx(jsxCode: string, params?: unknown, options?:
|
|
|
21
24
|
* 重い処理用の JSX 実行(タイムアウト延長 + Illustrator をフォアグラウンドに)
|
|
22
25
|
*/
|
|
23
26
|
export declare function executeJsxHeavy(jsxCode: string, params?: unknown): Promise<JsxResult>;
|
|
27
|
+
export { TRANSPORT };
|
|
24
28
|
//# sourceMappingURL=jsx-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runner.d.ts","sourceRoot":"","sources":["../../src/executor/jsx-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"jsx-runner.d.ts","sourceRoot":"","sources":["../../src/executor/jsx-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA6BvD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEnD,wBAAgB,gBAAgB,CAC9B,QAAQ,GAAE,MAAyB,EACnC,MAAM,GAAE,MAAM,GAAG,SAAoD,GACpE,SAAS,CAMX;AAED,QAAA,MAAM,SAAS,EAAE,SAA8B,CAAC;AAEhD;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKxD;AAWD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAsCD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAuB,GACjC,MAAM,CASR;AAgHD;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACjD,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,CAAC,CAEpB;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -3,12 +3,24 @@ import * as fs from 'fs/promises';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import pLimit from 'p-limit';
|
|
6
|
-
import { createTempFiles, writeParams, writeJsx, writeAppleScript, readResult, cleanupTempFiles, } from './file-transport.js';
|
|
6
|
+
import { createTempFiles, writeParams, writeJsx, writeAppleScript, writePowerShellScript, readResult, cleanupTempFiles, } from './file-transport.js';
|
|
7
7
|
// Illustrator はシングルスレッド — JSX 実行を直列化
|
|
8
8
|
const jsxLimit = pLimit(1);
|
|
9
9
|
// 実行中の JSX を追跡(グレースフルシャットダウン用)
|
|
10
10
|
let pendingCount = 0;
|
|
11
|
-
let
|
|
11
|
+
let pendingResolvers = [];
|
|
12
|
+
export function resolveTransport(platform = process.platform, envVar = process.env['ILLUSTRATOR_MCP_TRANSPORT']) {
|
|
13
|
+
if (envVar === 'osascript')
|
|
14
|
+
return 'osascript';
|
|
15
|
+
if (envVar === 'powershell')
|
|
16
|
+
return 'powershell';
|
|
17
|
+
if (platform === 'darwin')
|
|
18
|
+
return 'osascript';
|
|
19
|
+
if (platform === 'win32')
|
|
20
|
+
return 'powershell';
|
|
21
|
+
throw new Error(`Unsupported platform: ${platform}. Only macOS and Windows are supported.`);
|
|
22
|
+
}
|
|
23
|
+
const TRANSPORT = resolveTransport();
|
|
12
24
|
/**
|
|
13
25
|
* 実行中の JSX がすべて完了するまで待機する(シャットダウン用)
|
|
14
26
|
*/
|
|
@@ -16,7 +28,7 @@ export function waitForPendingExecutions() {
|
|
|
16
28
|
if (pendingCount === 0)
|
|
17
29
|
return Promise.resolve();
|
|
18
30
|
return new Promise((resolve) => {
|
|
19
|
-
|
|
31
|
+
pendingResolvers.push(resolve);
|
|
20
32
|
});
|
|
21
33
|
}
|
|
22
34
|
const JSX_HELPERS_PATH = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../jsx/helpers/common.jsx');
|
|
@@ -24,7 +36,7 @@ const JSX_HELPERS_PATH = path.resolve(path.dirname(fileURLToPath(import.meta.url
|
|
|
24
36
|
const TIMEOUT_NORMAL = 30_000;
|
|
25
37
|
const TIMEOUT_HEAVY = 60_000;
|
|
26
38
|
/**
|
|
27
|
-
* JSX
|
|
39
|
+
* osascript / PowerShell COM 用 JSX ビルダー(ファイルベース I/O)
|
|
28
40
|
*/
|
|
29
41
|
async function buildJsx(toolScript, paramsPath, resultPath) {
|
|
30
42
|
const helpers = await fs.readFile(JSX_HELPERS_PATH, 'utf-8');
|
|
@@ -35,9 +47,7 @@ var RESULT_PATH = ${JSON.stringify(resultPath)};
|
|
|
35
47
|
${toolScript}
|
|
36
48
|
})();`;
|
|
37
49
|
}
|
|
38
|
-
|
|
39
|
-
* osascript エラーメッセージを解析して分かりやすいエラーに変換する
|
|
40
|
-
*/
|
|
50
|
+
// ─── エラーメッセージ変換 ────────────────────────────────────────────────────
|
|
41
51
|
function parseOsascriptError(stderr) {
|
|
42
52
|
if (stderr.includes('Connection is invalid')) {
|
|
43
53
|
return 'Illustrator is not running. Please launch Adobe Illustrator.';
|
|
@@ -47,63 +57,105 @@ function parseOsascriptError(stderr) {
|
|
|
47
57
|
}
|
|
48
58
|
return stderr;
|
|
49
59
|
}
|
|
50
|
-
|
|
60
|
+
function parsePowerShellError(stderr) {
|
|
61
|
+
if (stderr.includes('Cannot create ActiveX component') || stderr.includes('80080005') || stderr.includes('80040154')) {
|
|
62
|
+
return 'Illustrator is not running or is not installed. Please launch Adobe Illustrator.';
|
|
63
|
+
}
|
|
64
|
+
return stderr;
|
|
65
|
+
}
|
|
66
|
+
export function getExecFailureMessage(error, stderr, timeout, transport = 'osascript') {
|
|
51
67
|
if (error.code === 'ETIMEDOUT') {
|
|
52
68
|
return `Script execution timed out after ${timeout}ms`;
|
|
53
69
|
}
|
|
54
70
|
if (error.killed) {
|
|
55
71
|
return `Script execution was terminated${error.signal ? ` by signal ${error.signal}` : ''}`;
|
|
56
72
|
}
|
|
73
|
+
if (transport === 'powershell')
|
|
74
|
+
return parsePowerShellError(stderr || error.message);
|
|
57
75
|
return parseOsascriptError(stderr || error.message);
|
|
58
76
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*/
|
|
62
|
-
async function executeJsxRaw(jsxCode, params, timeout = TIMEOUT_NORMAL, activate = false) {
|
|
77
|
+
// ─── 各トランスポートの実行ロジック ─────────────────────────────────────────
|
|
78
|
+
async function executeViaOsascript(jsxCode, params, timeout, activate) {
|
|
63
79
|
const files = createTempFiles();
|
|
64
|
-
pendingCount++;
|
|
65
80
|
try {
|
|
66
|
-
// 1. パラメータをJSONファイルに書き出し
|
|
67
81
|
await writeParams(files.paramsPath, params);
|
|
68
|
-
// 2. 共通ヘルパー + ツール固有コードを結合し、BOM付きUTF-8で保存
|
|
69
82
|
const fullJsx = await buildJsx(jsxCode, files.paramsPath, files.resultPath);
|
|
70
83
|
await writeJsx(files.scriptPath, fullJsx);
|
|
71
|
-
|
|
72
|
-
await writeAppleScript(files.scptPath, files.scriptPath, { activate });
|
|
73
|
-
// 4. osascript を非同期実行
|
|
84
|
+
await writeAppleScript(files.runnerPath, files.scriptPath, { activate });
|
|
74
85
|
await new Promise((resolve, reject) => {
|
|
75
|
-
execFile('osascript', [files.
|
|
86
|
+
execFile('osascript', [files.runnerPath], { timeout }, (error, _stdout, stderr) => {
|
|
76
87
|
if (error) {
|
|
77
|
-
reject(new Error(getExecFailureMessage(error, stderr, timeout)));
|
|
88
|
+
reject(new Error(getExecFailureMessage(error, stderr, timeout, 'osascript')));
|
|
78
89
|
}
|
|
79
90
|
else {
|
|
80
91
|
resolve();
|
|
81
92
|
}
|
|
82
93
|
});
|
|
83
94
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
return await readAndValidateResult(files.resultPath);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
await cleanupTempFiles(files);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function executeViaPowerShell(jsxCode, params, timeout) {
|
|
102
|
+
const files = createTempFiles();
|
|
103
|
+
try {
|
|
104
|
+
await writeParams(files.paramsPath, params);
|
|
105
|
+
const fullJsx = await buildJsx(jsxCode, files.paramsPath, files.resultPath);
|
|
106
|
+
await writeJsx(files.scriptPath, fullJsx);
|
|
107
|
+
await writePowerShellScript(files.runnerPath, files.scriptPath);
|
|
108
|
+
await new Promise((resolve, reject) => {
|
|
109
|
+
execFile('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-NonInteractive', '-File', files.runnerPath], { timeout }, (error, _stdout, stderr) => {
|
|
110
|
+
if (error) {
|
|
111
|
+
reject(new Error(getExecFailureMessage(error, stderr, timeout, 'powershell')));
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
resolve();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return await readAndValidateResult(files.resultPath);
|
|
99
119
|
}
|
|
100
120
|
finally {
|
|
101
|
-
// 6. クリーンアップ
|
|
102
121
|
await cleanupTempFiles(files);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function readAndValidateResult(resultPath) {
|
|
125
|
+
let result;
|
|
126
|
+
try {
|
|
127
|
+
result = await readResult(resultPath);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
throw new Error('JSX terminated without producing a result file. An uncaught exception may have occurred within the JSX script.');
|
|
131
|
+
}
|
|
132
|
+
if (result.error) {
|
|
133
|
+
throw new Error(result.message || 'An unknown error occurred during JSX execution');
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
// ─── 公開 API ────────────────────────────────────────────────────────────────
|
|
138
|
+
/**
|
|
139
|
+
* JSX を実行する(排他制御なし — 内部用)
|
|
140
|
+
*/
|
|
141
|
+
async function executeJsxRaw(jsxCode, params, timeout = TIMEOUT_NORMAL, activate = false) {
|
|
142
|
+
pendingCount++;
|
|
143
|
+
try {
|
|
144
|
+
switch (TRANSPORT) {
|
|
145
|
+
case 'osascript':
|
|
146
|
+
return await executeViaOsascript(jsxCode, params, timeout, activate);
|
|
147
|
+
case 'powershell':
|
|
148
|
+
return await executeViaPowerShell(jsxCode, params, timeout);
|
|
149
|
+
default: {
|
|
150
|
+
const _ = TRANSPORT;
|
|
151
|
+
throw new Error(`Unknown transport: ${_}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
103
156
|
pendingCount--;
|
|
104
|
-
if (pendingCount === 0 &&
|
|
105
|
-
|
|
106
|
-
pendingResolve = null;
|
|
157
|
+
if (pendingCount === 0 && pendingResolvers.length > 0) {
|
|
158
|
+
pendingResolvers.splice(0).forEach((r) => r());
|
|
107
159
|
}
|
|
108
160
|
}
|
|
109
161
|
}
|
|
@@ -119,4 +171,6 @@ export async function executeJsx(jsxCode, params, options) {
|
|
|
119
171
|
export async function executeJsxHeavy(jsxCode, params) {
|
|
120
172
|
return executeJsx(jsxCode, params, { timeout: TIMEOUT_HEAVY, activate: true });
|
|
121
173
|
}
|
|
174
|
+
// ─── デバッグ用エクスポート ──────────────────────────────────────────────────
|
|
175
|
+
export { TRANSPORT };
|
|
122
176
|
//# sourceMappingURL=jsx-runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runner.js","sourceRoot":"","sources":["../../src/executor/jsx-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,eAAe,EACf,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,qCAAqC;AACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAE3B,+BAA+B;AAC/B,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,IAAI,
|
|
1
|
+
{"version":3,"file":"jsx-runner.js","sourceRoot":"","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AI,YAAY,KAAK,CAAC,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,MAAgB,EAChB,OAAkD;IAElD,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CACjC,OAAO,EACP,MAAM,EACN,OAAO,EAAE,OAAO,IAAI,cAAc,EAClC,OAAO,EAAE,QAAQ,IAAI,KAAK,CAC3B,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,MAAgB;IAEhB,OAAO,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,qEAAqE;AACrE,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,8 @@ async function main() {
|
|
|
19
19
|
await waitForPendingExecutions();
|
|
20
20
|
process.exit(0);
|
|
21
21
|
};
|
|
22
|
-
process.on('SIGINT', () => { gracefulShutdown(); });
|
|
23
|
-
process.on('SIGTERM', () => { gracefulShutdown(); });
|
|
22
|
+
process.on('SIGINT', () => { void gracefulShutdown().catch(() => process.exit(1)); });
|
|
23
|
+
process.on('SIGTERM', () => { void gracefulShutdown().catch(() => process.exit(1)); });
|
|
24
24
|
const server = createServer();
|
|
25
25
|
const transport = new StdioServerTransport();
|
|
26
26
|
await server.connect(transport);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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,CAAC,CAAC;IAEH,mCAAmC;IACnC,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;QAClC,IAAI,YAAY;YAAE,OAAO;QACzB,YAAY,GAAG,IAAI,CAAC;QACpB,MAAM,wBAAwB,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,gBAAgB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,gBAAgB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvF,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -73,7 +73,9 @@ function jsonParse(str) {
|
|
|
73
73
|
function readParamsFile(filePath) {
|
|
74
74
|
var f = new File(filePath);
|
|
75
75
|
f.encoding = "UTF-8";
|
|
76
|
-
f.open("r")
|
|
76
|
+
if (!f.open("r")) {
|
|
77
|
+
throw new Error("Cannot open params file: " + filePath);
|
|
78
|
+
}
|
|
77
79
|
var content = f.read();
|
|
78
80
|
f.close();
|
|
79
81
|
return jsonParse(content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-color-profile.d.ts","sourceRoot":"","sources":["../../../src/tools/modify/apply-color-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-color-profile.d.ts","sourceRoot":"","sources":["../../../src/tools/modify/apply-color-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgDpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqBhD"}
|
|
@@ -9,7 +9,6 @@ if (preflight) {
|
|
|
9
9
|
var params = readParamsFile(PARAMS_PATH);
|
|
10
10
|
var doc = app.activeDocument;
|
|
11
11
|
var profile = params.profile;
|
|
12
|
-
var intent = params.intent;
|
|
13
12
|
|
|
14
13
|
var oldProfile = "";
|
|
15
14
|
try {
|
|
@@ -18,18 +17,6 @@ if (preflight) {
|
|
|
18
17
|
oldProfile = "(unavailable)";
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
// Map intent string to RenderingIntent enum
|
|
22
|
-
var renderIntent = null;
|
|
23
|
-
if (intent === "perceptual") {
|
|
24
|
-
renderIntent = RenderingIntent.PERCEPTUAL;
|
|
25
|
-
} else if (intent === "relative") {
|
|
26
|
-
renderIntent = RenderingIntent.RELATIVECOLORIMETRIC;
|
|
27
|
-
} else if (intent === "saturation") {
|
|
28
|
-
renderIntent = RenderingIntent.SATURATION;
|
|
29
|
-
} else if (intent === "absolute") {
|
|
30
|
-
renderIntent = RenderingIntent.ABSOLUTECOLORIMETRIC;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
20
|
// ExtendScript does not provide a single-call color conversion API.
|
|
34
21
|
// We can assign a color profile name to embed/change the profile.
|
|
35
22
|
// For full ICC-based conversion, manual workflow or actions are needed.
|
|
@@ -48,7 +35,6 @@ if (preflight) {
|
|
|
48
35
|
success: true,
|
|
49
36
|
previousProfile: oldProfile,
|
|
50
37
|
newProfile: profile,
|
|
51
|
-
intent: intent,
|
|
52
38
|
note: note
|
|
53
39
|
});
|
|
54
40
|
}
|
|
@@ -63,9 +49,6 @@ export function register(server) {
|
|
|
63
49
|
description: 'Apply or convert color profile. Note: Illustrator will be activated (brought to foreground) during execution.',
|
|
64
50
|
inputSchema: {
|
|
65
51
|
profile: z.string().describe('Color profile name or path'),
|
|
66
|
-
intent: z
|
|
67
|
-
.enum(['perceptual', 'relative', 'saturation', 'absolute'])
|
|
68
|
-
.describe('Rendering intent'),
|
|
69
52
|
},
|
|
70
53
|
annotations: {
|
|
71
54
|
readOnlyHint: false,
|