illustrator-mcp-server 1.4.0 → 1.5.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/dist/bundle.cjs CHANGED
@@ -3107,6 +3107,9 @@ var require_utils = __commonJS({
3107
3107
  "use strict";
3108
3108
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3109
3109
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3110
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3111
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3112
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3110
3113
  function stringArrayToHexStripped(input) {
3111
3114
  let acc = "";
3112
3115
  let code = 0;
@@ -3299,27 +3302,77 @@ var require_utils = __commonJS({
3299
3302
  }
3300
3303
  return output.join("");
3301
3304
  }
3302
- function normalizeComponentEncoding(component, esc2) {
3303
- const func = esc2 !== true ? escape : unescape;
3304
- if (component.scheme !== void 0) {
3305
- component.scheme = func(component.scheme);
3306
- }
3307
- if (component.userinfo !== void 0) {
3308
- component.userinfo = func(component.userinfo);
3309
- }
3310
- if (component.host !== void 0) {
3311
- component.host = func(component.host);
3305
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3306
+ var HOST_DELIM_RE = /[@/?#:]/g;
3307
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
3308
+ function reescapeHostDelimiters(host, isIP) {
3309
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
3310
+ re.lastIndex = 0;
3311
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
3312
+ }
3313
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
3314
+ if (input.indexOf("%") === -1) {
3315
+ return input;
3312
3316
  }
3313
- if (component.path !== void 0) {
3314
- component.path = func(component.path);
3317
+ let output = "";
3318
+ for (let i = 0; i < input.length; i++) {
3319
+ if (input[i] === "%" && i + 2 < input.length) {
3320
+ const hex3 = input.slice(i + 1, i + 3);
3321
+ if (isHexPair(hex3)) {
3322
+ const normalizedHex = hex3.toUpperCase();
3323
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3324
+ if (decodeUnreserved && isUnreserved(decoded)) {
3325
+ output += decoded;
3326
+ } else {
3327
+ output += "%" + normalizedHex;
3328
+ }
3329
+ i += 2;
3330
+ continue;
3331
+ }
3332
+ }
3333
+ output += input[i];
3315
3334
  }
3316
- if (component.query !== void 0) {
3317
- component.query = func(component.query);
3335
+ return output;
3336
+ }
3337
+ function normalizePathEncoding(input) {
3338
+ let output = "";
3339
+ for (let i = 0; i < input.length; i++) {
3340
+ if (input[i] === "%" && i + 2 < input.length) {
3341
+ const hex3 = input.slice(i + 1, i + 3);
3342
+ if (isHexPair(hex3)) {
3343
+ const normalizedHex = hex3.toUpperCase();
3344
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3345
+ if (decoded !== "." && isUnreserved(decoded)) {
3346
+ output += decoded;
3347
+ } else {
3348
+ output += "%" + normalizedHex;
3349
+ }
3350
+ i += 2;
3351
+ continue;
3352
+ }
3353
+ }
3354
+ if (isPathCharacter(input[i])) {
3355
+ output += input[i];
3356
+ } else {
3357
+ output += escape(input[i]);
3358
+ }
3318
3359
  }
3319
- if (component.fragment !== void 0) {
3320
- component.fragment = func(component.fragment);
3360
+ return output;
3361
+ }
3362
+ function escapePreservingEscapes(input) {
3363
+ let output = "";
3364
+ for (let i = 0; i < input.length; i++) {
3365
+ if (input[i] === "%" && i + 2 < input.length) {
3366
+ const hex3 = input.slice(i + 1, i + 3);
3367
+ if (isHexPair(hex3)) {
3368
+ output += "%" + hex3.toUpperCase();
3369
+ i += 2;
3370
+ continue;
3371
+ }
3372
+ }
3373
+ output += escape(input[i]);
3321
3374
  }
3322
- return component;
3375
+ return output;
3323
3376
  }
3324
3377
  function recomposeAuthority(component) {
3325
3378
  const uriTokens = [];
@@ -3334,7 +3387,7 @@ var require_utils = __commonJS({
3334
3387
  if (ipV6res.isIPV6 === true) {
3335
3388
  host = `[${ipV6res.escapedHost}]`;
3336
3389
  } else {
3337
- host = component.host;
3390
+ host = reescapeHostDelimiters(host, false);
3338
3391
  }
3339
3392
  }
3340
3393
  uriTokens.push(host);
@@ -3348,7 +3401,10 @@ var require_utils = __commonJS({
3348
3401
  module2.exports = {
3349
3402
  nonSimpleDomain,
3350
3403
  recomposeAuthority,
3351
- normalizeComponentEncoding,
3404
+ reescapeHostDelimiters,
3405
+ normalizePercentEncoding,
3406
+ normalizePathEncoding,
3407
+ escapePreservingEscapes,
3352
3408
  removeDotSegments,
3353
3409
  isIPv4,
3354
3410
  isUUID,
@@ -3572,12 +3628,12 @@ var require_schemes = __commonJS({
3572
3628
  var require_fast_uri = __commonJS({
3573
3629
  "node_modules/fast-uri/index.js"(exports2, module2) {
3574
3630
  "use strict";
3575
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3631
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3576
3632
  var { SCHEMES, getSchemeHandler } = require_schemes();
3577
3633
  function normalize(uri, options) {
3578
3634
  if (typeof uri === "string") {
3579
3635
  uri = /** @type {T} */
3580
- serialize(parse3(uri, options), options);
3636
+ normalizeString(uri, options);
3581
3637
  } else if (typeof uri === "object") {
3582
3638
  uri = /** @type {T} */
3583
3639
  parse3(serialize(uri, options), options);
@@ -3644,19 +3700,9 @@ var require_fast_uri = __commonJS({
3644
3700
  return target;
3645
3701
  }
3646
3702
  function equal(uriA, uriB, options) {
3647
- if (typeof uriA === "string") {
3648
- uriA = unescape(uriA);
3649
- uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
3650
- } else if (typeof uriA === "object") {
3651
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
3652
- }
3653
- if (typeof uriB === "string") {
3654
- uriB = unescape(uriB);
3655
- uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
3656
- } else if (typeof uriB === "object") {
3657
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
3658
- }
3659
- return uriA.toLowerCase() === uriB.toLowerCase();
3703
+ const normalizedA = normalizeComparableURI(uriA, options);
3704
+ const normalizedB = normalizeComparableURI(uriB, options);
3705
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3660
3706
  }
3661
3707
  function serialize(cmpts, opts) {
3662
3708
  const component = {
@@ -3681,12 +3727,12 @@ var require_fast_uri = __commonJS({
3681
3727
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3682
3728
  if (component.path !== void 0) {
3683
3729
  if (!options.skipEscape) {
3684
- component.path = escape(component.path);
3730
+ component.path = escapePreservingEscapes(component.path);
3685
3731
  if (component.scheme !== void 0) {
3686
3732
  component.path = component.path.split("%3A").join(":");
3687
3733
  }
3688
3734
  } else {
3689
- component.path = unescape(component.path);
3735
+ component.path = normalizePercentEncoding(component.path);
3690
3736
  }
3691
3737
  }
3692
3738
  if (options.reference !== "suffix" && component.scheme) {
@@ -3721,7 +3767,16 @@ var require_fast_uri = __commonJS({
3721
3767
  return uriTokens.join("");
3722
3768
  }
3723
3769
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3724
- function parse3(uri, opts) {
3770
+ function getParseError(parsed, matches) {
3771
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3772
+ return 'URI path must start with "/" when authority is present.';
3773
+ }
3774
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
3775
+ return "URI port is malformed.";
3776
+ }
3777
+ return void 0;
3778
+ }
3779
+ function parseWithStatus(uri, opts) {
3725
3780
  const options = Object.assign({}, opts);
3726
3781
  const parsed = {
3727
3782
  scheme: void 0,
@@ -3732,6 +3787,7 @@ var require_fast_uri = __commonJS({
3732
3787
  query: void 0,
3733
3788
  fragment: void 0
3734
3789
  };
3790
+ let malformedAuthorityOrPort = false;
3735
3791
  let isIP = false;
3736
3792
  if (options.reference === "suffix") {
3737
3793
  if (options.scheme) {
@@ -3752,6 +3808,11 @@ var require_fast_uri = __commonJS({
3752
3808
  if (isNaN(parsed.port)) {
3753
3809
  parsed.port = matches[5];
3754
3810
  }
3811
+ const parseError = getParseError(parsed, matches);
3812
+ if (parseError !== void 0) {
3813
+ parsed.error = parsed.error || parseError;
3814
+ malformedAuthorityOrPort = true;
3815
+ }
3755
3816
  if (parsed.host) {
3756
3817
  const ipv4result = isIPv4(parsed.host);
3757
3818
  if (ipv4result === false) {
@@ -3790,14 +3851,18 @@ var require_fast_uri = __commonJS({
3790
3851
  parsed.scheme = unescape(parsed.scheme);
3791
3852
  }
3792
3853
  if (parsed.host !== void 0) {
3793
- parsed.host = unescape(parsed.host);
3854
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3794
3855
  }
3795
3856
  }
3796
3857
  if (parsed.path) {
3797
- parsed.path = escape(unescape(parsed.path));
3858
+ parsed.path = normalizePathEncoding(parsed.path);
3798
3859
  }
3799
3860
  if (parsed.fragment) {
3800
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3861
+ try {
3862
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3863
+ } catch {
3864
+ parsed.error = parsed.error || "URI malformed";
3865
+ }
3801
3866
  }
3802
3867
  }
3803
3868
  if (schemeHandler && schemeHandler.parse) {
@@ -3806,7 +3871,29 @@ var require_fast_uri = __commonJS({
3806
3871
  } else {
3807
3872
  parsed.error = parsed.error || "URI can not be parsed.";
3808
3873
  }
3809
- return parsed;
3874
+ return { parsed, malformedAuthorityOrPort };
3875
+ }
3876
+ function parse3(uri, opts) {
3877
+ return parseWithStatus(uri, opts).parsed;
3878
+ }
3879
+ function normalizeString(uri, opts) {
3880
+ return normalizeStringWithStatus(uri, opts).normalized;
3881
+ }
3882
+ function normalizeStringWithStatus(uri, opts) {
3883
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3884
+ return {
3885
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3886
+ malformedAuthorityOrPort
3887
+ };
3888
+ }
3889
+ function normalizeComparableURI(uri, opts) {
3890
+ if (typeof uri === "string") {
3891
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3892
+ return malformedAuthorityOrPort ? void 0 : normalized;
3893
+ }
3894
+ if (typeof uri === "object") {
3895
+ return serialize(uri, opts);
3896
+ }
3810
3897
  }
3811
3898
  var fastUri = {
3812
3899
  SCHEMES,
@@ -20581,10 +20668,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
20581
20668
  var CursorSchema = string2();
20582
20669
  var TaskCreationParamsSchema = looseObject({
20583
20670
  /**
20584
- * Time in milliseconds to keep task results available after completion.
20585
- * If null, the task has unlimited lifetime until manually cleaned up.
20671
+ * Requested duration in milliseconds to retain task from creation.
20586
20672
  */
20587
- ttl: union([number2(), _null3()]).optional(),
20673
+ ttl: number2().optional(),
20588
20674
  /**
20589
20675
  * Time in milliseconds to wait between task status requests.
20590
20676
  */
@@ -20884,7 +20970,11 @@ var ClientCapabilitiesSchema = object({
20884
20970
  /**
20885
20971
  * Present if the client supports task creation.
20886
20972
  */
20887
- tasks: ClientTasksCapabilitySchema.optional()
20973
+ tasks: ClientTasksCapabilitySchema.optional(),
20974
+ /**
20975
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
20976
+ */
20977
+ extensions: record(string2(), AssertObjectSchema).optional()
20888
20978
  });
20889
20979
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
20890
20980
  /**
@@ -20945,7 +21035,11 @@ var ServerCapabilitiesSchema = object({
20945
21035
  /**
20946
21036
  * Present if the server supports task creation.
20947
21037
  */
20948
- tasks: ServerTasksCapabilitySchema.optional()
21038
+ tasks: ServerTasksCapabilitySchema.optional(),
21039
+ /**
21040
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
21041
+ */
21042
+ extensions: record(string2(), AssertObjectSchema).optional()
20949
21043
  });
20950
21044
  var InitializeResultSchema = ResultSchema.extend({
20951
21045
  /**
@@ -21137,6 +21231,12 @@ var ResourceSchema = object({
21137
21231
  * The MIME type of this resource, if known.
21138
21232
  */
21139
21233
  mimeType: optional(string2()),
21234
+ /**
21235
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
21236
+ *
21237
+ * This can be used by Hosts to display file sizes and estimate context window usage.
21238
+ */
21239
+ size: optional(number2()),
21140
21240
  /**
21141
21241
  * Optional annotations for the client.
21142
21242
  */
@@ -27785,6 +27885,10 @@ var Protocol = class {
27785
27885
  this._progressHandlers.clear();
27786
27886
  this._taskProgressTokens.clear();
27787
27887
  this._pendingDebouncedNotifications.clear();
27888
+ for (const info of this._timeoutInfo.values()) {
27889
+ clearTimeout(info.timeoutId);
27890
+ }
27891
+ this._timeoutInfo.clear();
27788
27892
  for (const controller of this._requestHandlerAbortControllers.values()) {
27789
27893
  controller.abort();
27790
27894
  }
@@ -27915,7 +28019,9 @@ var Protocol = class {
27915
28019
  await capturedTransport?.send(errorResponse);
27916
28020
  }
27917
28021
  }).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
27918
- this._requestHandlerAbortControllers.delete(request.id);
28022
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
28023
+ this._requestHandlerAbortControllers.delete(request.id);
28024
+ }
27919
28025
  });
27920
28026
  }
27921
28027
  _onprogress(notification) {
@@ -29928,6 +30034,9 @@ var McpServer = class {
29928
30034
  annotations = rest.shift();
29929
30035
  }
29930
30036
  } else if (typeof firstArg === "object" && firstArg !== null) {
30037
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
30038
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
30039
+ }
29931
30040
  annotations = rest.shift();
29932
30041
  }
29933
30042
  }
@@ -30046,6 +30155,9 @@ function getZodSchemaObject(schema) {
30046
30155
  if (isZodRawShapeCompat(schema)) {
30047
30156
  return objectFromShape(schema);
30048
30157
  }
30158
+ if (!isZodSchemaInstance(schema)) {
30159
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
30160
+ }
30049
30161
  return schema;
30050
30162
  }
30051
30163
  function promptArgumentsFromSchema(schema) {
@@ -30279,8 +30391,8 @@ function createTempFiles() {
30279
30391
  async function writeParams(paramsPath, params) {
30280
30392
  await fs.writeFile(paramsPath, JSON.stringify(params ?? {}), "utf-8");
30281
30393
  }
30282
- async function writeJsx(scriptPath, jsxCode60) {
30283
- await fs.writeFile(scriptPath, BOM + jsxCode60, "utf-8");
30394
+ async function writeJsx(scriptPath, jsxCode61) {
30395
+ await fs.writeFile(scriptPath, BOM + jsxCode61, "utf-8");
30284
30396
  }
30285
30397
  async function writeAppleScript(scptPath, scriptPath, options) {
30286
30398
  const escaped = scriptPath.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -30452,11 +30564,11 @@ function getExecFailureMessage(error48, stderr, timeout, transport = "osascript"
30452
30564
  if (transport === "powershell") return parsePowerShellError(stderr || error48.message);
30453
30565
  return parseOsascriptError(stderr || error48.message);
30454
30566
  }
30455
- async function executeViaOsascript(jsxCode60, params, timeout, activate) {
30567
+ async function executeViaOsascript(jsxCode61, params, timeout, activate) {
30456
30568
  const files = createTempFiles();
30457
30569
  try {
30458
30570
  await writeParams(files.paramsPath, params);
30459
- const fullJsx = await buildJsx(jsxCode60, files.paramsPath, files.resultPath);
30571
+ const fullJsx = await buildJsx(jsxCode61, files.paramsPath, files.resultPath);
30460
30572
  await writeJsx(files.scriptPath, fullJsx);
30461
30573
  await writeAppleScript(files.runnerPath, files.scriptPath, { activate, appPath: getAppPath() });
30462
30574
  await new Promise((resolve2, reject) => {
@@ -30473,11 +30585,11 @@ async function executeViaOsascript(jsxCode60, params, timeout, activate) {
30473
30585
  await cleanupTempFiles(files);
30474
30586
  }
30475
30587
  }
30476
- async function executeViaPowerShell(jsxCode60, params, timeout, activate) {
30588
+ async function executeViaPowerShell(jsxCode61, params, timeout, activate) {
30477
30589
  const files = createTempFiles();
30478
30590
  try {
30479
30591
  await writeParams(files.paramsPath, params);
30480
- const fullJsx = await buildJsx(jsxCode60, files.paramsPath, files.resultPath);
30592
+ const fullJsx = await buildJsx(jsxCode61, files.paramsPath, files.resultPath);
30481
30593
  await writeJsx(files.scriptPath, fullJsx);
30482
30594
  await writePowerShellScript(files.runnerPath, files.scriptPath, { activate, appPath: getAppPath() });
30483
30595
  await new Promise((resolve2, reject) => {
@@ -30516,24 +30628,24 @@ async function readAndValidateResult(resultPath) {
30516
30628
  }
30517
30629
  return result;
30518
30630
  }
30519
- async function executeJsxRaw(jsxCode60, params, timeout = TIMEOUT_NORMAL, activate = false) {
30631
+ async function executeJsxRaw(jsxCode61, params, timeout = TIMEOUT_NORMAL, activate = false) {
30520
30632
  const transport = getTransport();
30521
30633
  switch (transport) {
30522
30634
  case "osascript":
30523
- return await executeViaOsascript(jsxCode60, params, timeout, activate);
30635
+ return await executeViaOsascript(jsxCode61, params, timeout, activate);
30524
30636
  case "powershell":
30525
- return await executeViaPowerShell(jsxCode60, params, timeout, activate);
30637
+ return await executeViaPowerShell(jsxCode61, params, timeout, activate);
30526
30638
  default: {
30527
30639
  const _ = transport;
30528
30640
  throw new Error(`Unknown transport: ${_}`);
30529
30641
  }
30530
30642
  }
30531
30643
  }
30532
- async function executeJsx(jsxCode60, params, options) {
30644
+ async function executeJsx(jsxCode61, params, options) {
30533
30645
  pendingCount++;
30534
30646
  try {
30535
30647
  return await jsxLimit(() => executeJsxRaw(
30536
- jsxCode60,
30648
+ jsxCode61,
30537
30649
  params,
30538
30650
  options?.timeout ?? TIMEOUT_NORMAL,
30539
30651
  options?.activate ?? false
@@ -30545,8 +30657,8 @@ async function executeJsx(jsxCode60, params, options) {
30545
30657
  }
30546
30658
  }
30547
30659
  }
30548
- async function executeJsxHeavy(jsxCode60, params) {
30549
- return executeJsx(jsxCode60, params, { timeout: TIMEOUT_HEAVY, activate: true });
30660
+ async function executeJsxHeavy(jsxCode61, params) {
30661
+ return executeJsx(jsxCode61, params, { timeout: TIMEOUT_HEAVY, activate: true });
30550
30662
  }
30551
30663
 
30552
30664
  // src/tools/session.ts
@@ -30752,10 +30864,10 @@ function ensureToolParams(params) {
30752
30864
  function formatToolResult(result) {
30753
30865
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
30754
30866
  }
30755
- async function executeToolJsx(jsxCode60, params, options) {
30867
+ async function executeToolJsx(jsxCode61, params, options) {
30756
30868
  const baseParams = ensureToolParams(params);
30757
30869
  const resolvedParams = options?.resolveCoordinate ? { ...baseParams, coordinate_system: await resolveCoordinateSystem(baseParams.coordinate_system) } : baseParams;
30758
- const result = options?.heavy ? await executeJsxHeavy(jsxCode60, resolvedParams) : await executeJsx(jsxCode60, resolvedParams, { activate: options?.activate ?? false });
30870
+ const result = options?.heavy ? await executeJsxHeavy(jsxCode61, resolvedParams) : await executeJsx(jsxCode61, resolvedParams, { activate: options?.activate ?? false });
30759
30871
  return formatToolResult(result);
30760
30872
  }
30761
30873
 
@@ -36657,11 +36769,26 @@ if (preflight) {
36657
36769
  var imgFile = new File(filePath);
36658
36770
  if (!imgFile.exists) {
36659
36771
  writeResultFile(RESULT_PATH, { error: true, message: "Image file not found: " + filePath });
36772
+ } else if (/\\.svgz?$/i.test(filePath)) {
36773
+ writeResultFile(RESULT_PATH, {
36774
+ error: true,
36775
+ message: "place_image does not support SVG files. SVG placed via PlacedItems becomes a non-editable linked artwork and often leaves broken link items in the document. Use import_svg_as_editable to bring SVG content in as editable Illustrator paths/text."
36776
+ });
36660
36777
  } else {
36661
36778
  var targetLayer = resolveTargetLayer(doc, params.layer_name);
36662
36779
 
36663
36780
  var placed = targetLayer.placedItems.add();
36664
- placed.file = imgFile;
36781
+ try {
36782
+ placed.file = imgFile;
36783
+ } catch (linkErr) {
36784
+ // Setting .file failed \u2014 remove the orphaned PlacedItem so no broken link remains
36785
+ try { placed.remove(); } catch (rmErr) {}
36786
+ writeResultFile(RESULT_PATH, {
36787
+ error: true,
36788
+ message: "Failed to link image file (likely unsupported or corrupt): " + linkErr.message + ". The empty placed item was removed."
36789
+ });
36790
+ return;
36791
+ }
36665
36792
 
36666
36793
  // Position
36667
36794
  if (typeof params.x === "number" && typeof params.y === "number") {
@@ -36726,7 +36853,7 @@ function register34(server) {
36726
36853
  "place_image",
36727
36854
  {
36728
36855
  title: "Place Image",
36729
- description: "Place an image file (PNG, JPG, TIFF, PSD, etc.) into the document as a linked or embedded image. Note: Illustrator will be activated (brought to foreground) during execution.",
36856
+ description: "Place a raster or PDF image file (PNG, JPG, TIFF, PSD, PDF, etc.) into the document as a linked or embedded image. SVG is NOT supported here because PlacedItems produces a non-editable linked artwork \u2014 use import_svg_as_editable instead to bring SVG content in as editable paths/text. Note: Illustrator will be activated (brought to foreground) during execution.",
36730
36857
  inputSchema: {
36731
36858
  file_path: external_exports.string().describe("Absolute path to the image file"),
36732
36859
  x: external_exports.number().optional().describe("X position"),
@@ -36744,8 +36871,217 @@ function register34(server) {
36744
36871
  );
36745
36872
  }
36746
36873
 
36747
- // src/tools/modify/resize-for-variation.ts
36874
+ // src/tools/modify/import-svg-as-editable.ts
36748
36875
  var jsxCode33 = `
36876
+ var srcDoc = null;
36877
+ var targetDocRef = null;
36878
+ var preflight = preflightChecks();
36879
+ if (preflight) {
36880
+ writeResultFile(RESULT_PATH, preflight);
36881
+ } else {
36882
+ try {
36883
+ var params = readParamsFile(PARAMS_PATH);
36884
+ var coordSystem = params.coordinate_system || "artboard-web";
36885
+
36886
+ var svgPath = params.file_path;
36887
+ if (!/\\.svgz?$/i.test(svgPath)) {
36888
+ writeResultFile(RESULT_PATH, { error: true, message: "import_svg_as_editable expects an .svg or .svgz file. Got: " + svgPath });
36889
+ } else {
36890
+ var svgFile = new File(svgPath);
36891
+ if (!svgFile.exists) {
36892
+ writeResultFile(RESULT_PATH, { error: true, message: "SVG file not found: " + svgPath });
36893
+ } else {
36894
+ targetDocRef = app.activeDocument;
36895
+ var abRect = (coordSystem === "artboard-web") ? getActiveArtboardRect() : null;
36896
+
36897
+ try {
36898
+ srcDoc = app.open(svgFile);
36899
+ } catch (openErr) {
36900
+ writeResultFile(RESULT_PATH, { error: true, message: "Failed to open SVG: " + openErr.message });
36901
+ srcDoc = null;
36902
+ }
36903
+
36904
+ if (srcDoc) {
36905
+ // \u8907\u88FD\u4E2D\u306B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u5909\u52D5\u3059\u308B\u305F\u3081\u4E8B\u524D\u306B\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8
36906
+ var sourceItems = [];
36907
+ for (var i = 0; i < srcDoc.pageItems.length; i++) {
36908
+ sourceItems.push(srcDoc.pageItems[i]);
36909
+ }
36910
+
36911
+ if (sourceItems.length === 0) {
36912
+ try { srcDoc.close(SaveOptions.DONOTSAVECHANGES); } catch (e) {}
36913
+ srcDoc = null;
36914
+ app.activeDocument = targetDocRef;
36915
+ writeResultFile(RESULT_PATH, { error: true, message: "SVG contains no importable items" });
36916
+ } else {
36917
+ var targetLayer = resolveTargetLayer(targetDocRef, params.layer_name);
36918
+ var duplicated = [];
36919
+ var dupErrors = [];
36920
+ for (var j = 0; j < sourceItems.length; j++) {
36921
+ try {
36922
+ duplicated.push(sourceItems[j].duplicate(targetLayer, ElementPlacement.PLACEATEND));
36923
+ } catch (dupErr) {
36924
+ dupErrors.push({ index: j, message: dupErr.message });
36925
+ }
36926
+ }
36927
+
36928
+ try { srcDoc.close(SaveOptions.DONOTSAVECHANGES); } catch (e) {}
36929
+ srcDoc = null;
36930
+ app.activeDocument = targetDocRef;
36931
+
36932
+ if (duplicated.length === 0) {
36933
+ writeResultFile(RESULT_PATH, {
36934
+ error: true,
36935
+ message: "Failed to duplicate any SVG items into target document",
36936
+ details: dupErrors
36937
+ });
36938
+ } else {
36939
+ var rootItem = wrapAsGroup(duplicated, targetLayer, params.group !== false);
36940
+ var movables = rootItem ? [rootItem] : duplicated;
36941
+
36942
+ var bounds = rootItem ? rootItem.geometricBounds : unionBounds(duplicated);
36943
+
36944
+ // \u30D5\u30A3\u30C3\u30C8 \u2192 \u30B5\u30A4\u30BA\u304C\u5909\u308F\u3063\u305F\u3089\u30D0\u30A6\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u53D6\u308A\u76F4\u3059
36945
+ if (params.fit_to_artboard === true && abRect) {
36946
+ var pad = (typeof params.padding === "number") ? params.padding : 0;
36947
+ fitItemsToArtboard(movables, bounds, abRect, pad);
36948
+ bounds = rootItem ? rootItem.geometricBounds : unionBounds(duplicated);
36949
+ }
36950
+
36951
+ // \u660E\u793A\u7684\u306A x/y \u6307\u5B9A\uFF08fit_to_artboard \u6642\u306F\u4E2D\u592E\u914D\u7F6E\u304C\u512A\u5148\u3055\u308C\u308B\u306E\u3067\u7121\u8996\uFF09
36952
+ if (!(params.fit_to_artboard === true && abRect) &&
36953
+ typeof params.x === "number" && typeof params.y === "number") {
36954
+ var pos = webToAiPoint(params.x, params.y, coordSystem, abRect);
36955
+ translateItems(movables, pos[0] - bounds[0], pos[1] - bounds[1]);
36956
+ bounds = rootItem ? rootItem.geometricBounds : unionBounds(duplicated);
36957
+ }
36958
+
36959
+ var rootUuid = null;
36960
+ if (rootItem) {
36961
+ if (params.name) rootItem.name = params.name;
36962
+ rootUuid = ensureUUID(rootItem);
36963
+ }
36964
+
36965
+ var itemSummaries = [];
36966
+ for (var u = 0; u < duplicated.length; u++) {
36967
+ itemSummaries.push({
36968
+ uuid: ensureUUID(duplicated[u]),
36969
+ type: duplicated[u].typename,
36970
+ name: duplicated[u].name || ""
36971
+ });
36972
+ }
36973
+
36974
+ writeResultFile(RESULT_PATH, {
36975
+ success: true,
36976
+ sourcePath: svgPath,
36977
+ grouped: !!rootItem && duplicated.length > 1,
36978
+ rootUuid: rootUuid,
36979
+ importedCount: duplicated.length,
36980
+ widthPt: bounds[2] - bounds[0],
36981
+ heightPt: bounds[1] - bounds[3],
36982
+ items: itemSummaries,
36983
+ duplicationErrors: dupErrors.length > 0 ? dupErrors : undefined,
36984
+ verified: rootItem ? verifyItem(rootItem, coordSystem, abRect) : null
36985
+ });
36986
+ }
36987
+ }
36988
+ }
36989
+ }
36990
+ }
36991
+ } catch (e) {
36992
+ writeResultFile(RESULT_PATH, { error: true, message: "import_svg_as_editable failed: " + e.message, line: e.line });
36993
+ } finally {
36994
+ // \u60F3\u5B9A\u5916\u306E\u30D1\u30B9\u3067 srcDoc \u304C\u958B\u3044\u305F\u307E\u307E\u306A\u3089\u9589\u3058\u308B
36995
+ if (srcDoc) {
36996
+ try { srcDoc.close(SaveOptions.DONOTSAVECHANGES); } catch (e) {}
36997
+ }
36998
+ if (targetDocRef) {
36999
+ try { app.activeDocument = targetDocRef; } catch (e) {}
37000
+ }
37001
+ }
37002
+ }
37003
+
37004
+ // --- \u30ED\u30FC\u30AB\u30EB\u30D8\u30EB\u30D1\u30FC ---
37005
+
37006
+ function unionBounds(items) {
37007
+ // [left, top, right, bottom]
37008
+ var b = [items[0].geometricBounds[0], items[0].geometricBounds[1],
37009
+ items[0].geometricBounds[2], items[0].geometricBounds[3]];
37010
+ for (var k = 1; k < items.length; k++) {
37011
+ var g = items[k].geometricBounds;
37012
+ if (g[0] < b[0]) b[0] = g[0];
37013
+ if (g[1] > b[1]) b[1] = g[1];
37014
+ if (g[2] > b[2]) b[2] = g[2];
37015
+ if (g[3] < b[3]) b[3] = g[3];
37016
+ }
37017
+ return b;
37018
+ }
37019
+
37020
+ function translateItems(items, dx, dy) {
37021
+ if (dx === 0 && dy === 0) return;
37022
+ for (var i = 0; i < items.length; i++) items[i].translate(dx, dy);
37023
+ }
37024
+
37025
+ function wrapAsGroup(items, parentLayer, shouldGroup) {
37026
+ if (!shouldGroup) return null;
37027
+ if (items.length === 1) return items[0];
37028
+ var group = parentLayer.groupItems.add();
37029
+ // duplicate \u306F PLACEATEND \u3067\u672B\u5C3E\u306B\u7A4D\u307E\u308C\u3066\u3044\u308B\u3002\u30B0\u30EB\u30FC\u30D7\u306B\u79FB\u3059\u3068\u7A4D\u307F\u9806\u304C\u53CD\u8EE2\u3059\u308B\u305F\u3081\u3001
37030
+ // \u9006\u9806\u306B moveToBeginning \u3059\u308B\u3053\u3068\u3067\u5143\u306E z-order \u3092\u4FDD\u3064\u3002
37031
+ for (var i = items.length - 1; i >= 0; i--) {
37032
+ items[i].moveToBeginning(group);
37033
+ }
37034
+ return group;
37035
+ }
37036
+
37037
+ function fitItemsToArtboard(items, bounds, abRect, pad) {
37038
+ var abW = abRect[2] - abRect[0];
37039
+ var abH = abRect[1] - abRect[3];
37040
+ var availW = abW - pad * 2;
37041
+ var availH = abH - pad * 2;
37042
+ var w = bounds[2] - bounds[0];
37043
+ var h = bounds[1] - bounds[3];
37044
+ if (w <= 0 || h <= 0 || availW <= 0 || availH <= 0) return;
37045
+
37046
+ var scalePct = Math.min(availW / w, availH / h) * 100;
37047
+ for (var i = 0; i < items.length; i++) items[i].resize(scalePct, scalePct);
37048
+
37049
+ // \u30EA\u30B5\u30A4\u30BA\u5F8C\u306B\u30D0\u30A6\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u53D6\u308A\u76F4\u3057\u3066\u4E2D\u592E\u914D\u7F6E
37050
+ var newB = (items.length === 1) ? items[0].geometricBounds : unionBounds(items);
37051
+ var newW = newB[2] - newB[0];
37052
+ var newH = newB[1] - newB[3];
37053
+ var targetLeft = abRect[0] + (abW - newW) / 2;
37054
+ var targetTop = abRect[1] - (abH - newH) / 2;
37055
+ translateItems(items, targetLeft - newB[0], targetTop - newB[1]);
37056
+ }
37057
+ `;
37058
+ function register35(server) {
37059
+ server.registerTool(
37060
+ "import_svg_as_editable",
37061
+ {
37062
+ title: "Import SVG as Editable",
37063
+ description: "Import an SVG file into the active document as editable Illustrator paths/text/groups (NOT as a linked image). Internally opens the SVG as a temporary document, duplicates its contents into the target document, then closes the source. Use this instead of place_image for SVG. Note: Illustrator will be activated (brought to foreground) during execution.",
37064
+ inputSchema: {
37065
+ file_path: external_exports.string().describe("Absolute path to the .svg or .svgz file"),
37066
+ x: external_exports.number().optional().describe("X position of the imported content (top-left of bounding box). Ignored when fit_to_artboard is true."),
37067
+ y: external_exports.number().optional().describe("Y position of the imported content (top-left of bounding box). Ignored when fit_to_artboard is true."),
37068
+ layer_name: external_exports.string().optional().describe("Target layer name in the active document. Created if missing."),
37069
+ group: external_exports.boolean().optional().default(true).describe("Wrap imported items in a single GroupItem (default: true). Set false to keep items flat in the target layer."),
37070
+ fit_to_artboard: external_exports.boolean().optional().default(false).describe("Scale and center the imported content to fit the active artboard (default: false)."),
37071
+ padding: external_exports.number().optional().describe("Padding in points from the artboard edges when fit_to_artboard is true."),
37072
+ name: external_exports.string().optional().describe("Name to assign to the root group (only when group=true and multiple items are imported)."),
37073
+ coordinate_system: coordinateSystemSchema
37074
+ },
37075
+ annotations: WRITE_ANNOTATIONS
37076
+ },
37077
+ async (params) => {
37078
+ return executeToolJsx(jsxCode33, params, { activate: true, resolveCoordinate: true });
37079
+ }
37080
+ );
37081
+ }
37082
+
37083
+ // src/tools/modify/resize-for-variation.ts
37084
+ var jsxCode34 = `
36749
37085
  var preflight = preflightChecks();
36750
37086
  if (preflight) {
36751
37087
  writeResultFile(RESULT_PATH, preflight);
@@ -36879,7 +37215,7 @@ if (preflight) {
36879
37215
  }
36880
37216
  }
36881
37217
  `;
36882
- function register35(server) {
37218
+ function register36(server) {
36883
37219
  server.registerTool(
36884
37220
  "resize_for_variation",
36885
37221
  {
@@ -36900,13 +37236,13 @@ function register35(server) {
36900
37236
  annotations: WRITE_ANNOTATIONS
36901
37237
  },
36902
37238
  async (params) => {
36903
- return executeToolJsx(jsxCode33, params, { heavy: true, resolveCoordinate: true });
37239
+ return executeToolJsx(jsxCode34, params, { heavy: true, resolveCoordinate: true });
36904
37240
  }
36905
37241
  );
36906
37242
  }
36907
37243
 
36908
37244
  // src/tools/modify/align-objects.ts
36909
- var jsxCode34 = `
37245
+ var jsxCode35 = `
36910
37246
  var preflight = preflightChecks();
36911
37247
  if (preflight) {
36912
37248
  writeResultFile(RESULT_PATH, preflight);
@@ -37069,7 +37405,7 @@ if (preflight) {
37069
37405
  }
37070
37406
  }
37071
37407
  `;
37072
- function register36(server) {
37408
+ function register37(server) {
37073
37409
  server.registerTool(
37074
37410
  "align_objects",
37075
37411
  {
@@ -37085,13 +37421,13 @@ function register36(server) {
37085
37421
  annotations: WRITE_ANNOTATIONS
37086
37422
  },
37087
37423
  async (params) => {
37088
- return executeToolJsx(jsxCode34, params, { resolveCoordinate: true });
37424
+ return executeToolJsx(jsxCode35, params, { resolveCoordinate: true });
37089
37425
  }
37090
37426
  );
37091
37427
  }
37092
37428
 
37093
37429
  // src/tools/modify/replace-color.ts
37094
- var jsxCode35 = `
37430
+ var jsxCode36 = `
37095
37431
  ${COLOR_HELPERS_JSX}
37096
37432
 
37097
37433
  var preflight = preflightChecks();
@@ -37187,7 +37523,7 @@ if (preflight) {
37187
37523
  }
37188
37524
  }
37189
37525
  `;
37190
- function register37(server) {
37526
+ function register38(server) {
37191
37527
  server.registerTool(
37192
37528
  "replace_color",
37193
37529
  {
@@ -37203,14 +37539,14 @@ function register37(server) {
37203
37539
  annotations: DESTRUCTIVE_ANNOTATIONS
37204
37540
  },
37205
37541
  async (params) => {
37206
- const result = await executeJsx(jsxCode35, params);
37542
+ const result = await executeJsx(jsxCode36, params);
37207
37543
  return formatToolResult(result);
37208
37544
  }
37209
37545
  );
37210
37546
  }
37211
37547
 
37212
37548
  // src/tools/modify/manage-layers.ts
37213
- var jsxCode36 = `
37549
+ var jsxCode37 = `
37214
37550
  var preflight = preflightChecks();
37215
37551
  if (preflight) {
37216
37552
  writeResultFile(RESULT_PATH, preflight);
@@ -37315,7 +37651,7 @@ if (preflight) {
37315
37651
  }
37316
37652
  }
37317
37653
  `;
37318
- function register38(server) {
37654
+ function register39(server) {
37319
37655
  server.registerTool(
37320
37656
  "manage_layers",
37321
37657
  {
@@ -37331,14 +37667,14 @@ function register38(server) {
37331
37667
  annotations: DESTRUCTIVE_ANNOTATIONS
37332
37668
  },
37333
37669
  async (params) => {
37334
- const result = await executeJsx(jsxCode36, params);
37670
+ const result = await executeJsx(jsxCode37, params);
37335
37671
  return formatToolResult(result);
37336
37672
  }
37337
37673
  );
37338
37674
  }
37339
37675
 
37340
37676
  // src/tools/modify/place-color-chips.ts
37341
- var jsxCode37 = `
37677
+ var jsxCode38 = `
37342
37678
  var preflight = preflightChecks();
37343
37679
  if (preflight) {
37344
37680
  writeResultFile(RESULT_PATH, preflight);
@@ -37513,7 +37849,7 @@ if (preflight) {
37513
37849
  }
37514
37850
  }
37515
37851
  `;
37516
- function register39(server) {
37852
+ function register40(server) {
37517
37853
  server.registerTool(
37518
37854
  "place_color_chips",
37519
37855
  {
@@ -37530,13 +37866,13 @@ function register39(server) {
37530
37866
  annotations: WRITE_ANNOTATIONS
37531
37867
  },
37532
37868
  async (params) => {
37533
- return executeToolJsx(jsxCode37, params, { heavy: true, resolveCoordinate: true });
37869
+ return executeToolJsx(jsxCode38, params, { heavy: true, resolveCoordinate: true });
37534
37870
  }
37535
37871
  );
37536
37872
  }
37537
37873
 
37538
37874
  // src/tools/modify/place-style-guide.ts
37539
- var jsxCode38 = `
37875
+ var jsxCode39 = `
37540
37876
  // \u2500\u2500\u2500 Helper functions (top-level for ES3 compatibility) \u2500\u2500\u2500
37541
37877
  function makeTextColor(isCMYK) {
37542
37878
  if (isCMYK) {
@@ -38321,7 +38657,7 @@ if (preflight) {
38321
38657
  }
38322
38658
  }
38323
38659
  `;
38324
- function register40(server) {
38660
+ function register41(server) {
38325
38661
  server.registerTool(
38326
38662
  "place_style_guide",
38327
38663
  {
@@ -38336,13 +38672,13 @@ function register40(server) {
38336
38672
  annotations: WRITE_ANNOTATIONS
38337
38673
  },
38338
38674
  async (params) => {
38339
- return executeToolJsx(jsxCode38, params, { heavy: true, resolveCoordinate: true });
38675
+ return executeToolJsx(jsxCode39, params, { heavy: true, resolveCoordinate: true });
38340
38676
  }
38341
38677
  );
38342
38678
  }
38343
38679
 
38344
38680
  // src/tools/modify/create-crop-marks.ts
38345
- var jsxCode39 = `
38681
+ var jsxCode40 = `
38346
38682
  var preflight = preflightChecks();
38347
38683
  if (preflight) {
38348
38684
  writeResultFile(RESULT_PATH, preflight);
@@ -38510,7 +38846,7 @@ if (preflight) {
38510
38846
  }
38511
38847
  }
38512
38848
  `;
38513
- function register41(server) {
38849
+ function register42(server) {
38514
38850
  server.registerTool(
38515
38851
  "create_crop_marks",
38516
38852
  {
@@ -38531,7 +38867,7 @@ function register41(server) {
38531
38867
  annotations: WRITE_ANNOTATIONS
38532
38868
  },
38533
38869
  async (params) => {
38534
- const result = await executeToolJsx(jsxCode39, params, { activate: true });
38870
+ const result = await executeToolJsx(jsxCode40, params, { activate: true });
38535
38871
  const coordSystem = await resolveCoordinateSystem(void 0);
38536
38872
  const coordNote = coordSystem === "document" ? "document (Y-up, origin at bottom-left)" : "artboard-web (Y-down, origin at top-left)";
38537
38873
  for (const item of result.content) {
@@ -38553,7 +38889,7 @@ function register41(server) {
38553
38889
  }
38554
38890
 
38555
38891
  // src/tools/modify/create-document.ts
38556
- var jsxCode40 = `
38892
+ var jsxCode41 = `
38557
38893
  try {
38558
38894
  var verErr = checkIllustratorVersion();
38559
38895
  if (verErr) {
@@ -38583,7 +38919,7 @@ try {
38583
38919
  writeResultFile(RESULT_PATH, { error: true, message: "Failed to create document: " + e.message, line: e.line });
38584
38920
  }
38585
38921
  `;
38586
- function register42(server) {
38922
+ function register43(server) {
38587
38923
  server.registerTool(
38588
38924
  "create_document",
38589
38925
  {
@@ -38597,7 +38933,7 @@ function register42(server) {
38597
38933
  annotations: WRITE_ANNOTATIONS
38598
38934
  },
38599
38935
  async (params) => {
38600
- const result = await executeJsx(jsxCode40, params, { activate: true });
38936
+ const result = await executeJsx(jsxCode41, params, { activate: true });
38601
38937
  invalidateAutoDetectCache();
38602
38938
  return formatToolResult(result);
38603
38939
  }
@@ -38605,7 +38941,7 @@ function register42(server) {
38605
38941
  }
38606
38942
 
38607
38943
  // src/tools/modify/close-document.ts
38608
- var jsxCode41 = `
38944
+ var jsxCode42 = `
38609
38945
  try {
38610
38946
  var verErr = checkIllustratorVersion();
38611
38947
  if (verErr) {
@@ -38626,7 +38962,7 @@ try {
38626
38962
  writeResultFile(RESULT_PATH, { error: true, message: "Failed to close document: " + e.message, line: e.line });
38627
38963
  }
38628
38964
  `;
38629
- function register43(server) {
38965
+ function register44(server) {
38630
38966
  server.registerTool(
38631
38967
  "close_document",
38632
38968
  {
@@ -38638,7 +38974,7 @@ function register43(server) {
38638
38974
  annotations: DESTRUCTIVE_ANNOTATIONS
38639
38975
  },
38640
38976
  async (params) => {
38641
- const result = await executeJsx(jsxCode41, params, { activate: true });
38977
+ const result = await executeJsx(jsxCode42, params, { activate: true });
38642
38978
  invalidateAutoDetectCache();
38643
38979
  return formatToolResult(result);
38644
38980
  }
@@ -38646,7 +38982,7 @@ function register43(server) {
38646
38982
  }
38647
38983
 
38648
38984
  // src/tools/modify/save-document.ts
38649
- var jsxCode42 = `
38985
+ var jsxCode43 = `
38650
38986
  var preflight = preflightChecks();
38651
38987
  if (preflight) {
38652
38988
  writeResultFile(RESULT_PATH, preflight);
@@ -38694,7 +39030,7 @@ if (preflight) {
38694
39030
  }
38695
39031
  }
38696
39032
  `;
38697
- function register44(server) {
39033
+ function register45(server) {
38698
39034
  server.registerTool(
38699
39035
  "save_document",
38700
39036
  {
@@ -38707,14 +39043,14 @@ function register44(server) {
38707
39043
  annotations: WRITE_IDEMPOTENT_ANNOTATIONS
38708
39044
  },
38709
39045
  async (params) => {
38710
- const result = await executeJsx(jsxCode42, params, { activate: true });
39046
+ const result = await executeJsx(jsxCode43, params, { activate: true });
38711
39047
  return formatToolResult(result);
38712
39048
  }
38713
39049
  );
38714
39050
  }
38715
39051
 
38716
39052
  // src/tools/modify/open-document.ts
38717
- var jsxCode43 = `
39053
+ var jsxCode44 = `
38718
39054
  try {
38719
39055
  var verErr = checkIllustratorVersion();
38720
39056
  if (verErr) {
@@ -38753,7 +39089,7 @@ try {
38753
39089
  writeResultFile(RESULT_PATH, { error: true, message: "open_document failed: " + e.message, line: e.line });
38754
39090
  }
38755
39091
  `;
38756
- function register45(server) {
39092
+ function register46(server) {
38757
39093
  server.registerTool(
38758
39094
  "open_document",
38759
39095
  {
@@ -38766,7 +39102,7 @@ function register45(server) {
38766
39102
  annotations: WRITE_ANNOTATIONS
38767
39103
  },
38768
39104
  async (params) => {
38769
- const result = await executeJsx(jsxCode43, params, { activate: true });
39105
+ const result = await executeJsx(jsxCode44, params, { activate: true });
38770
39106
  invalidateAutoDetectCache();
38771
39107
  return formatToolResult(result);
38772
39108
  }
@@ -38774,7 +39110,7 @@ function register45(server) {
38774
39110
  }
38775
39111
 
38776
39112
  // src/tools/modify/group-objects.ts
38777
- var jsxCode44 = `
39113
+ var jsxCode45 = `
38778
39114
  var preflight = preflightChecks();
38779
39115
  if (preflight) {
38780
39116
  writeResultFile(RESULT_PATH, preflight);
@@ -38822,7 +39158,7 @@ if (preflight) {
38822
39158
  }
38823
39159
  }
38824
39160
  `;
38825
- function register46(server) {
39161
+ function register47(server) {
38826
39162
  server.registerTool(
38827
39163
  "group_objects",
38828
39164
  {
@@ -38836,14 +39172,14 @@ function register46(server) {
38836
39172
  annotations: WRITE_ANNOTATIONS
38837
39173
  },
38838
39174
  async (params) => {
38839
- const result = await executeJsx(jsxCode44, params, { activate: true });
39175
+ const result = await executeJsx(jsxCode45, params, { activate: true });
38840
39176
  return formatToolResult(result);
38841
39177
  }
38842
39178
  );
38843
39179
  }
38844
39180
 
38845
39181
  // src/tools/modify/ungroup-objects.ts
38846
- var jsxCode45 = `
39182
+ var jsxCode46 = `
38847
39183
  var preflight = preflightChecks();
38848
39184
  if (preflight) {
38849
39185
  writeResultFile(RESULT_PATH, preflight);
@@ -38886,7 +39222,7 @@ if (preflight) {
38886
39222
  }
38887
39223
  }
38888
39224
  `;
38889
- function register47(server) {
39225
+ function register48(server) {
38890
39226
  server.registerTool(
38891
39227
  "ungroup_objects",
38892
39228
  {
@@ -38898,14 +39234,14 @@ function register47(server) {
38898
39234
  annotations: DESTRUCTIVE_ANNOTATIONS
38899
39235
  },
38900
39236
  async (params) => {
38901
- const result = await executeJsx(jsxCode45, params, { activate: true });
39237
+ const result = await executeJsx(jsxCode46, params, { activate: true });
38902
39238
  return formatToolResult(result);
38903
39239
  }
38904
39240
  );
38905
39241
  }
38906
39242
 
38907
39243
  // src/tools/modify/duplicate-objects.ts
38908
- var jsxCode46 = `
39244
+ var jsxCode47 = `
38909
39245
  var preflight = preflightChecks();
38910
39246
  if (preflight) {
38911
39247
  writeResultFile(RESULT_PATH, preflight);
@@ -38977,7 +39313,7 @@ if (preflight) {
38977
39313
  }
38978
39314
  }
38979
39315
  `;
38980
- function register48(server) {
39316
+ function register49(server) {
38981
39317
  server.registerTool(
38982
39318
  "duplicate_objects",
38983
39319
  {
@@ -38995,14 +39331,14 @@ function register48(server) {
38995
39331
  annotations: WRITE_ANNOTATIONS
38996
39332
  },
38997
39333
  async (params) => {
38998
- const result = await executeJsx(jsxCode46, params, { activate: true });
39334
+ const result = await executeJsx(jsxCode47, params, { activate: true });
38999
39335
  return formatToolResult(result);
39000
39336
  }
39001
39337
  );
39002
39338
  }
39003
39339
 
39004
39340
  // src/tools/read/list-fonts.ts
39005
- var jsxCode47 = `
39341
+ var jsxCode48 = `
39006
39342
  try {
39007
39343
  var verErr = checkIllustratorVersion();
39008
39344
  if (verErr) {
@@ -39040,7 +39376,7 @@ try {
39040
39376
  writeResultFile(RESULT_PATH, { error: true, message: "list_fonts failed: " + e.message, line: e.line });
39041
39377
  }
39042
39378
  `;
39043
- function register49(server) {
39379
+ function register50(server) {
39044
39380
  server.registerTool(
39045
39381
  "list_fonts",
39046
39382
  {
@@ -39053,14 +39389,14 @@ function register49(server) {
39053
39389
  annotations: READ_ANNOTATIONS
39054
39390
  },
39055
39391
  async (params) => {
39056
- const result = await executeJsx(jsxCode47, params);
39392
+ const result = await executeJsx(jsxCode48, params);
39057
39393
  return formatToolResult(result);
39058
39394
  }
39059
39395
  );
39060
39396
  }
39061
39397
 
39062
39398
  // src/tools/modify/manage-artboards.ts
39063
- var jsxCode48 = `
39399
+ var jsxCode49 = `
39064
39400
  var preflight = preflightChecks();
39065
39401
  if (preflight) {
39066
39402
  writeResultFile(RESULT_PATH, preflight);
@@ -39155,7 +39491,7 @@ if (preflight) {
39155
39491
  }
39156
39492
  }
39157
39493
  `;
39158
- function register50(server) {
39494
+ function register51(server) {
39159
39495
  server.registerTool(
39160
39496
  "manage_artboards",
39161
39497
  {
@@ -39178,14 +39514,14 @@ function register50(server) {
39178
39514
  annotations: DESTRUCTIVE_ANNOTATIONS
39179
39515
  },
39180
39516
  async (params) => {
39181
- const result = await executeJsx(jsxCode48, params, { activate: true });
39517
+ const result = await executeJsx(jsxCode49, params, { activate: true });
39182
39518
  return formatToolResult(result);
39183
39519
  }
39184
39520
  );
39185
39521
  }
39186
39522
 
39187
39523
  // src/tools/modify/set-z-order.ts
39188
- var jsxCode49 = `
39524
+ var jsxCode50 = `
39189
39525
  var preflight = preflightChecks();
39190
39526
  if (preflight) {
39191
39527
  writeResultFile(RESULT_PATH, preflight);
@@ -39217,7 +39553,7 @@ if (preflight) {
39217
39553
  }
39218
39554
  }
39219
39555
  `;
39220
- function register51(server) {
39556
+ function register52(server) {
39221
39557
  server.registerTool(
39222
39558
  "set_z_order",
39223
39559
  {
@@ -39230,14 +39566,14 @@ function register51(server) {
39230
39566
  annotations: WRITE_ANNOTATIONS
39231
39567
  },
39232
39568
  async (params) => {
39233
- const result = await executeJsx(jsxCode49, params, { activate: true });
39569
+ const result = await executeJsx(jsxCode50, params, { activate: true });
39234
39570
  return formatToolResult(result);
39235
39571
  }
39236
39572
  );
39237
39573
  }
39238
39574
 
39239
39575
  // src/tools/modify/move-to-layer.ts
39240
- var jsxCode50 = `
39576
+ var jsxCode51 = `
39241
39577
  var preflight = preflightChecks();
39242
39578
  if (preflight) {
39243
39579
  writeResultFile(RESULT_PATH, preflight);
@@ -39284,7 +39620,7 @@ if (preflight) {
39284
39620
  }
39285
39621
  }
39286
39622
  `;
39287
- function register52(server) {
39623
+ function register53(server) {
39288
39624
  server.registerTool(
39289
39625
  "move_to_layer",
39290
39626
  {
@@ -39298,7 +39634,7 @@ function register52(server) {
39298
39634
  annotations: WRITE_ANNOTATIONS
39299
39635
  },
39300
39636
  async (params) => {
39301
- const result = await executeJsx(jsxCode50, params, { activate: true });
39637
+ const result = await executeJsx(jsxCode51, params, { activate: true });
39302
39638
  return formatToolResult(result);
39303
39639
  }
39304
39640
  );
@@ -39369,7 +39705,7 @@ if (preflight) {
39369
39705
  }
39370
39706
  }
39371
39707
  `;
39372
- function register53(server) {
39708
+ function register54(server) {
39373
39709
  server.registerTool(
39374
39710
  "apply_graphic_style",
39375
39711
  {
@@ -39403,7 +39739,7 @@ function register53(server) {
39403
39739
  }
39404
39740
 
39405
39741
  // src/tools/modify/manage-swatches.ts
39406
- var jsxCode51 = `
39742
+ var jsxCode52 = `
39407
39743
  ${COLOR_HELPERS_JSX}
39408
39744
 
39409
39745
  var preflight = preflightChecks();
@@ -39450,7 +39786,7 @@ if (preflight) {
39450
39786
  }
39451
39787
  }
39452
39788
  `;
39453
- function register54(server) {
39789
+ function register55(server) {
39454
39790
  server.registerTool(
39455
39791
  "manage_swatches",
39456
39792
  {
@@ -39464,7 +39800,7 @@ function register54(server) {
39464
39800
  annotations: DESTRUCTIVE_ANNOTATIONS
39465
39801
  },
39466
39802
  async (params) => {
39467
- const result = await executeJsx(jsxCode51, params, { activate: true });
39803
+ const result = await executeJsx(jsxCode52, params, { activate: true });
39468
39804
  return formatToolResult(result);
39469
39805
  }
39470
39806
  );
@@ -39546,7 +39882,7 @@ if (preflight) {
39546
39882
  }
39547
39883
  }
39548
39884
  `;
39549
- function register55(server) {
39885
+ function register56(server) {
39550
39886
  server.registerTool(
39551
39887
  "apply_text_style",
39552
39888
  {
@@ -39581,7 +39917,7 @@ function register55(server) {
39581
39917
  }
39582
39918
 
39583
39919
  // src/tools/modify/create-gradient.ts
39584
- var jsxCode52 = `
39920
+ var jsxCode53 = `
39585
39921
  ${COLOR_HELPERS_JSX}
39586
39922
 
39587
39923
  var preflight = preflightChecks();
@@ -39646,7 +39982,7 @@ if (preflight) {
39646
39982
  }
39647
39983
  `;
39648
39984
  var stopColorSchema = external_exports.discriminatedUnion("type", [cmykColorSchema, rgbColorSchema, grayColorSchema]);
39649
- function register56(server) {
39985
+ function register57(server) {
39650
39986
  server.registerTool(
39651
39987
  "create_gradient",
39652
39988
  {
@@ -39669,14 +40005,14 @@ function register56(server) {
39669
40005
  annotations: WRITE_ANNOTATIONS
39670
40006
  },
39671
40007
  async (params) => {
39672
- const result = await executeJsx(jsxCode52, params, { activate: true });
40008
+ const result = await executeJsx(jsxCode53, params, { activate: true });
39673
40009
  return formatToolResult(result);
39674
40010
  }
39675
40011
  );
39676
40012
  }
39677
40013
 
39678
40014
  // src/tools/modify/manage-linked-images.ts
39679
- var jsxCode53 = `
40015
+ var jsxCode54 = `
39680
40016
  var preflight = preflightChecks();
39681
40017
  if (preflight) {
39682
40018
  writeResultFile(RESULT_PATH, preflight);
@@ -39751,7 +40087,7 @@ if (preflight) {
39751
40087
  }
39752
40088
  }
39753
40089
  `;
39754
- function register57(server) {
40090
+ function register58(server) {
39755
40091
  server.registerTool(
39756
40092
  "manage_linked_images",
39757
40093
  {
@@ -39765,14 +40101,14 @@ function register57(server) {
39765
40101
  annotations: DESTRUCTIVE_ANNOTATIONS
39766
40102
  },
39767
40103
  async (params) => {
39768
- const result = await executeJsx(jsxCode53, params, { activate: true });
40104
+ const result = await executeJsx(jsxCode54, params, { activate: true });
39769
40105
  return formatToolResult(result);
39770
40106
  }
39771
40107
  );
39772
40108
  }
39773
40109
 
39774
40110
  // src/tools/modify/undo.ts
39775
- var jsxCode54 = `
40111
+ var jsxCode55 = `
39776
40112
  try {
39777
40113
  var verErr = checkIllustratorVersion();
39778
40114
  if (verErr) {
@@ -39800,7 +40136,7 @@ try {
39800
40136
  writeResultFile(RESULT_PATH, { error: true, message: "undo failed: " + e.message, line: e.line });
39801
40137
  }
39802
40138
  `;
39803
- function register58(server) {
40139
+ function register59(server) {
39804
40140
  server.registerTool(
39805
40141
  "undo",
39806
40142
  {
@@ -39813,14 +40149,14 @@ function register58(server) {
39813
40149
  annotations: DESTRUCTIVE_ANNOTATIONS
39814
40150
  },
39815
40151
  async (params) => {
39816
- const result = await executeJsx(jsxCode54, params, { activate: true });
40152
+ const result = await executeJsx(jsxCode55, params, { activate: true });
39817
40153
  return formatToolResult(result);
39818
40154
  }
39819
40155
  );
39820
40156
  }
39821
40157
 
39822
40158
  // src/tools/modify/manage-datasets.ts
39823
- var jsxCode55 = `
40159
+ var jsxCode56 = `
39824
40160
  function parseCsvLine(line) {
39825
40161
  var result = [];
39826
40162
  var current = "";
@@ -40103,7 +40439,7 @@ if (preflight) {
40103
40439
  }
40104
40440
  }
40105
40441
  `;
40106
- function register59(server) {
40442
+ function register60(server) {
40107
40443
  server.registerTool(
40108
40444
  "manage_datasets",
40109
40445
  {
@@ -40129,14 +40465,14 @@ function register59(server) {
40129
40465
  annotations: WRITE_ANNOTATIONS
40130
40466
  },
40131
40467
  async (params) => {
40132
- const result = await executeJsx(jsxCode55, params, { activate: true });
40468
+ const result = await executeJsx(jsxCode56, params, { activate: true });
40133
40469
  return formatToolResult(result);
40134
40470
  }
40135
40471
  );
40136
40472
  }
40137
40473
 
40138
40474
  // src/tools/modify/place-symbol.ts
40139
- var jsxCode56 = `
40475
+ var jsxCode57 = `
40140
40476
  var preflight = preflightChecks();
40141
40477
  if (preflight) {
40142
40478
  writeResultFile(RESULT_PATH, preflight);
@@ -40191,7 +40527,7 @@ if (preflight) {
40191
40527
  }
40192
40528
  }
40193
40529
  `;
40194
- function register60(server) {
40530
+ function register61(server) {
40195
40531
  server.registerTool(
40196
40532
  "place_symbol",
40197
40533
  {
@@ -40208,14 +40544,14 @@ function register60(server) {
40208
40544
  annotations: WRITE_ANNOTATIONS
40209
40545
  },
40210
40546
  async (params) => {
40211
- const result = await executeJsx(jsxCode56, params, { activate: true });
40547
+ const result = await executeJsx(jsxCode57, params, { activate: true });
40212
40548
  return formatToolResult(result);
40213
40549
  }
40214
40550
  );
40215
40551
  }
40216
40552
 
40217
40553
  // src/tools/modify/create-path-text.ts
40218
- var jsxCode57 = `
40554
+ var jsxCode58 = `
40219
40555
  var preflight = preflightChecks();
40220
40556
  if (preflight) {
40221
40557
  writeResultFile(RESULT_PATH, preflight);
@@ -40267,7 +40603,7 @@ if (preflight) {
40267
40603
  }
40268
40604
  }
40269
40605
  `;
40270
- function register61(server) {
40606
+ function register62(server) {
40271
40607
  server.registerTool(
40272
40608
  "create_path_text",
40273
40609
  {
@@ -40286,14 +40622,14 @@ function register61(server) {
40286
40622
  annotations: WRITE_ANNOTATIONS
40287
40623
  },
40288
40624
  async (params) => {
40289
- const result = await executeJsx(jsxCode57, params, { activate: true });
40625
+ const result = await executeJsx(jsxCode58, params, { activate: true });
40290
40626
  return formatToolResult(result);
40291
40627
  }
40292
40628
  );
40293
40629
  }
40294
40630
 
40295
40631
  // src/tools/modify/select-objects.ts
40296
- var jsxCode58 = `
40632
+ var jsxCode59 = `
40297
40633
  var preflight = preflightChecks();
40298
40634
  if (preflight) {
40299
40635
  writeResultFile(RESULT_PATH, preflight);
@@ -40343,7 +40679,7 @@ if (preflight) {
40343
40679
  }
40344
40680
  }
40345
40681
  `;
40346
- function register62(server) {
40682
+ function register63(server) {
40347
40683
  server.registerTool(
40348
40684
  "select_objects",
40349
40685
  {
@@ -40357,14 +40693,14 @@ function register62(server) {
40357
40693
  annotations: WRITE_IDEMPOTENT_ANNOTATIONS
40358
40694
  },
40359
40695
  async (params) => {
40360
- const result = await executeJsx(jsxCode58, params, { activate: true });
40696
+ const result = await executeJsx(jsxCode59, params, { activate: true });
40361
40697
  return formatToolResult(result);
40362
40698
  }
40363
40699
  );
40364
40700
  }
40365
40701
 
40366
40702
  // src/tools/read/convert-coordinate.ts
40367
- var jsxCode59 = `
40703
+ var jsxCode60 = `
40368
40704
  var preflight = preflightChecks();
40369
40705
  if (preflight) {
40370
40706
  writeResultFile(RESULT_PATH, preflight);
@@ -40401,7 +40737,7 @@ if (preflight) {
40401
40737
  }
40402
40738
  }
40403
40739
  `;
40404
- function register63(server) {
40740
+ function register64(server) {
40405
40741
  server.registerTool(
40406
40742
  "convert_coordinate",
40407
40743
  {
@@ -40418,7 +40754,7 @@ function register63(server) {
40418
40754
  annotations: READ_ANNOTATIONS
40419
40755
  },
40420
40756
  async (params) => {
40421
- const result = await executeJsx(jsxCode59, params);
40757
+ const result = await executeJsx(jsxCode60, params);
40422
40758
  return formatToolResult(result);
40423
40759
  }
40424
40760
  );
@@ -40489,10 +40825,11 @@ function registerAllTools(server) {
40489
40825
  register61(server);
40490
40826
  register62(server);
40491
40827
  register63(server);
40828
+ register64(server);
40492
40829
  }
40493
40830
 
40494
40831
  // src/prompts/quick-layout.ts
40495
- function register64(server) {
40832
+ function register65(server) {
40496
40833
  server.registerPrompt(
40497
40834
  "quick-layout",
40498
40835
  {
@@ -40535,7 +40872,7 @@ Always respond in the user's language.`
40535
40872
  }
40536
40873
 
40537
40874
  // src/prompts/print-preflight-workflow.ts
40538
- function register65(server) {
40875
+ function register66(server) {
40539
40876
  server.registerPrompt(
40540
40877
  "print-preflight-workflow",
40541
40878
  {
@@ -40588,8 +40925,8 @@ Always respond in the user's language.`
40588
40925
 
40589
40926
  // src/prompts/registry.ts
40590
40927
  function registerAllPrompts(server) {
40591
- register64(server);
40592
40928
  register65(server);
40929
+ register66(server);
40593
40930
  }
40594
40931
 
40595
40932
  // src/server.ts