mcp-music-studio 0.4.2 → 0.4.3

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/index.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -3400,7 +3418,7 @@ var require_dbcs_codec = __commonJS((exports) => {
3400
3418
  if (resCode !== undefined) {
3401
3419
  dbcsCode = resCode;
3402
3420
  nextChar = uCode;
3403
- } else {}
3421
+ }
3404
3422
  }
3405
3423
  seqObj = undefined;
3406
3424
  } else if (uCode >= 0) {
@@ -3465,7 +3483,7 @@ var require_dbcs_codec = __commonJS((exports) => {
3465
3483
  newBuf[j++] = dbcsCode >> 8;
3466
3484
  newBuf[j++] = dbcsCode & 255;
3467
3485
  }
3468
- } else {}
3486
+ }
3469
3487
  this.seqObj = undefined;
3470
3488
  }
3471
3489
  if (this.leadSurrogate !== -1) {
@@ -5098,14 +5116,14 @@ var require_lib = __commonJS((exports, module) => {
5098
5116
  exports.encodings = null;
5099
5117
  exports.defaultCharUnicode = "�";
5100
5118
  exports.defaultCharSingleByte = "?";
5101
- exports.encode = function encode(str, encoding, options) {
5119
+ exports.encode = function encode2(str, encoding, options) {
5102
5120
  str = "" + (str || "");
5103
5121
  var encoder = exports.getEncoder(encoding, options);
5104
5122
  var res = encoder.write(str);
5105
5123
  var trail = encoder.end();
5106
5124
  return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
5107
5125
  };
5108
- exports.decode = function decode(buf, encoding, options) {
5126
+ exports.decode = function decode2(buf, encoding, options) {
5109
5127
  if (typeof buf === "string") {
5110
5128
  if (!exports.skipDecodeWarning) {
5111
5129
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
@@ -15077,17 +15095,6 @@ var require_db = __commonJS((exports, module) => {
15077
15095
  };
15078
15096
  });
15079
15097
 
15080
- // node_modules/mime-db/index.js
15081
- var require_mime_db = __commonJS((exports, module) => {
15082
- /*!
15083
- * mime-db
15084
- * Copyright(c) 2014 Jonathan Ong
15085
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
15086
- * MIT Licensed
15087
- */
15088
- module.exports = require_db();
15089
- });
15090
-
15091
15098
  // node_modules/mime-types/mimeScore.js
15092
15099
  var require_mimeScore = __commonJS((exports, module) => {
15093
15100
  var FACET_SCORES = {
@@ -15132,7 +15139,7 @@ var require_mime_types = __commonJS((exports) => {
15132
15139
  * Copyright(c) 2015 Douglas Christopher Wilson
15133
15140
  * MIT Licensed
15134
15141
  */
15135
- var db = require_mime_db();
15142
+ var db = require_db();
15136
15143
  var extname = __require("path").extname;
15137
15144
  var mimeScore = require_mimeScore();
15138
15145
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
@@ -16419,7 +16426,7 @@ var require_round = __commonJS((exports, module) => {
16419
16426
 
16420
16427
  // node_modules/math-intrinsics/isNaN.js
16421
16428
  var require_isNaN = __commonJS((exports, module) => {
16422
- module.exports = Number.isNaN || function isNaN(a) {
16429
+ module.exports = Number.isNaN || function isNaN2(a) {
16423
16430
  return a !== a;
16424
16431
  };
16425
16432
  });
@@ -16553,7 +16560,7 @@ var require_implementation = __commonJS((exports, module) => {
16553
16560
  var toStr = Object.prototype.toString;
16554
16561
  var max = Math.max;
16555
16562
  var funcType = "[object Function]";
16556
- var concatty = function concatty(a, b) {
16563
+ var concatty = function concatty2(a, b) {
16557
16564
  var arr = [];
16558
16565
  for (var i = 0;i < a.length; i += 1) {
16559
16566
  arr[i] = a[i];
@@ -16563,7 +16570,7 @@ var require_implementation = __commonJS((exports, module) => {
16563
16570
  }
16564
16571
  return arr;
16565
16572
  };
16566
- var slicy = function slicy(arrLike, offset) {
16573
+ var slicy = function slicy2(arrLike, offset) {
16567
16574
  var arr = [];
16568
16575
  for (var i = offset || 0, j = 0;i < arrLike.length; i += 1, j += 1) {
16569
16576
  arr[j] = arrLike[i];
@@ -16604,7 +16611,7 @@ var require_implementation = __commonJS((exports, module) => {
16604
16611
  }
16605
16612
  bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
16606
16613
  if (target.prototype) {
16607
- var Empty = function Empty() {};
16614
+ var Empty = function Empty2() {};
16608
16615
  Empty.prototype = target.prototype;
16609
16616
  bound.prototype = new Empty;
16610
16617
  Empty.prototype = null;
@@ -16843,7 +16850,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16843
16850
  }
16844
16851
  }
16845
16852
  var errorProto;
16846
- var doEval = function doEval(name) {
16853
+ var doEval = function doEval2(name) {
16847
16854
  var value;
16848
16855
  if (name === "%AsyncFunction%") {
16849
16856
  value = getEvalledConstructor("async function () {}");
@@ -16852,12 +16859,12 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16852
16859
  } else if (name === "%AsyncGeneratorFunction%") {
16853
16860
  value = getEvalledConstructor("async function* () {}");
16854
16861
  } else if (name === "%AsyncGenerator%") {
16855
- var fn = doEval("%AsyncGeneratorFunction%");
16862
+ var fn = doEval2("%AsyncGeneratorFunction%");
16856
16863
  if (fn) {
16857
16864
  value = fn.prototype;
16858
16865
  }
16859
16866
  } else if (name === "%AsyncIteratorPrototype%") {
16860
- var gen = doEval("%AsyncGenerator%");
16867
+ var gen = doEval2("%AsyncGenerator%");
16861
16868
  if (gen && getProto) {
16862
16869
  value = getProto(gen.prototype);
16863
16870
  }
@@ -16928,7 +16935,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16928
16935
  var $exec = bind.call($call, RegExp.prototype.exec);
16929
16936
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
16930
16937
  var reEscapeChar = /\\(\\)?/g;
16931
- var stringToPath = function stringToPath(string3) {
16938
+ var stringToPath = function stringToPath2(string3) {
16932
16939
  var first = $strSlice(string3, 0, 1);
16933
16940
  var last = $strSlice(string3, -1);
16934
16941
  if (first === "%" && last !== "%") {
@@ -16942,7 +16949,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16942
16949
  });
16943
16950
  return result;
16944
16951
  };
16945
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
16952
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
16946
16953
  var intrinsicName = name;
16947
16954
  var alias;
16948
16955
  if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
@@ -17227,17 +17234,17 @@ var require_utils2 = __commonJS((exports, module) => {
17227
17234
  var has = Object.prototype.hasOwnProperty;
17228
17235
  var isArray = Array.isArray;
17229
17236
  var overflowChannel = getSideChannel();
17230
- var markOverflow = function markOverflow(obj, maxIndex) {
17237
+ var markOverflow = function markOverflow2(obj, maxIndex) {
17231
17238
  overflowChannel.set(obj, maxIndex);
17232
17239
  return obj;
17233
17240
  };
17234
- var isOverflow = function isOverflow(obj) {
17241
+ var isOverflow = function isOverflow2(obj) {
17235
17242
  return overflowChannel.has(obj);
17236
17243
  };
17237
- var getMaxIndex = function getMaxIndex(obj) {
17244
+ var getMaxIndex = function getMaxIndex2(obj) {
17238
17245
  return overflowChannel.get(obj);
17239
17246
  };
17240
- var setMaxIndex = function setMaxIndex(obj, maxIndex) {
17247
+ var setMaxIndex = function setMaxIndex2(obj, maxIndex) {
17241
17248
  overflowChannel.set(obj, maxIndex);
17242
17249
  };
17243
17250
  var hexTable = function() {
@@ -17247,7 +17254,7 @@ var require_utils2 = __commonJS((exports, module) => {
17247
17254
  }
17248
17255
  return array2;
17249
17256
  }();
17250
- var compactQueue = function compactQueue(queue) {
17257
+ var compactQueue = function compactQueue2(queue) {
17251
17258
  while (queue.length > 1) {
17252
17259
  var item = queue.pop();
17253
17260
  var obj = item.obj[item.prop];
@@ -17262,7 +17269,7 @@ var require_utils2 = __commonJS((exports, module) => {
17262
17269
  }
17263
17270
  }
17264
17271
  };
17265
- var arrayToObject = function arrayToObject(source, options) {
17272
+ var arrayToObject = function arrayToObject2(source, options) {
17266
17273
  var obj = options && options.plainObjects ? { __proto__: null } : {};
17267
17274
  for (var i = 0;i < source.length; ++i) {
17268
17275
  if (typeof source[i] !== "undefined") {
@@ -17271,7 +17278,7 @@ var require_utils2 = __commonJS((exports, module) => {
17271
17278
  }
17272
17279
  return obj;
17273
17280
  };
17274
- var merge2 = function merge(target, source, options) {
17281
+ var merge2 = function merge3(target, source, options) {
17275
17282
  if (!source) {
17276
17283
  return target;
17277
17284
  }
@@ -17322,7 +17329,7 @@ var require_utils2 = __commonJS((exports, module) => {
17322
17329
  if (has.call(target, i)) {
17323
17330
  var targetItem = target[i];
17324
17331
  if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
17325
- target[i] = merge(targetItem, item, options);
17332
+ target[i] = merge3(targetItem, item, options);
17326
17333
  } else {
17327
17334
  target[target.length] = item;
17328
17335
  }
@@ -17335,7 +17342,7 @@ var require_utils2 = __commonJS((exports, module) => {
17335
17342
  return Object.keys(source).reduce(function(acc, key) {
17336
17343
  var value = source[key];
17337
17344
  if (has.call(acc, key)) {
17338
- acc[key] = merge(acc[key], value, options);
17345
+ acc[key] = merge3(acc[key], value, options);
17339
17346
  } else {
17340
17347
  acc[key] = value;
17341
17348
  }
@@ -17369,7 +17376,7 @@ var require_utils2 = __commonJS((exports, module) => {
17369
17376
  }
17370
17377
  };
17371
17378
  var limit = 1024;
17372
- var encode2 = function encode(str, defaultEncoder, charset, kind, format) {
17379
+ var encode2 = function encode3(str, defaultEncoder, charset, kind, format) {
17373
17380
  if (str.length === 0) {
17374
17381
  return str;
17375
17382
  }
@@ -17414,7 +17421,7 @@ var require_utils2 = __commonJS((exports, module) => {
17414
17421
  }
17415
17422
  return out;
17416
17423
  };
17417
- var compact = function compact(value) {
17424
+ var compact = function compact2(value) {
17418
17425
  var queue = [{ obj: { o: value }, prop: "o" }];
17419
17426
  var refs = [];
17420
17427
  for (var i = 0;i < queue.length; ++i) {
@@ -17433,16 +17440,16 @@ var require_utils2 = __commonJS((exports, module) => {
17433
17440
  compactQueue(queue);
17434
17441
  return value;
17435
17442
  };
17436
- var isRegExp = function isRegExp(obj) {
17443
+ var isRegExp = function isRegExp2(obj) {
17437
17444
  return Object.prototype.toString.call(obj) === "[object RegExp]";
17438
17445
  };
17439
- var isBuffer = function isBuffer(obj) {
17446
+ var isBuffer = function isBuffer2(obj) {
17440
17447
  if (!obj || typeof obj !== "object") {
17441
17448
  return false;
17442
17449
  }
17443
17450
  return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
17444
17451
  };
17445
- var combine = function combine(a, b, arrayLimit, plainObjects) {
17452
+ var combine = function combine2(a, b, arrayLimit, plainObjects) {
17446
17453
  if (isOverflow(a)) {
17447
17454
  var newIndex = getMaxIndex(a) + 1;
17448
17455
  a[newIndex] = b;
@@ -17455,7 +17462,7 @@ var require_utils2 = __commonJS((exports, module) => {
17455
17462
  }
17456
17463
  return result;
17457
17464
  };
17458
- var maybeMap = function maybeMap(val, fn) {
17465
+ var maybeMap = function maybeMap2(val, fn) {
17459
17466
  if (isArray(val)) {
17460
17467
  var mapped = [];
17461
17468
  for (var i = 0;i < val.length; i += 1) {
@@ -17529,11 +17536,11 @@ var require_stringify = __commonJS((exports, module) => {
17529
17536
  skipNulls: false,
17530
17537
  strictNullHandling: false
17531
17538
  };
17532
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
17539
+ var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
17533
17540
  return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
17534
17541
  };
17535
17542
  var sentinel = {};
17536
- var stringify = function stringify(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
17543
+ var stringify = function stringify2(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
17537
17544
  var obj = object2;
17538
17545
  var tmpSc = sideChannel;
17539
17546
  var step = 0;
@@ -17609,11 +17616,11 @@ var require_stringify = __commonJS((exports, module) => {
17609
17616
  sideChannel.set(object2, step);
17610
17617
  var valueSideChannel = getSideChannel();
17611
17618
  valueSideChannel.set(sentinel, sideChannel);
17612
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
17619
+ pushToArray(values, stringify2(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
17613
17620
  }
17614
17621
  return values;
17615
17622
  };
17616
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
17623
+ var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
17617
17624
  if (!opts) {
17618
17625
  return defaults;
17619
17626
  }
@@ -17875,7 +17882,7 @@ var require_parse = __commonJS((exports, module) => {
17875
17882
  }
17876
17883
  return leaf;
17877
17884
  };
17878
- var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
17885
+ var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
17879
17886
  var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
17880
17887
  if (options.depth <= 0) {
17881
17888
  if (!options.plainObjects && has.call(Object.prototype, key)) {
@@ -17927,7 +17934,7 @@ var require_parse = __commonJS((exports, module) => {
17927
17934
  }
17928
17935
  return parseObject(keys, val, options, valuesParsed);
17929
17936
  };
17930
- var normalizeParseOptions = function normalizeParseOptions(opts) {
17937
+ var normalizeParseOptions = function normalizeParseOptions2(opts) {
17931
17938
  if (!opts) {
17932
17939
  return defaults;
17933
17940
  }
@@ -18517,7 +18524,7 @@ var require_view = __commonJS((exports, module) => {
18517
18524
  });
18518
18525
  sync = false;
18519
18526
  };
18520
- View.prototype.resolve = function resolve(dir, file) {
18527
+ View.prototype.resolve = function resolve2(dir, file) {
18521
18528
  var ext = this.ext;
18522
18529
  var path2 = join(dir, file);
18523
18530
  var stat = tryStat(path2);
@@ -19772,12 +19779,12 @@ var require_dist = __commonJS((exports) => {
19772
19779
  const { encode: encode2 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
19773
19780
  const data = typeof path === "object" ? path : parse5(path, options);
19774
19781
  const fn = tokensToFunction(data.tokens, delimiter, encode2);
19775
- return function path(params = {}) {
19776
- const [path2, ...missing] = fn(params);
19782
+ return function path2(params = {}) {
19783
+ const [path3, ...missing] = fn(params);
19777
19784
  if (missing.length) {
19778
19785
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
19779
19786
  }
19780
- return path2;
19787
+ return path3;
19781
19788
  };
19782
19789
  }
19783
19790
  function tokensToFunction(tokens, delimiter, encode2) {
@@ -19843,7 +19850,7 @@ var require_dist = __commonJS((exports) => {
19843
19850
  return decode2;
19844
19851
  return (value) => value.split(delimiter).map(decode2);
19845
19852
  });
19846
- return function match(input) {
19853
+ return function match2(input) {
19847
19854
  const m = regexp.exec(input);
19848
19855
  if (!m)
19849
19856
  return false;
@@ -20088,7 +20095,7 @@ var require_layer = __commonJS((exports, module) => {
20088
20095
  }
20089
20096
  };
20090
20097
  Layer.prototype.match = function match(path) {
20091
- let match;
20098
+ let match2;
20092
20099
  if (path != null) {
20093
20100
  if (this.slash) {
20094
20101
  this.params = {};
@@ -20096,19 +20103,19 @@ var require_layer = __commonJS((exports, module) => {
20096
20103
  return true;
20097
20104
  }
20098
20105
  let i = 0;
20099
- while (!match && i < this.matchers.length) {
20100
- match = this.matchers[i](path);
20106
+ while (!match2 && i < this.matchers.length) {
20107
+ match2 = this.matchers[i](path);
20101
20108
  i++;
20102
20109
  }
20103
20110
  }
20104
- if (!match) {
20111
+ if (!match2) {
20105
20112
  this.params = undefined;
20106
20113
  this.path = undefined;
20107
20114
  return false;
20108
20115
  }
20109
- this.params = match.params;
20110
- this.path = match.path;
20111
- this.keys = Object.keys(match.params);
20116
+ this.params = match2.params;
20117
+ this.path = match2.path;
20118
+ this.keys = Object.keys(match2.params);
20112
20119
  return true;
20113
20120
  };
20114
20121
  function decodeParam(val) {
@@ -20476,18 +20483,18 @@ var require_router = __commonJS((exports, module) => {
20476
20483
  return this;
20477
20484
  };
20478
20485
  Router.prototype.route = function route(path) {
20479
- const route = new Route(path);
20486
+ const route2 = new Route(path);
20480
20487
  const layer = new Layer(path, {
20481
20488
  sensitive: this.caseSensitive,
20482
20489
  strict: this.strict,
20483
20490
  end: true
20484
20491
  }, handle);
20485
20492
  function handle(req, res, next) {
20486
- route.dispatch(req, res, next);
20493
+ route2.dispatch(req, res, next);
20487
20494
  }
20488
- layer.route = route;
20495
+ layer.route = route2;
20489
20496
  this.stack.push(layer);
20490
- return route;
20497
+ return route2;
20491
20498
  };
20492
20499
  methods.concat("all").forEach(function(method) {
20493
20500
  Router.prototype[method] = function(path) {
@@ -21086,7 +21093,7 @@ var require_encoding = __commonJS((exports, module) => {
21086
21093
  }
21087
21094
  function preferredEncodings(accept, provided, preferred) {
21088
21095
  var accepts = parseAcceptEncoding(accept || "");
21089
- var comparator = preferred ? function comparator(a, b) {
21096
+ var comparator = preferred ? function comparator2(a, b) {
21090
21097
  if (a.q !== b.q) {
21091
21098
  return b.q - a.q;
21092
21099
  }
@@ -21731,10 +21738,10 @@ var require_request = __commonJS((exports, module) => {
21731
21738
  return accepts(this).languages(...languages);
21732
21739
  };
21733
21740
  req.range = function range(size, options) {
21734
- var range = this.get("Range");
21735
- if (!range)
21741
+ var range2 = this.get("Range");
21742
+ if (!range2)
21736
21743
  return;
21737
- return parseRange(size, range, options);
21744
+ return parseRange(size, range2, options);
21738
21745
  };
21739
21746
  defineGetter(req, "query", function query() {
21740
21747
  var queryparse = this.app.get("query parser fn");
@@ -21782,8 +21789,8 @@ var require_request = __commonJS((exports, module) => {
21782
21789
  if (!hostname)
21783
21790
  return [];
21784
21791
  var offset = this.app.get("subdomain offset");
21785
- var subdomains = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
21786
- return subdomains.slice(offset);
21792
+ var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
21793
+ return subdomains2.slice(offset);
21787
21794
  });
21788
21795
  defineGetter(req, "path", function path() {
21789
21796
  return parse5(this).pathname;
@@ -22253,7 +22260,7 @@ var require_send = __commonJS((exports, module) => {
22253
22260
  this._root = opts.root ? resolve(opts.root) : null;
22254
22261
  }
22255
22262
  util.inherits(SendStream, Stream);
22256
- SendStream.prototype.error = function error(status, err) {
22263
+ SendStream.prototype.error = function error2(status, err) {
22257
22264
  if (hasListeners(this, "error")) {
22258
22265
  return this.emit("error", createHttpError(status, err));
22259
22266
  }
@@ -22368,7 +22375,7 @@ var require_send = __commonJS((exports, module) => {
22368
22375
  res.setHeader("Location", loc);
22369
22376
  res.end(doc2);
22370
22377
  };
22371
- SendStream.prototype.pipe = function pipe(res) {
22378
+ SendStream.prototype.pipe = function pipe2(res) {
22372
22379
  var root = this._root;
22373
22380
  this.res = res;
22374
22381
  var path2 = decode2(this.path);
@@ -22422,7 +22429,7 @@ var require_send = __commonJS((exports, module) => {
22422
22429
  this.sendFile(path2);
22423
22430
  return res;
22424
22431
  };
22425
- SendStream.prototype.send = function send(path2, stat) {
22432
+ SendStream.prototype.send = function send2(path2, stat) {
22426
22433
  var len = stat.size;
22427
22434
  var options = this.options;
22428
22435
  var opts = {};
@@ -22547,18 +22554,18 @@ var require_send = __commonJS((exports, module) => {
22547
22554
  SendStream.prototype.stream = function stream(path2, options) {
22548
22555
  var self = this;
22549
22556
  var res = this.res;
22550
- var stream = fs.createReadStream(path2, options);
22551
- this.emit("stream", stream);
22552
- stream.pipe(res);
22557
+ var stream2 = fs.createReadStream(path2, options);
22558
+ this.emit("stream", stream2);
22559
+ stream2.pipe(res);
22553
22560
  function cleanup() {
22554
- stream.destroy();
22561
+ stream2.destroy();
22555
22562
  }
22556
22563
  onFinished(res, cleanup);
22557
- stream.on("error", function onerror(err) {
22564
+ stream2.on("error", function onerror(err) {
22558
22565
  cleanup();
22559
22566
  self.onStatError(err);
22560
22567
  });
22561
- stream.on("end", function onend() {
22568
+ stream2.on("end", function onend() {
22562
22569
  self.emit("end");
22563
22570
  });
22564
22571
  };
@@ -22567,9 +22574,9 @@ var require_send = __commonJS((exports, module) => {
22567
22574
  if (res.getHeader("Content-Type"))
22568
22575
  return;
22569
22576
  var ext = extname(path2);
22570
- var type = mime.contentType(ext) || "application/octet-stream";
22571
- debug("content-type %s", type);
22572
- res.setHeader("Content-Type", type);
22577
+ var type2 = mime.contentType(ext) || "application/octet-stream";
22578
+ debug("content-type %s", type2);
22579
+ res.setHeader("Content-Type", type2);
22573
22580
  };
22574
22581
  SendStream.prototype.setHeader = function setHeader(path2, stat) {
22575
22582
  var res = this.res;
@@ -22831,7 +22838,7 @@ var require_response = __commonJS((exports, module) => {
22831
22838
  }
22832
22839
  }).join(", "));
22833
22840
  };
22834
- res.send = function send(body) {
22841
+ res.send = function send2(body) {
22835
22842
  var chunk = body;
22836
22843
  var encoding;
22837
22844
  var req = this.req;
@@ -23293,7 +23300,7 @@ var require_serve_static = __commonJS((exports, module) => {
23293
23300
  opts.maxage = opts.maxage || opts.maxAge || 0;
23294
23301
  opts.root = resolve(root);
23295
23302
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
23296
- return function serveStatic(req, res, next) {
23303
+ return function serveStatic2(req, res, next) {
23297
23304
  if (req.method !== "GET" && req.method !== "HEAD") {
23298
23305
  if (fallthrough) {
23299
23306
  return next();
@@ -23320,7 +23327,7 @@ var require_serve_static = __commonJS((exports, module) => {
23320
23327
  forwardError = true;
23321
23328
  });
23322
23329
  }
23323
- stream.on("error", function error(err) {
23330
+ stream.on("error", function error2(err) {
23324
23331
  if (forwardError || !(err.statusCode < 500)) {
23325
23332
  next(err);
23326
23333
  return;
@@ -23422,18 +23429,6 @@ var require_express = __commonJS((exports, module) => {
23422
23429
  exports.urlencoded = bodyParser.urlencoded;
23423
23430
  });
23424
23431
 
23425
- // node_modules/express/index.js
23426
- var require_express2 = __commonJS((exports, module) => {
23427
- /*!
23428
- * express
23429
- * Copyright(c) 2009-2013 TJ Holowaychuk
23430
- * Copyright(c) 2013 Roman Shtylman
23431
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
23432
- * MIT Licensed
23433
- */
23434
- module.exports = require_express();
23435
- });
23436
-
23437
23432
  // node_modules/object-assign/index.js
23438
23433
  var require_object_assign = __commonJS((exports, module) => {
23439
23434
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
@@ -27339,7 +27334,7 @@ function finalize(ctx, schema) {
27339
27334
  result.$schema = "http://json-schema.org/draft-07/schema#";
27340
27335
  } else if (ctx.target === "draft-04") {
27341
27336
  result.$schema = "http://json-schema.org/draft-04/schema#";
27342
- } else if (ctx.target === "openapi-3.0") {} else {}
27337
+ } else if (ctx.target === "openapi-3.0") {}
27343
27338
  if (ctx.external?.uri) {
27344
27339
  const id = ctx.external.registry.get(schema)?.id;
27345
27340
  if (!id)
@@ -27561,7 +27556,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
27561
27556
  if (val === undefined) {
27562
27557
  if (ctx.unrepresentable === "throw") {
27563
27558
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
27564
- } else {}
27559
+ }
27565
27560
  } else if (typeof val === "bigint") {
27566
27561
  if (ctx.unrepresentable === "throw") {
27567
27562
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -29404,7 +29399,7 @@ class StdioServerTransport {
29404
29399
  }
29405
29400
 
29406
29401
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js
29407
- var import_express = __toESM(require_express2(), 1);
29402
+ var import_express = __toESM(require_express(), 1);
29408
29403
 
29409
29404
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js
29410
29405
  function hostHeaderValidation(allowedHostnames) {
package/dist/mcp-app.html CHANGED
@@ -228,7 +228,7 @@ X:`),l=o.length;return l===0&&(l=1),l};var r=a.TuneBook=function(s){var o=t(s);t
228
228
  `)}
229
229
  `):`${a.join(`
230
230
  `)}
231
- ${n}`}function _3(e){const t=y3(e),n={};return e.swing!==void 0&&(n.swing=e.swing),{...t,abcNotation:e.abcNotation?w3(e.abcNotation,e):void 0,synthOptions:n}}function k3(e){const t=e.numberOfChannels,n=e.sampleRate,a=e.length,r=2,s=a*t*r,o=44,l=new ArrayBuffer(o+s),h=new DataView(l);sr(h,0,"RIFF"),h.setUint32(4,36+s,!0),sr(h,8,"WAVE"),sr(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,t,!0),h.setUint32(24,n,!0),h.setUint32(28,n*t*r,!0),h.setUint16(32,t*r,!0),h.setUint16(34,16,!0),sr(h,36,"data"),h.setUint32(40,s,!0);const g=Array.from({length:t},(u,i)=>e.getChannelData(i));let p=44;for(let u=0;u<a;u++)for(let i=0;i<t;i++){const v=Math.max(-1,Math.min(1,g[i][u]));h.setInt16(p,v<0?v*32768:v*32767,!0),p+=2}const d=new Uint8Array(l);let f="";const c=8192;for(let u=0;u<d.length;u+=c)f+=String.fromCharCode(...d.subarray(u,u+c));return btoa(f)}function sr(e,t,n){for(let a=0;a<n.length;a++)e.setUint8(t+a,n.charCodeAt(a))}const C3="0.4.2",he={visualObj:null,synthControl:null,currentInstrument:du,currentStyle:"",currentAbc:null,highlightedEls:[]},or=document.querySelector(".main"),zc=document.getElementById("status"),St=document.getElementById("sheet-music"),ya=document.getElementById("audio-controls"),gu=document.getElementById("instrument-selector"),vu=document.getElementById("style-selector"),Tr=document.getElementById("toolbar");"audioSession"in navigator&&(navigator.audioSession.type="playback");const x3={onEvent(e){if(he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[],!!e.elements){for(const t of e.elements)for(const n of t)n.classList.add("note-playing"),he.highlightedEls.push(n);he.highlightedEls.length>0&&he.highlightedEls[0].scrollIntoView({behavior:"smooth",block:"nearest"})}},onFinished(){he.highlightedEls.forEach(e=>e.classList.remove("note-playing")),he.highlightedEls=[]}},Tt=document.createElement("select");Tt.id="instrument-select";Tt.className="control-select";for(const e of Object.keys(jt)){const t=document.createElement("option");t.value=e,t.textContent=e,e===he.currentInstrument&&(t.selected=!0),Tt.appendChild(t)}Tt.addEventListener("change",()=>{he.currentInstrument=Tt.value,he.visualObj&&he.synthControl&&S3()});async function S3(){var e;if(!(!he.synthControl||!((e=he.visualObj)!=null&&e[0])))try{const n={program:jt[he.currentInstrument]??0};await he.synthControl.setTune(he.visualObj[0],!1,n)}catch(t){console.error("Failed to apply settings:",t)}}const Er=document.createElement("label");Er.className="control-label";Er.htmlFor="instrument-select";Er.textContent="Instrument";gu.appendChild(Er);gu.appendChild(Tt);const ht=document.createElement("select");ht.id="style-select";ht.className="control-select";const bi=document.createElement("option");bi.value="";bi.textContent="No style (melody only)";ht.appendChild(bi);for(const e of Object.keys(vi)){const t=document.createElement("option");t.value=e,t.textContent=e.charAt(0).toUpperCase()+e.slice(1),ht.appendChild(t)}ht.addEventListener("change",()=>{he.currentStyle=ht.value,he.currentAbc&&mu(he.currentAbc)});const Ar=document.createElement("label");Ar.className="control-label";Ar.htmlFor="style-select";Ar.textContent="Style";vu.appendChild(Ar);vu.appendChild(ht);let lr=null;const Ht=document.createElement("button");Ht.className="toolbar-btn";Ht.textContent="⛶";Ht.title="Toggle fullscreen";Ht.setAttribute("aria-label","Toggle fullscreen");Ht.addEventListener("click",()=>{lr==null||lr.requestDisplayMode({mode:"fullscreen"})});Tr.appendChild(Ht);const Ve=document.createElement("button");Ve.className="toolbar-btn";Ve.textContent="↓";Ve.title="Download audio (WAV)";Ve.setAttribute("aria-label","Download audio as WAV");Ve.disabled=!0;Tr.appendChild(Ve);let Sa=!1,Ta=!1;function T3(e){if(!e)return"music";const t=e.match(/T:\s*(.+)/);return t?t[1].trim().replace(/[^a-zA-Z0-9_-]/g,"_"):"music"}Ve.addEventListener("click",async()=>{var n;if(!he.synthControl)return;const e=he.synthControl.midiBuffer,t=(n=e==null?void 0:e.getAudioBuffer)==null?void 0:n.call(e);if(!t){st("Play first to generate audio",!0);return}Ve.disabled=!0,Ve.textContent="...";try{const a=k3(t),r=T3(he.currentAbc);await et.downloadFile({contents:[{type:"resource",resource:{uri:`file:///${r}.wav`,mimeType:"audio/wav",blob:a}}]})}catch(a){st(`Download failed: ${a.message}`,!0)}finally{Ve.disabled=!1,Ve.textContent="↓"}});const je=document.createElement("button");je.className="toolbar-btn";je.textContent="↗";je.title="Send this ABC to chat";je.setAttribute("aria-label","Send this ABC notation to the chat");je.disabled=!0;je.hidden=!0;Tr.appendChild(je);je.addEventListener("click",async()=>{if(he.currentAbc){je.disabled=!0,je.textContent="...";try{await et.sendMessage({role:"user",content:[{type:"text",text:"Here's my ABC notation:\n```\n"+he.currentAbc+"\n```"}]})}catch(e){st(`Send failed: ${e.message}`,!0)}finally{je.disabled=!1,je.textContent="↗"}}});function st(e,t=!1){zc.textContent=e,zc.classList.toggle("error",t)}function E3(e){if(st(e),!he.visualObj){const t=document.createElement("div");t.className="loading-skeleton",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");const n=document.createElement("span");n.className="spinner",n.setAttribute("aria-hidden","true");const a=document.createElement("span");a.textContent=e,t.append(n,a),St.replaceChildren(t)}}async function mu(e,t){var n;try{st("Rendering..."),he.synthControl&&he.synthControl.pause(),he.currentAbc=e,St.innerHTML="",ya.innerHTML="";const a=pu(e,he.currentStyle);if(he.visualObj=cr.renderAbc(St,a,{responsive:"resize",add_classes:!0}),!he.visualObj||he.visualObj.length===0)throw new Error("Failed to parse music notation");if(!cr.synth.supportsAudio())throw new Error("Audio not supported in this browser");he.synthControl=new cr.synth.SynthController,he.synthControl.load(ya,x3,{displayLoop:!0,displayPlay:!0,displayProgress:!0,displayWarp:!0});const s={program:jt[he.currentInstrument]??0,...t};await he.synthControl.setTune(he.visualObj[0],!1,s),Tr.classList.add("visible"),Ve.disabled=!Sa,je.disabled=!Ta,(n=he.synthControl.play())==null||n.then(()=>st("Playing...")).catch(o=>{console.debug("Autoplay blocked:",o),st("Click ▶ to play")})}catch(a){console.error("Render error:",a),st(`Error: ${a.message}`,!0),ya.innerHTML=""}}const et=new Ag({name:"Music Studio",version:C3});lr=et;et.ontoolinput=e=>{console.info("Received tool input:",e);const t=_3(e.arguments??{});he.currentInstrument=t.instrument,Tt.value=t.instrument,he.currentStyle=t.style,ht.value=t.style,t.abcNotation?mu(t.abcNotation,t.synthOptions).catch(console.error):st("No ABC notation provided",!0)};let zt=null,Ea="";et.ontoolinputpartial=e=>{var a,r;const t=(a=e.arguments)==null?void 0:a.abcNotation;if(!t)return;he.currentAbc=t;const n=(r=e.arguments)==null?void 0:r.style;if(n&&mi(n)&&he.currentStyle!==n&&(he.currentStyle=n,ht.value=n),!t.match(/K:[^\n]+/)){E3("Composing…");return}t!==Ea&&(Ea=t,zt&&clearTimeout(zt),zt=setTimeout(()=>{try{const s=pu(t,he.currentStyle);cr.renderAbc(St,s,{responsive:"resize",add_classes:!0}),St.scrollTop=St.scrollHeight;const o=St.closest(".sheet-section");o&&(o.scrollTop=o.scrollHeight),st("Composing...")}catch{}},150))};et.onerror=console.error;function bu(){var e;try{(e=he.synthControl)==null||e.pause()}catch{}he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[]}function yu(){zt&&(clearTimeout(zt),zt=null),Ea=""}et.ontoolcancelled=e=>{bu(),yu();const t=e!=null&&e.reason?` (${e.reason})`:"";st(`Composition cancelled${t}.`)};et.onteardown=()=>(bu(),yu(),{});function wu(e){var t;e.theme&&Tg(e.theme),(t=e.styles)!=null&&t.variables&&Eg(e.styles.variables),e.safeAreaInsets&&(or.style.paddingTop=`${e.safeAreaInsets.top}px`,or.style.paddingRight=`${e.safeAreaInsets.right}px`,or.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,or.style.paddingLeft=`${e.safeAreaInsets.left}px`)}et.onhostcontextchanged=wu;et.connect().then(()=>{var t,n;Sa=!!((t=et.getHostCapabilities())!=null&&t.downloadFile),Sa||(Ve.hidden=!0,Ve.disabled=!0,Ve.title="Audio download isn't supported by this host"),Ta=!!((n=et.getHostCapabilities())!=null&&n.message),Ta?je.hidden=!1:(je.disabled=!0,je.title="Sending to chat isn't supported by this host");const e=et.getHostContext();e&&wu(e)});</script>
231
+ ${n}`}function _3(e){const t=y3(e),n={};return e.swing!==void 0&&(n.swing=e.swing),{...t,abcNotation:e.abcNotation?w3(e.abcNotation,e):void 0,synthOptions:n}}function k3(e){const t=e.numberOfChannels,n=e.sampleRate,a=e.length,r=2,s=a*t*r,o=44,l=new ArrayBuffer(o+s),h=new DataView(l);sr(h,0,"RIFF"),h.setUint32(4,36+s,!0),sr(h,8,"WAVE"),sr(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,t,!0),h.setUint32(24,n,!0),h.setUint32(28,n*t*r,!0),h.setUint16(32,t*r,!0),h.setUint16(34,16,!0),sr(h,36,"data"),h.setUint32(40,s,!0);const g=Array.from({length:t},(u,i)=>e.getChannelData(i));let p=44;for(let u=0;u<a;u++)for(let i=0;i<t;i++){const v=Math.max(-1,Math.min(1,g[i][u]));h.setInt16(p,v<0?v*32768:v*32767,!0),p+=2}const d=new Uint8Array(l);let f="";const c=8192;for(let u=0;u<d.length;u+=c)f+=String.fromCharCode(...d.subarray(u,u+c));return btoa(f)}function sr(e,t,n){for(let a=0;a<n.length;a++)e.setUint8(t+a,n.charCodeAt(a))}const C3="0.4.3",he={visualObj:null,synthControl:null,currentInstrument:du,currentStyle:"",currentAbc:null,highlightedEls:[]},or=document.querySelector(".main"),zc=document.getElementById("status"),St=document.getElementById("sheet-music"),ya=document.getElementById("audio-controls"),gu=document.getElementById("instrument-selector"),vu=document.getElementById("style-selector"),Tr=document.getElementById("toolbar");"audioSession"in navigator&&(navigator.audioSession.type="playback");const x3={onEvent(e){if(he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[],!!e.elements){for(const t of e.elements)for(const n of t)n.classList.add("note-playing"),he.highlightedEls.push(n);he.highlightedEls.length>0&&he.highlightedEls[0].scrollIntoView({behavior:"smooth",block:"nearest"})}},onFinished(){he.highlightedEls.forEach(e=>e.classList.remove("note-playing")),he.highlightedEls=[]}},Tt=document.createElement("select");Tt.id="instrument-select";Tt.className="control-select";for(const e of Object.keys(jt)){const t=document.createElement("option");t.value=e,t.textContent=e,e===he.currentInstrument&&(t.selected=!0),Tt.appendChild(t)}Tt.addEventListener("change",()=>{he.currentInstrument=Tt.value,he.visualObj&&he.synthControl&&S3()});async function S3(){var e;if(!(!he.synthControl||!((e=he.visualObj)!=null&&e[0])))try{const n={program:jt[he.currentInstrument]??0};await he.synthControl.setTune(he.visualObj[0],!1,n)}catch(t){console.error("Failed to apply settings:",t)}}const Er=document.createElement("label");Er.className="control-label";Er.htmlFor="instrument-select";Er.textContent="Instrument";gu.appendChild(Er);gu.appendChild(Tt);const ht=document.createElement("select");ht.id="style-select";ht.className="control-select";const bi=document.createElement("option");bi.value="";bi.textContent="No style (melody only)";ht.appendChild(bi);for(const e of Object.keys(vi)){const t=document.createElement("option");t.value=e,t.textContent=e.charAt(0).toUpperCase()+e.slice(1),ht.appendChild(t)}ht.addEventListener("change",()=>{he.currentStyle=ht.value,he.currentAbc&&mu(he.currentAbc)});const Ar=document.createElement("label");Ar.className="control-label";Ar.htmlFor="style-select";Ar.textContent="Style";vu.appendChild(Ar);vu.appendChild(ht);let lr=null;const Ht=document.createElement("button");Ht.className="toolbar-btn";Ht.textContent="⛶";Ht.title="Toggle fullscreen";Ht.setAttribute("aria-label","Toggle fullscreen");Ht.addEventListener("click",()=>{lr==null||lr.requestDisplayMode({mode:"fullscreen"})});Tr.appendChild(Ht);const Ve=document.createElement("button");Ve.className="toolbar-btn";Ve.textContent="↓";Ve.title="Download audio (WAV)";Ve.setAttribute("aria-label","Download audio as WAV");Ve.disabled=!0;Tr.appendChild(Ve);let Sa=!1,Ta=!1;function T3(e){if(!e)return"music";const t=e.match(/T:\s*(.+)/);return t?t[1].trim().replace(/[^a-zA-Z0-9_-]/g,"_"):"music"}Ve.addEventListener("click",async()=>{var n;if(!he.synthControl)return;const e=he.synthControl.midiBuffer,t=(n=e==null?void 0:e.getAudioBuffer)==null?void 0:n.call(e);if(!t){st("Play first to generate audio",!0);return}Ve.disabled=!0,Ve.textContent="...";try{const a=k3(t),r=T3(he.currentAbc);await et.downloadFile({contents:[{type:"resource",resource:{uri:`file:///${r}.wav`,mimeType:"audio/wav",blob:a}}]})}catch(a){st(`Download failed: ${a.message}`,!0)}finally{Ve.disabled=!1,Ve.textContent="↓"}});const je=document.createElement("button");je.className="toolbar-btn";je.textContent="↗";je.title="Send this ABC to chat";je.setAttribute("aria-label","Send this ABC notation to the chat");je.disabled=!0;je.hidden=!0;Tr.appendChild(je);je.addEventListener("click",async()=>{if(he.currentAbc){je.disabled=!0,je.textContent="...";try{await et.sendMessage({role:"user",content:[{type:"text",text:"Here's my ABC notation:\n```\n"+he.currentAbc+"\n```"}]})}catch(e){st(`Send failed: ${e.message}`,!0)}finally{je.disabled=!1,je.textContent="↗"}}});function st(e,t=!1){zc.textContent=e,zc.classList.toggle("error",t)}function E3(e){if(st(e),!he.visualObj){const t=document.createElement("div");t.className="loading-skeleton",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");const n=document.createElement("span");n.className="spinner",n.setAttribute("aria-hidden","true");const a=document.createElement("span");a.textContent=e,t.append(n,a),St.replaceChildren(t)}}async function mu(e,t){var n;try{st("Rendering..."),he.synthControl&&he.synthControl.pause(),he.currentAbc=e,St.innerHTML="",ya.innerHTML="";const a=pu(e,he.currentStyle);if(he.visualObj=cr.renderAbc(St,a,{responsive:"resize",add_classes:!0}),!he.visualObj||he.visualObj.length===0)throw new Error("Failed to parse music notation");if(!cr.synth.supportsAudio())throw new Error("Audio not supported in this browser");he.synthControl=new cr.synth.SynthController,he.synthControl.load(ya,x3,{displayLoop:!0,displayPlay:!0,displayProgress:!0,displayWarp:!0});const s={program:jt[he.currentInstrument]??0,...t};await he.synthControl.setTune(he.visualObj[0],!1,s),Tr.classList.add("visible"),Ve.disabled=!Sa,je.disabled=!Ta,(n=he.synthControl.play())==null||n.then(()=>st("Playing...")).catch(o=>{console.debug("Autoplay blocked:",o),st("Click ▶ to play")})}catch(a){console.error("Render error:",a),st(`Error: ${a.message}`,!0),ya.innerHTML=""}}const et=new Ag({name:"Music Studio",version:C3});lr=et;et.ontoolinput=e=>{console.info("Received tool input:",e);const t=_3(e.arguments??{});he.currentInstrument=t.instrument,Tt.value=t.instrument,he.currentStyle=t.style,ht.value=t.style,t.abcNotation?mu(t.abcNotation,t.synthOptions).catch(console.error):st("No ABC notation provided",!0)};let zt=null,Ea="";et.ontoolinputpartial=e=>{var a,r;const t=(a=e.arguments)==null?void 0:a.abcNotation;if(!t)return;he.currentAbc=t;const n=(r=e.arguments)==null?void 0:r.style;if(n&&mi(n)&&he.currentStyle!==n&&(he.currentStyle=n,ht.value=n),!t.match(/K:[^\n]+/)){E3("Composing…");return}t!==Ea&&(Ea=t,zt&&clearTimeout(zt),zt=setTimeout(()=>{try{const s=pu(t,he.currentStyle);cr.renderAbc(St,s,{responsive:"resize",add_classes:!0}),St.scrollTop=St.scrollHeight;const o=St.closest(".sheet-section");o&&(o.scrollTop=o.scrollHeight),st("Composing...")}catch{}},150))};et.onerror=console.error;function bu(){var e;try{(e=he.synthControl)==null||e.pause()}catch{}he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[]}function yu(){zt&&(clearTimeout(zt),zt=null),Ea=""}et.ontoolcancelled=e=>{bu(),yu();const t=e!=null&&e.reason?` (${e.reason})`:"";st(`Composition cancelled${t}.`)};et.onteardown=()=>(bu(),yu(),{});function wu(e){var t;e.theme&&Tg(e.theme),(t=e.styles)!=null&&t.variables&&Eg(e.styles.variables),e.safeAreaInsets&&(or.style.paddingTop=`${e.safeAreaInsets.top}px`,or.style.paddingRight=`${e.safeAreaInsets.right}px`,or.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,or.style.paddingLeft=`${e.safeAreaInsets.left}px`)}et.onhostcontextchanged=wu;et.connect().then(()=>{var t,n;Sa=!!((t=et.getHostCapabilities())!=null&&t.downloadFile),Sa||(Ve.hidden=!0,Ve.disabled=!0,Ve.title="Audio download isn't supported by this host"),Ta=!!((n=et.getHostCapabilities())!=null&&n.message),Ta?je.hidden=!1:(je.disabled=!0,je.title="Sending to chat isn't supported by this host");const e=et.getHostContext();e&&wu(e)});</script>
232
232
  <style rel="stylesheet" crossorigin>.abcjs-inline-audio{height:26px;padding:0 5px;border-radius:3px;background-color:#424242;display:flex;align-items:center;box-sizing:border-box}.abcjs-inline-audio.abcjs-disabled{opacity:.5}.abcjs-inline-audio .abcjs-btn{display:block;width:28px;height:34px;margin-right:2px;padding:7px 4px;background:none!important;border:1px solid transparent;box-sizing:border-box;line-height:1}.abcjs-btn g{fill:#f4f4f4;stroke:#f4f4f4}.abcjs-inline-audio .abcjs-btn:hover g{fill:#ccc;stroke:#ccc}.abcjs-inline-audio .abcjs-midi-selection.abcjs-pushed,.abcjs-inline-audio .abcjs-midi-loop.abcjs-pushed,.abcjs-inline-audio .abcjs-midi-reset.abcjs-pushed{border:1px solid #cccccc;background-color:#666;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-start .abcjs-pause-svg,.abcjs-inline-audio .abcjs-midi-start .abcjs-loading-svg,.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-play-svg,.abcjs-inline-audio .abcjs-midi-start.abcjs-loading .abcjs-play-svg{display:none}.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-pause-svg{display:block}.abcjs-inline-audio .abcjs-midi-progress-background{background-color:#424242;height:10px;border-radius:5px;border:2px solid #cccccc;margin:0 8px 0 15px;position:relative;flex:1;padding:0;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-progress-indicator{width:20px;margin-left:-10px;height:14px;background-color:#f4f4f4;position:absolute;display:inline-block;border-radius:6px;top:-4px;left:0;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-clock{margin-left:4px;margin-top:1px;margin-right:2px;display:inline-block;font-family:sans-serif;font-size:16px;box-sizing:border-box;color:#f4f4f4}.abcjs-inline-audio .abcjs-tempo-wrapper{font-size:10px;color:#f4f4f4;box-sizing:border-box;display:flex;align-items:center}.abcjs-inline-audio .abcjs-midi-tempo{border-radius:2px;border:none;margin:0 2px 0 4px;width:42px;padding-left:2px;box-sizing:border-box}.abcjs-inline-audio .abcjs-loading .abcjs-loading-svg{display:inherit}.abcjs-inline-audio .abcjs-loading{outline:none;animation-name:abcjs-spin;animation-duration:1s;animation-iteration-count:infinite;animation-timing-function:linear}.abcjs-inline-audio .abcjs-loading-svg circle{stroke:#f4f4f4}@keyframes abcjs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.abcjs-large .abcjs-inline-audio{height:52px}.abcjs-large .abcjs-btn{width:56px;height:52px;font-size:28px;padding:6px 8px}.abcjs-large .abcjs-midi-progress-background{height:20px;border:4px solid #cccccc}.abcjs-large .abcjs-midi-progress-indicator{height:28px;top:-8px;width:40px}.abcjs-large .abcjs-midi-clock{font-size:32px;margin-right:10px;margin-left:10px;margin-top:-1px}.abcjs-large .abcjs-midi-tempo{font-size:20px;width:50px}.abcjs-large .abcjs-tempo-wrapper{font-size:20px}.abcjs-css-warning{display:none}*{box-sizing:border-box}html,body{font-family:system-ui,-apple-system,sans-serif;font-size:1rem}code{font-size:1em}:root{--color-bg: #ffffff;--color-text: #1f2937;--color-text-muted: #6b7280;--color-primary: #2563eb;--color-success: #10b981;--color-danger: #ef4444;--color-card-bg: #f9fafb;--color-border: #e5e7eb}@media(prefers-color-scheme:dark){:root{--color-bg: #111827;--color-text: #f9fafb;--color-text-muted: #9ca3af;--color-primary: #3b82f6;--color-success: #34d399;--color-danger: #f87171;--color-card-bg: #1f2937;--color-border: #374151}}:root[data-theme=dark]{--color-bg: #111827;--color-text: #f9fafb;--color-text-muted: #9ca3af;--color-primary: #3b82f6;--color-success: #34d399;--color-danger: #f87171;--color-card-bg: #1f2937;--color-border: #374151}:root[data-theme=light]{--color-bg: #ffffff;--color-text: #1f2937;--color-text-muted: #6b7280;--color-primary: #2563eb;--color-success: #10b981;--color-danger: #ef4444;--color-card-bg: #f9fafb;--color-border: #e5e7eb}html,body{margin:0;padding:0;background:var(--color-bg);color:var(--color-text)}.main{width:100%;margin:0 auto;padding:8px;display:flex;flex-direction:column;gap:8px}.header{display:flex;flex-direction:column;gap:6px}#audio-controls:empty{display:none}#audio-controls:not(:empty)~#status{display:none}.audio-controls{width:100%}.audio-controls .abcjs-inline-audio{border-radius:8px}.audio-controls .abcjs-inline-audio .abcjs-midi-loop.abcjs-pushed{background-color:var(--color-success)!important;border-color:var(--color-success)!important}.status{font-size:.875rem;color:var(--color-text-muted)}.status.error{color:var(--color-danger)}.toolbar{display:none;flex-wrap:wrap;gap:8px}.toolbar.visible{display:flex}.toolbar-group{display:flex;align-items:center;gap:6px;flex:1;min-width:140px}.control-label{font-size:.75rem;color:var(--color-text-muted);white-space:nowrap;text-transform:uppercase;letter-spacing:.05em}.control-select{flex:1;padding:5px 8px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-card-bg);color:var(--color-text);font-size:.8125rem;cursor:pointer;min-width:0}.control-select:focus{outline:2px solid var(--color-primary);outline-offset:-1px}.toolbar-btn{padding:5px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-card-bg);color:var(--color-text);font-size:1rem;cursor:pointer;line-height:1}.toolbar-btn:hover{background:var(--color-border)}.toolbar-btn:disabled{opacity:.4;cursor:default}.toolbar-btn:disabled:hover{background:var(--color-card-bg)}.loading-skeleton{display:flex;align-items:center;justify-content:center;gap:10px;min-height:160px;color:var(--color-text-muted);font-size:.875rem}.spinner{width:18px;height:18px;border:2px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:spinner-rotate .7s linear infinite}@keyframes spinner-rotate{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2s}}.note-playing path,.note-playing circle,.note-playing ellipse,.note-playing polygon{fill:var(--color-primary)!important;stroke:var(--color-primary)!important;stroke-width:1.5px;transition:fill .08s ease}.note-playing path[stroke]{stroke:var(--color-primary)!important}.sheet-section{background:var(--color-card-bg);border-radius:8px;padding:16px;border:1px solid var(--color-border);min-height:200px;max-height:80vh;overflow-y:auto;scroll-behavior:smooth}.sheet-section .sheet-music-container{width:100%;overflow-x:auto}</style>
233
233
  </head>
234
234
  <body>
package/dist/server.js CHANGED
@@ -3,25 +3,43 @@ var __getProtoOf = Object.getPrototypeOf;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
6
11
  var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
7
19
  target = mod != null ? __create(__getProtoOf(mod)) : {};
8
20
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
21
  for (let key of __getOwnPropNames(mod))
10
22
  if (!__hasOwnProp.call(to, key))
11
23
  __defProp(to, key, {
12
- get: () => mod[key],
24
+ get: __accessProp.bind(mod, key),
13
25
  enumerable: true
14
26
  });
27
+ if (canCache)
28
+ cache.set(mod, to);
15
29
  return to;
16
30
  };
17
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
+ var __returnValue = (v) => v;
33
+ function __exportSetter(name, newValue) {
34
+ this[name] = __returnValue.bind(null, newValue);
35
+ }
18
36
  var __export = (target, all) => {
19
37
  for (var name in all)
20
38
  __defProp(target, name, {
21
39
  get: all[name],
22
40
  enumerable: true,
23
41
  configurable: true,
24
- set: (newValue) => all[name] = () => newValue
42
+ set: __exportSetter.bind(all, name)
25
43
  });
26
44
  };
27
45
 
@@ -6284,7 +6302,7 @@ var require_formats = __commonJS((exports) => {
6284
6302
  }
6285
6303
  var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6286
6304
  function getTime(strictTimeZone) {
6287
- return function time(str) {
6305
+ return function time3(str) {
6288
6306
  const matches = TIME.exec(str);
6289
6307
  if (!matches)
6290
6308
  return false;
@@ -13980,7 +13998,7 @@ var require_abc_midi_sequencer = __commonJS((exports, module) => {
13980
13998
 
13981
13999
  // node_modules/abcjs/src/synth/chord-track.js
13982
14000
  var require_chord_track = __commonJS((exports, module) => {
13983
- var ChordTrack = function ChordTrack(numVoices, chordsOff, midiOptions, meter) {
14001
+ var ChordTrack = function ChordTrack2(numVoices, chordsOff, midiOptions, meter) {
13984
14002
  this.chordTrack = [];
13985
14003
  this.chordTrackFinished = false;
13986
14004
  this.chordChannel = numVoices;
@@ -17813,7 +17831,7 @@ var require_string_tablature = __commonJS((exports, module) => {
17813
17831
 
17814
17832
  // node_modules/abcjs/src/write/creation/elements/voice-element.js
17815
17833
  var require_voice_element = __commonJS((exports, module) => {
17816
- var VoiceElement = function VoiceElement(voicenumber, voicetotal) {
17834
+ var VoiceElement = function VoiceElement2(voicenumber, voicetotal) {
17817
17835
  this.children = [];
17818
17836
  this.beams = [];
17819
17837
  this.otherchildren = [];
@@ -17953,7 +17971,7 @@ var require_unhighlight = __commonJS((exports, module) => {
17953
17971
  var require_absolute_element = __commonJS((exports, module) => {
17954
17972
  var highlight = require_highlight();
17955
17973
  var unhighlight = require_unhighlight();
17956
- var AbsoluteElement = function AbsoluteElement(abcelem, duration3, minspacing, type, tuneNumber, options) {
17974
+ var AbsoluteElement = function AbsoluteElement2(abcelem, duration3, minspacing, type, tuneNumber, options) {
17957
17975
  if (!options)
17958
17976
  options = {};
17959
17977
  this.tuneNumber = tuneNumber;
@@ -18118,7 +18136,7 @@ var require_absolute_element = __commonJS((exports, module) => {
18118
18136
 
18119
18137
  // node_modules/abcjs/src/write/creation/elements/relative-element.js
18120
18138
  var require_relative_element = __commonJS((exports, module) => {
18121
- var RelativeElement = function RelativeElement(c, dx, w2, pitch, opt) {
18139
+ var RelativeElement = function RelativeElement2(c, dx, w2, pitch, opt) {
18122
18140
  opt = opt || {};
18123
18141
  this.x = 0;
18124
18142
  this.c = c;
@@ -20074,7 +20092,7 @@ var require_output = __commonJS((exports, module) => {
20074
20092
 
20075
20093
  // node_modules/abcjs/src/write/creation/elements/beam-element.js
20076
20094
  var require_beam_element = __commonJS((exports, module) => {
20077
- var BeamElem = function BeamElem(stemHeight, type, flat, firstElement) {
20095
+ var BeamElem = function BeamElem2(stemHeight, type, flat, firstElement) {
20078
20096
  this.type = "BeamElem";
20079
20097
  this.isflat = !!flat;
20080
20098
  this.isgrace = !!(type && type === "grace");
@@ -20166,7 +20184,7 @@ var require_beam_element = __commonJS((exports, module) => {
20166
20184
 
20167
20185
  // node_modules/abcjs/src/write/creation/elements/brace-element.js
20168
20186
  var require_brace_element = __commonJS((exports, module) => {
20169
- var BraceElem = function BraceElem(voice, type) {
20187
+ var BraceElem = function BraceElem2(voice, type) {
20170
20188
  this.startVoice = voice;
20171
20189
  this.type = type;
20172
20190
  };
@@ -20728,7 +20746,7 @@ var require_create_time_signature = __commonJS((exports, module) => {
20728
20746
 
20729
20747
  // node_modules/abcjs/src/write/creation/elements/dynamic-decoration.js
20730
20748
  var require_dynamic_decoration = __commonJS((exports, module) => {
20731
- var DynamicDecoration = function DynamicDecoration(anchor, dec, position) {
20749
+ var DynamicDecoration = function DynamicDecoration2(anchor, dec, position) {
20732
20750
  this.type = "DynamicDecoration";
20733
20751
  this.anchor = anchor;
20734
20752
  this.dec = dec;
@@ -20743,7 +20761,7 @@ var require_dynamic_decoration = __commonJS((exports, module) => {
20743
20761
 
20744
20762
  // node_modules/abcjs/src/write/creation/elements/crescendo-element.js
20745
20763
  var require_crescendo_element = __commonJS((exports, module) => {
20746
- var CrescendoElem = function CrescendoElem(anchor1, anchor2, dir, positioning) {
20764
+ var CrescendoElem = function CrescendoElem2(anchor1, anchor2, dir, positioning) {
20747
20765
  this.type = "CrescendoElem";
20748
20766
  this.anchor1 = anchor1;
20749
20767
  this.anchor2 = anchor2;
@@ -20759,7 +20777,7 @@ var require_crescendo_element = __commonJS((exports, module) => {
20759
20777
 
20760
20778
  // node_modules/abcjs/src/write/creation/elements/glissando-element.js
20761
20779
  var require_glissando_element = __commonJS((exports, module) => {
20762
- var GlissandoElem = function GlissandoElem(anchor1, anchor2) {
20780
+ var GlissandoElem = function GlissandoElem2(anchor1, anchor2) {
20763
20781
  this.type = "GlissandoElem";
20764
20782
  this.anchor1 = anchor1;
20765
20783
  this.anchor2 = anchor2;
@@ -20769,7 +20787,7 @@ var require_glissando_element = __commonJS((exports, module) => {
20769
20787
 
20770
20788
  // node_modules/abcjs/src/write/creation/elements/tie-element.js
20771
20789
  var require_tie_element = __commonJS((exports, module) => {
20772
- var TieElem = function TieElem(options) {
20790
+ var TieElem = function TieElem2(options) {
20773
20791
  this.type = "TieElem";
20774
20792
  this.anchor1 = options.anchor1;
20775
20793
  this.anchor2 = options.anchor2;
@@ -20983,7 +21001,7 @@ var require_decoration = __commonJS((exports, module) => {
20983
21001
  var glyphs = require_glyphs();
20984
21002
  var RelativeElement = require_relative_element();
20985
21003
  var TieElem = require_tie_element();
20986
- var Decoration = function Decoration() {
21004
+ var Decoration = function Decoration2() {
20987
21005
  this.startDiminuendoX = undefined;
20988
21006
  this.startCrescendoX = undefined;
20989
21007
  this.minTop = 12;
@@ -21350,7 +21368,7 @@ var require_decoration = __commonJS((exports, module) => {
21350
21368
 
21351
21369
  // node_modules/abcjs/src/write/creation/elements/ending-element.js
21352
21370
  var require_ending_element = __commonJS((exports, module) => {
21353
- var EndingElem = function EndingElem(text, anchor1, anchor2) {
21371
+ var EndingElem = function EndingElem2(text, anchor1, anchor2) {
21354
21372
  this.type = "EndingElem";
21355
21373
  this.text = text;
21356
21374
  this.anchor1 = anchor1;
@@ -21454,7 +21472,7 @@ var require_staff_group_element = __commonJS((exports, module) => {
21454
21472
  var require_tempo_element = __commonJS((exports, module) => {
21455
21473
  var AbsoluteElement = require_absolute_element();
21456
21474
  var RelativeElement = require_relative_element();
21457
- var TempoElement = function TempoElement(tempo, tuneNumber, createNoteHead) {
21475
+ var TempoElement = function TempoElement2(tempo, tuneNumber, createNoteHead) {
21458
21476
  this.type = "TempoElement";
21459
21477
  this.tempo = tempo;
21460
21478
  this.tempo.type = "tempo";
@@ -21540,7 +21558,7 @@ var require_tempo_element = __commonJS((exports, module) => {
21540
21558
 
21541
21559
  // node_modules/abcjs/src/write/creation/elements/triplet-element.js
21542
21560
  var require_triplet_element = __commonJS((exports, module) => {
21543
- var TripletElem = function TripletElem(number5, anchor1, options) {
21561
+ var TripletElem = function TripletElem2(number5, anchor1, options) {
21544
21562
  this.type = "TripletElem";
21545
21563
  this.anchor1 = anchor1;
21546
21564
  this.number = number5;
@@ -24940,7 +24958,7 @@ var require_layout = __commonJS((exports, module) => {
24940
24958
 
24941
24959
  // node_modules/abcjs/src/write/helpers/classes.js
24942
24960
  var require_classes = __commonJS((exports, module) => {
24943
- var Classes = function Classes(options) {
24961
+ var Classes = function Classes2(options) {
24944
24962
  this.shouldAddClasses = options.shouldAddClasses;
24945
24963
  this.reset();
24946
24964
  };
@@ -25040,7 +25058,7 @@ var require_classes = __commonJS((exports, module) => {
25040
25058
 
25041
25059
  // node_modules/abcjs/src/write/helpers/get-font-and-attr.js
25042
25060
  var require_get_font_and_attr = __commonJS((exports, module) => {
25043
- var GetFontAndAttr = function GetFontAndAttr(formatting, classes) {
25061
+ var GetFontAndAttr = function GetFontAndAttr2(formatting, classes) {
25044
25062
  this.formatting = formatting;
25045
25063
  this.classes = classes;
25046
25064
  };
@@ -25087,7 +25105,7 @@ var require_get_font_and_attr = __commonJS((exports, module) => {
25087
25105
 
25088
25106
  // node_modules/abcjs/src/write/helpers/get-text-size.js
25089
25107
  var require_get_text_size = __commonJS((exports, module) => {
25090
- var GetTextSize = function GetTextSize(getFontAndAttr, svg) {
25108
+ var GetTextSize = function GetTextSize2(getFontAndAttr, svg) {
25091
25109
  this.getFontAndAttr = getFontAndAttr;
25092
25110
  this.svg = svg;
25093
25111
  };
@@ -29453,7 +29471,7 @@ var require_abc_midi_create = __commonJS((exports, module) => {
29453
29471
  var create;
29454
29472
  (function() {
29455
29473
  var baseDuration = 480 * 4;
29456
- create = function create(abcTune, options) {
29474
+ create = function create2(abcTune, options) {
29457
29475
  if (options === undefined)
29458
29476
  options = {};
29459
29477
  var commands = abcTune.setUpAudio(options);
@@ -44570,7 +44588,7 @@ function finalize(ctx, schema) {
44570
44588
  result.$schema = "http://json-schema.org/draft-07/schema#";
44571
44589
  } else if (ctx.target === "draft-04") {
44572
44590
  result.$schema = "http://json-schema.org/draft-04/schema#";
44573
- } else if (ctx.target === "openapi-3.0") {} else {}
44591
+ } else if (ctx.target === "openapi-3.0") {}
44574
44592
  if (ctx.external?.uri) {
44575
44593
  const id = ctx.external.registry.get(schema)?.id;
44576
44594
  if (!id)
@@ -44818,7 +44836,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
44818
44836
  if (val === undefined) {
44819
44837
  if (ctx.unrepresentable === "throw") {
44820
44838
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
44821
- } else {}
44839
+ }
44822
44840
  } else if (typeof val === "bigint") {
44823
44841
  if (ctx.unrepresentable === "throw") {
44824
44842
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -54399,7 +54417,7 @@ async function openStrudelInBrowser(options, outputDir) {
54399
54417
  }
54400
54418
 
54401
54419
  // src/version.ts
54402
- var VERSION = "0.4.2";
54420
+ var VERSION = "0.4.3";
54403
54421
 
54404
54422
  // server.ts
54405
54423
  var DIST_DIR = import.meta.filename.endsWith(".ts") ? path3.join(import.meta.dirname, "dist") : import.meta.dirname;
@@ -1 +1 @@
1
- export declare const VERSION = "0.4.2";
1
+ export declare const VERSION = "0.4.3";
@@ -81,7 +81,7 @@ Boolean requesting whether a visible border and background is provided by the ho
81
81
  - omitted: host decides border`)});p({method:u("ui/request-display-mode"),params:p({mode:xe.describe("The display mode being requested.")})});var jl=p({mode:xe.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Dl=S([u("model"),u("app")]).describe("Tool visibility scope - who can access the tool.");p({resourceUri:d().optional(),visibility:w(Dl).optional().describe(`Who can access this tool. Default: ["model", "app"]
82
82
  - "model": Tool visible to and callable by the agent
83
83
  - "app": Tool callable by the app from this server only`)});p({mimeTypes:w(d()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});p({method:u("ui/download-file"),params:p({contents:w(S([Po,Eo])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});p({method:u("ui/message"),params:p({role:u("user").describe('Message role, currently only "user" is supported.'),content:w(Ue).describe("Message content blocks (text, image, etc.).")})});p({method:u("ui/notifications/sandbox-resource-ready"),params:p({html:d().describe("HTML content to load into the inner iframe."),sandbox:d().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:en.optional().describe("CSP configuration from resource metadata."),permissions:tn.optional().describe("Sandbox permissions from resource metadata.")})});var Ul=p({method:u("ui/notifications/tool-result"),params:ht.describe("Standard MCP tool execution result.")}),Oo=p({toolInfo:p({id:Ne.optional().describe("JSON-RPC id of the tools/call request."),tool:Xt.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Tl.optional().describe("Current color theme preference."),styles:Nl.optional().describe("Style configuration for theming the app."),displayMode:xe.optional().describe("How the UI is currently displayed."),availableDisplayModes:w(xe).optional().describe("Display modes the host supports."),containerDimensions:S([p({height:k().describe("Fixed container height in pixels.")}),p({maxHeight:S([k(),vt()]).optional().describe("Maximum container height in pixels.")})]).and(S([p({width:k().describe("Fixed container width in pixels.")}),p({maxWidth:S([k(),vt()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
84
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:d().optional().describe("User's language and region preference in BCP 47 format."),timeZone:d().optional().describe("User's timezone in IANA format."),userAgent:d().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({touch:E().optional().describe("Whether the device supports touch input."),hover:E().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p({top:k().describe("Top safe area inset in pixels."),right:k().describe("Right safe area inset in pixels."),bottom:k().describe("Bottom safe area inset in pixels."),left:k().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Ll=p({method:u("ui/notifications/host-context-changed"),params:Oo.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:w(Ue).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:$(d(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});p({method:u("ui/initialize"),params:p({appInfo:dt.describe("App identification (name and version)."),appCapabilities:Ml.describe("Features and capabilities this app provides."),protocolVersion:d().describe("Protocol version this app supports.")})});var Fl=p({protocolVersion:d().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:dt.describe("Host application identification and version."),hostCapabilities:ql.describe("Features and capabilities provided by the host."),hostContext:Oo.describe("Rich context about the host environment.")}).passthrough();class Hl extends wl{constructor(n,o={},r={autoResize:!0}){super(r);H(this,"_appInfo");H(this,"_capabilities");H(this,"options");H(this,"_hostCapabilities");H(this,"_hostInfo");H(this,"_hostContext");H(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=o,this.options=r,this.setRequestHandler(pt,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(Cl,o=>n(o.params))}set ontoolinputpartial(n){this.setNotificationHandler(Zl,o=>n(o.params))}set ontoolresult(n){this.setNotificationHandler(Ul,o=>n(o.params))}set ontoolcancelled(n){this.setNotificationHandler(xl,o=>n(o.params))}set onhostcontextchanged(n){this.setNotificationHandler(Ll,o=>{this._hostContext={...this._hostContext,...o.params},n(o.params)})}set onteardown(n){this.setRequestHandler(Al,(o,r)=>n(o.params,r))}set oncalltool(n){this.setRequestHandler(Zo,(o,r)=>n(o.params,r))}set onlisttools(n){this.setRequestHandler(Co,(o,r)=>n(o.params,r))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,o){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},ht,o)}async readServerResource(n,o){return await this.request({method:"resources/read",params:n},Io,o)}async listServerResources(n,o){return await this.request({method:"resources/list",params:n},$o,o)}sendMessage(n,o){return this.request({method:"ui/message",params:n},El,o)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,o){return this.request({method:"ui/update-model-context",params:n},Mt,o)}openLink(n,o){return this.request({method:"ui/open-link",params:n},Il,o)}downloadFile(n,o){return this.request({method:"ui/download-file",params:n},Pl,o)}requestDisplayMode(n,o){return this.request({method:"ui/request-display-mode",params:n},jl,o)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,o=0,r=0,s=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.width,l=a.style.height;a.style.width="fit-content",a.style.height="max-content";let h=a.getBoundingClientRect();a.style.width=c,a.style.height=l;let m=window.innerWidth-a.clientWidth,g=Math.ceil(h.width+m),_=Math.ceil(h.height);(g!==o||_!==r)&&(o=g,r=_,this.sendSizeChanged({width:g,height:_}))}))};s();let i=new ResizeObserver(s);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(n=new zl(window.parent,window.parent),o){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:kl}},Fl,o);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}function Jl(e){const t=e.numberOfChannels,n=e.sampleRate,o=e.length,r=2,s=o*t*r,i=44,a=new ArrayBuffer(i+s),c=new DataView(a);Ve(c,0,"RIFF"),c.setUint32(4,36+s,!0),Ve(c,8,"WAVE"),Ve(c,12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,t,!0),c.setUint32(24,n,!0),c.setUint32(28,n*t*r,!0),c.setUint16(32,t*r,!0),c.setUint16(34,16,!0),Ve(c,36,"data"),c.setUint32(40,s,!0);const l=Array.from({length:t},(v,y)=>e.getChannelData(y));let h=44;for(let v=0;v<o;v++)for(let y=0;y<t;y++){const I=Math.max(-1,Math.min(1,l[y][v]));c.setInt16(h,I<0?I*32768:I*32767,!0),h+=2}const m=new Uint8Array(a);let g="";const _=8192;for(let v=0;v<m.length;v+=_)g+=String.fromCharCode(...m.subarray(v,v+_));return btoa(g)}function Ve(e,t,n){for(let o=0;o<n.length;o++)e.setUint8(t+o,n.charCodeAt(o))}const Bl="0.4.2",Vl="https://unpkg.com/@strudel/repl@1.3.0",ae=new Hl({name:"Strudel Live Pattern",version:Bl}),kt=document.getElementById("play-btn"),pe=document.getElementById("record-btn"),_e=document.getElementById("download-btn"),Ke=document.getElementById("send-btn"),Wl=document.getElementById("fullscreen-btn"),St=document.getElementById("viz-btn"),ot=document.querySelector(".repl-section"),We=document.getElementById("test-canvas"),Pn=document.getElementById("status"),zt=document.getElementById("strudel-container");let ie=null,nn="",on=!1,En=!1,ce=!1,No=!1,we=null;const Ao=/\.(pianoroll|punchcard|wordfall|spiral|pitchwheel|tscope|scope|fscope|spectrum)\s*\(/;let Tt=!1,Rt=null,Q=null,Se=[],Pe=!1,ue=null,Ge=null,Qe=null;"audioSession"in navigator&&(navigator.audioSession.type="playback");function Le(){return(ie==null?void 0:ie.editor)??null}function qo(){var t;const e=Le();try{if(typeof(e==null?void 0:e.getCode)=="function")return e.getCode();if(typeof(e==null?void 0:e.code)=="string")return e.code;const n=(e==null?void 0:e.editor)??(e==null?void 0:e.view),o=(t=n==null?void 0:n.state)==null?void 0:t.doc;if(o&&typeof o.toString=="function")return o.toString()}catch{}return nn}let rt=!1;async function Kl(){if(!En)return new Promise((e,t)=>{const n=document.createElement("script");n.src=Vl,n.onload=async()=>{En=!0;try{const o=window.strudel;o!=null&&o.prebake&&await o.prebake(),rt=!1}catch{rt=!0}e()},n.onerror=()=>t(new Error("Failed to load Strudel REPL")),document.head.appendChild(n)})}function M(e,t="normal"){Pn.textContent=e,Pn.className=`status ${t}`}function st(e){on=e,kt.classList.toggle("playing",e),kt.textContent=e?"Playing":"Play",Pe||M(e?"Playing...":"Ready",e?"playing":"normal")}function Gl(e,t){const n=t/60/4,o=Math.round(n*1e4)/1e4;return/setcps\s*\(/.test(e)?e.replace(/setcps\s*\([^)]*\)/,`setcps(${o})`):`setcps(${o})
84
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:d().optional().describe("User's language and region preference in BCP 47 format."),timeZone:d().optional().describe("User's timezone in IANA format."),userAgent:d().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({touch:E().optional().describe("Whether the device supports touch input."),hover:E().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p({top:k().describe("Top safe area inset in pixels."),right:k().describe("Right safe area inset in pixels."),bottom:k().describe("Bottom safe area inset in pixels."),left:k().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Ll=p({method:u("ui/notifications/host-context-changed"),params:Oo.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:w(Ue).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:$(d(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});p({method:u("ui/initialize"),params:p({appInfo:dt.describe("App identification (name and version)."),appCapabilities:Ml.describe("Features and capabilities this app provides."),protocolVersion:d().describe("Protocol version this app supports.")})});var Fl=p({protocolVersion:d().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:dt.describe("Host application identification and version."),hostCapabilities:ql.describe("Features and capabilities provided by the host."),hostContext:Oo.describe("Rich context about the host environment.")}).passthrough();class Hl extends wl{constructor(n,o={},r={autoResize:!0}){super(r);H(this,"_appInfo");H(this,"_capabilities");H(this,"options");H(this,"_hostCapabilities");H(this,"_hostInfo");H(this,"_hostContext");H(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=o,this.options=r,this.setRequestHandler(pt,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(Cl,o=>n(o.params))}set ontoolinputpartial(n){this.setNotificationHandler(Zl,o=>n(o.params))}set ontoolresult(n){this.setNotificationHandler(Ul,o=>n(o.params))}set ontoolcancelled(n){this.setNotificationHandler(xl,o=>n(o.params))}set onhostcontextchanged(n){this.setNotificationHandler(Ll,o=>{this._hostContext={...this._hostContext,...o.params},n(o.params)})}set onteardown(n){this.setRequestHandler(Al,(o,r)=>n(o.params,r))}set oncalltool(n){this.setRequestHandler(Zo,(o,r)=>n(o.params,r))}set onlisttools(n){this.setRequestHandler(Co,(o,r)=>n(o.params,r))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,o){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},ht,o)}async readServerResource(n,o){return await this.request({method:"resources/read",params:n},Io,o)}async listServerResources(n,o){return await this.request({method:"resources/list",params:n},$o,o)}sendMessage(n,o){return this.request({method:"ui/message",params:n},El,o)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,o){return this.request({method:"ui/update-model-context",params:n},Mt,o)}openLink(n,o){return this.request({method:"ui/open-link",params:n},Il,o)}downloadFile(n,o){return this.request({method:"ui/download-file",params:n},Pl,o)}requestDisplayMode(n,o){return this.request({method:"ui/request-display-mode",params:n},jl,o)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,o=0,r=0,s=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.width,l=a.style.height;a.style.width="fit-content",a.style.height="max-content";let h=a.getBoundingClientRect();a.style.width=c,a.style.height=l;let m=window.innerWidth-a.clientWidth,g=Math.ceil(h.width+m),_=Math.ceil(h.height);(g!==o||_!==r)&&(o=g,r=_,this.sendSizeChanged({width:g,height:_}))}))};s();let i=new ResizeObserver(s);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(n=new zl(window.parent,window.parent),o){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:kl}},Fl,o);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}function Jl(e){const t=e.numberOfChannels,n=e.sampleRate,o=e.length,r=2,s=o*t*r,i=44,a=new ArrayBuffer(i+s),c=new DataView(a);Ve(c,0,"RIFF"),c.setUint32(4,36+s,!0),Ve(c,8,"WAVE"),Ve(c,12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,t,!0),c.setUint32(24,n,!0),c.setUint32(28,n*t*r,!0),c.setUint16(32,t*r,!0),c.setUint16(34,16,!0),Ve(c,36,"data"),c.setUint32(40,s,!0);const l=Array.from({length:t},(v,y)=>e.getChannelData(y));let h=44;for(let v=0;v<o;v++)for(let y=0;y<t;y++){const I=Math.max(-1,Math.min(1,l[y][v]));c.setInt16(h,I<0?I*32768:I*32767,!0),h+=2}const m=new Uint8Array(a);let g="";const _=8192;for(let v=0;v<m.length;v+=_)g+=String.fromCharCode(...m.subarray(v,v+_));return btoa(g)}function Ve(e,t,n){for(let o=0;o<n.length;o++)e.setUint8(t+o,n.charCodeAt(o))}const Bl="0.4.3",Vl="https://unpkg.com/@strudel/repl@1.3.0",ae=new Hl({name:"Strudel Live Pattern",version:Bl}),kt=document.getElementById("play-btn"),pe=document.getElementById("record-btn"),_e=document.getElementById("download-btn"),Ke=document.getElementById("send-btn"),Wl=document.getElementById("fullscreen-btn"),St=document.getElementById("viz-btn"),ot=document.querySelector(".repl-section"),We=document.getElementById("test-canvas"),Pn=document.getElementById("status"),zt=document.getElementById("strudel-container");let ie=null,nn="",on=!1,En=!1,ce=!1,No=!1,we=null;const Ao=/\.(pianoroll|punchcard|wordfall|spiral|pitchwheel|tscope|scope|fscope|spectrum)\s*\(/;let Tt=!1,Rt=null,Q=null,Se=[],Pe=!1,ue=null,Ge=null,Qe=null;"audioSession"in navigator&&(navigator.audioSession.type="playback");function Le(){return(ie==null?void 0:ie.editor)??null}function qo(){var t;const e=Le();try{if(typeof(e==null?void 0:e.getCode)=="function")return e.getCode();if(typeof(e==null?void 0:e.code)=="string")return e.code;const n=(e==null?void 0:e.editor)??(e==null?void 0:e.view),o=(t=n==null?void 0:n.state)==null?void 0:t.doc;if(o&&typeof o.toString=="function")return o.toString()}catch{}return nn}let rt=!1;async function Kl(){if(!En)return new Promise((e,t)=>{const n=document.createElement("script");n.src=Vl,n.onload=async()=>{En=!0;try{const o=window.strudel;o!=null&&o.prebake&&await o.prebake(),rt=!1}catch{rt=!0}e()},n.onerror=()=>t(new Error("Failed to load Strudel REPL")),document.head.appendChild(n)})}function M(e,t="normal"){Pn.textContent=e,Pn.className=`status ${t}`}function st(e){on=e,kt.classList.toggle("playing",e),kt.textContent=e?"Playing":"Play",Pe||M(e?"Playing...":"Ready",e?"playing":"normal")}function Gl(e,t){const n=t/60/4,o=Math.round(n*1e4)/1e4;return/setcps\s*\(/.test(e)?e.replace(/setcps\s*\([^)]*\)/,`setcps(${o})`):`setcps(${o})
85
85
  ${e}`}function Ql(e=8e3){return new Promise((t,n)=>{const o=Date.now(),r=()=>{const s=Le();s!=null&&s.setCode?t(s):Date.now()-o>e?n(new Error("Strudel editor did not initialize")):setTimeout(r,150)};r()})}function gt(){if(document.querySelectorAll("body > canvas").forEach(e=>{if(e.id==="test-canvas")return;const t=e.style;t.position==="fixed"&&(t.display="none")}),ie!=null&&ie.nextElementSibling){const e=ie.nextElementSibling;e.querySelector(".cm-editor")&&(e.style.minHeight="200px",e.style.flex="1")}}function Mo(){if(!ce)return;const e=ot.clientWidth,t=ot.clientHeight;if(e===0||t===0)return;const n=window.devicePixelRatio||1,o=Math.round(e*n),r=Math.round(t*n);We.width!==o&&(We.width=o),We.height!==r&&(We.height=r)}function jo(){ot.classList.toggle("viz-on",ce),St.classList.toggle("active",ce),St.setAttribute("aria-pressed",String(ce)),ce&&requestAnimationFrame(Mo)}function Yl(){var e,t,n;try{const o=(e=window.getAudioContext)==null?void 0:e.call(window);if(!o)return null;const r=o.createMediaStreamDestination(),s=(t=window.getSuperdoughAudioController)==null?void 0:t.call(window),i=(n=s==null?void 0:s.output)==null?void 0:n.destinationGain;return i!=null&&i.connect?(i.connect(r),Ge=i,Qe=r,r.stream):null}catch{return null}}function Xl(){if(ue||(ue=Yl()),!ue){M("Recording not available","error");return}Se=[];try{Q=new MediaRecorder(ue,{mimeType:MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm"})}catch{M("Recording not supported","error");return}Q.ondataavailable=e=>{e.data.size>0&&Se.push(e.data)},Q.onstop=()=>{_e.disabled=Se.length===0},Q.start(100),Pe=!0,pe.classList.add("recording"),pe.textContent="Stop Rec",M("Recording...","playing")}function rn(){(Q==null?void 0:Q.state)==="recording"&&Q.stop(),Pe=!1,pe.classList.remove("recording"),pe.textContent="Record",on?M("Playing...","playing"):M("Ready","normal")}async function ed(){var e;if(Se.length!==0){if(!Tt){M("Download not supported on this host","error");return}_e.disabled=!0,_e.textContent="...";try{const n=await new Blob(Se,{type:"audio/webm"}).arrayBuffer(),o=(e=window.getAudioContext)==null?void 0:e.call(window);if(!o)throw new Error("No audio context");const r=await o.decodeAudioData(n),s=Jl(r);await ae.downloadFile({contents:[{type:"resource",resource:{uri:"file:///strudel-recording.wav",mimeType:"audio/wav",blob:s}}]})}catch(t){M(`Download failed: ${t.message}`,"error")}finally{_e.textContent="↓",_e.disabled=Se.length===0}}}function td(){zt.replaceChildren(),ie=null;const e=document.createElement("div");e.className="cdn-error";const t=document.createElement("p");t.textContent="Couldn't load the Strudel player (network or CDN issue).",e.appendChild(t);const n=document.createElement("button");n.className="retry-btn",n.textContent="Retry loading",n.setAttribute("aria-label","Retry loading Strudel player"),n.addEventListener("click",()=>{Rt&&Do(Rt)}),e.appendChild(n),zt.appendChild(e)}async function Do(e){const t=e.code;if(!t)return;Rt=e;const n=e.bpm,o=e.autoplay;try{M("Loading Strudel...");try{await Kl()}catch{M("Failed to load Strudel — click Retry","error"),td();return}let r=t;if(n&&(r=Gl(r,n)),nn=r,!No){const a=r.replace(/(^|[^:])\/\/.*$/gm,"$1");ce=Ao.test(a),jo()}if(!ie){const a=document.createElement("strudel-editor");zt.replaceChildren(a),ie=a}M("Initializing...");const s=await Ql();gt(),setTimeout(gt,500),setTimeout(gt,1500),s.setCode(r),pe.disabled=!1;const i=rt?" (soundfonts unavailable — audio may be silent)":"";if(o!==!1)try{s.evaluate(r,!0),st(!0),rt&&M(`Playing...${i}`,"playing")}catch{M(`Click Play to start${i}`,"normal")}else M(`Ready — click Play or Ctrl+Enter${i}`,"normal")}catch(r){M(`Error: ${r.message}`,"error")}}kt.addEventListener("click",()=>{const e=Le();if(e)try{on?(Pe&&rn(),e.stop(),st(!1)):(e.evaluate(nn,!0),st(!0))}catch(t){M(`Playback error: ${t.message}`,"error")}});pe.addEventListener("click",()=>{Pe?rn():Xl()});_e.addEventListener("click",()=>{ed()});Ke.addEventListener("click",async()=>{const e=qo().trim();if(e){Ke.disabled=!0;try{await ae.sendMessage({role:"user",content:[{type:"text",text:"Here's my edited Strudel pattern:\n```\n"+e+"\n```"}]})}catch(t){M(`Send failed: ${t.message}`,"error")}finally{Ke.disabled=!1}}});Wl.addEventListener("click",()=>{ae.requestDisplayMode({mode:"fullscreen"})});St.addEventListener("click",()=>{if(!ce&&!Ao.test(qo())){M("Add .scope(), .pianoroll() or .spectrum() to the pattern to see visuals","normal");return}No=!0,ce=!ce,jo()});we=new ResizeObserver(()=>Mo());we.observe(ot);ae.ontoolinput=e=>{Do(e.arguments??{})};ae.ontoolinputpartial=e=>{var o;const t=(o=e.arguments)==null?void 0:o.code;if(!t)return;M("Composing pattern...");const n=Le();n!=null&&n.setCode&&n.setCode(t)};ae.ontoolcancelled=e=>{const t=e!=null&&e.reason?` (${e.reason})`:"";M(`Generation cancelled${t}.`,"normal")};ae.onteardown=()=>{var e;try{Pe&&rn(),(Q==null?void 0:Q.state)==="recording"&&Q.stop(),Q=null;const t=Le();if((e=t==null?void 0:t.stop)==null||e.call(t),st(!1),Ge&&Qe)try{Ge.disconnect(Qe)}catch{}Ge=null,Qe=null,ue==null||ue.getTracks().forEach(n=>n.stop()),ue=null,we==null||we.disconnect(),we=null}catch{}return{}};ae.onerror=console.error;ae.connect().then(()=>{const e=ae.getHostCapabilities();Tt=!!(e!=null&&e.downloadFile),Tt||(_e.hidden=!0,pe.hidden=!0,pe.title="Recording export not supported on this host"),e!=null&&e.message&&(Ke.hidden=!1)});</script>
86
86
  <style rel="stylesheet" crossorigin>:root{color-scheme:light dark;--bg: #ffffff;--surface: #f8f9fa;--border: #e0e0e0;--text: #1a1a1a;--text-secondary: #666;--accent: #7c3aed;--accent-hover: #6d28d9;--success: #10b981;--error: #ef4444}@media(prefers-color-scheme:dark){:root{--bg: #1a1a1a;--surface: #252525;--border: #333;--text: #e0e0e0;--text-secondary: #999;--accent: #a78bfa;--accent-hover: #8b5cf6}}*{margin:0;padding:0;box-sizing:border-box}html,body{height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text)}.main{display:flex;flex-direction:column;height:100%;min-height:200px}.header{padding:8px 12px;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}.toolbar{display:flex;align-items:center;gap:8px}.control-btn{padding:6px 16px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--text);cursor:pointer;font-size:13px;font-weight:500;transition:all .15s}.control-btn:hover{border-color:var(--accent);color:var(--accent)}.control-btn.playing{background:var(--accent);color:#fff;border-color:var(--accent)}.control-btn.recording{background:var(--error);color:#fff;border-color:var(--error)}.control-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}.control-btn:disabled{opacity:.4;cursor:default}.control-btn:disabled:hover{border-color:var(--border);color:var(--text)}.status{font-size:12px;color:var(--text-secondary);margin-left:auto}.status.playing{color:var(--success)}.status.error{color:var(--error)}.repl-section{flex:1;position:relative;overflow:hidden;min-height:350px}.viz-canvas{display:none;position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:0;pointer-events:none;background:#14111d}.strudel-container{position:relative;z-index:1;width:100%;height:100%;overflow:auto;min-height:350px}.repl-section.viz-on .viz-canvas{display:block}.repl-section.viz-on .strudel-container>div{height:100%!important;background-color:transparent!important}.repl-section.viz-on .cm-editor{height:100%!important;background-color:transparent!important}.repl-section.viz-on .cm-scroller{height:100%!important;background-color:#14111d80!important}.repl-section.viz-on .cm-gutters{background-color:#14111d4d!important}.repl-section.viz-on .cm-content{text-shadow:0 1px 2px rgba(0,0,0,.95)}.cdn-error{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:350px;padding:24px;text-align:center;color:var(--text-secondary)}.cdn-error .retry-btn{padding:8px 20px;border:1px solid var(--accent);border-radius:6px;background:var(--surface);color:var(--accent);cursor:pointer;font-size:14px;font-weight:500}.cdn-error .retry-btn:hover{background:var(--accent);color:#fff}body>canvas[style*=position]:not(#test-canvas){display:none!important}strudel-editor{display:block;width:100%}.strudel-container>div:has(.cm-editor){min-height:350px!important;width:100%!important}.cm-editor{min-height:350px!important}.cm-scroller{min-height:300px!important;overflow:auto!important}</style>
87
87
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-music-studio",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "Two-mode MCP music studio: scored composition (ABC notation) and live performance (Strudel). Interactive ext-apps UI with sheet music rendering, 30+ instruments, style presets, and live coding REPL.",
6
6
  "keywords": [