sonicake-pocket-master-mcp 0.12.0 → 0.12.2

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.
@@ -46,7 +46,7 @@ var OFFSET = {
46
46
  var MIN_LENGTH = OFFSET.btRecLevel + 1;
47
47
 
48
48
  // ../../packages/core/src/commands.ts
49
- var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73, FOOTSWITCH: 77 };
49
+ var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73 };
50
50
  var ALLOWED_EDITS = new Set(Object.values(EditCommand));
51
51
 
52
52
  // ../../packages/core/src/slots.ts
package/dist/server.js CHANGED
@@ -125,7 +125,7 @@ function isReply(frame, kind) {
125
125
 
126
126
  // ../../packages/core/src/catalog.json
127
127
  var catalog_default = {
128
- _source: "Copied from github.com/voronkovd/pocket-master-mcp (MIT), src/pocket_master_mcp/data/device_map.json, which derives it from PocketEdit (github.com/suckyble/PocketEdit). See NOTICE. Sync and Trail switches added from SonicMaster (github.com/skyggedans/SonicMaster, MIT, effect_library.json at 931a68f).",
128
+ _source: "Copied from github.com/voronkovd/pocket-master-mcp (MIT), src/pocket_master_mcp/data/device_map.json, which derives it from PocketEdit (github.com/suckyble/PocketEdit). See NOTICE.",
129
129
  blocks: [
130
130
  {
131
131
  key: "nr",
@@ -323,8 +323,7 @@ var catalog_default = {
323
323
  max: 10,
324
324
  step: 0.1,
325
325
  unit: "Hz",
326
- default: 0.5,
327
- syncedBy: 6
326
+ default: 0.5
328
327
  },
329
328
  {
330
329
  name: "Vol",
@@ -357,12 +356,6 @@ var catalog_default = {
357
356
  max: 100,
358
357
  step: 1,
359
358
  default: 60
360
- },
361
- {
362
- name: "Sync",
363
- alg: 6,
364
- type: "switch",
365
- default: 0
366
359
  }
367
360
  ]
368
361
  },
@@ -413,8 +406,7 @@ var catalog_default = {
413
406
  max: 10,
414
407
  step: 0.1,
415
408
  unit: "Hz",
416
- default: 0.5,
417
- syncedBy: 3
409
+ default: 0.5
418
410
  },
419
411
  {
420
412
  name: "Tone",
@@ -423,12 +415,6 @@ var catalog_default = {
423
415
  max: 100,
424
416
  step: 1,
425
417
  default: 50
426
- },
427
- {
428
- name: "Sync",
429
- alg: 3,
430
- type: "switch",
431
- default: 0
432
418
  }
433
419
  ]
434
420
  },
@@ -452,8 +438,7 @@ var catalog_default = {
452
438
  max: 10,
453
439
  step: 0.1,
454
440
  unit: "Hz",
455
- default: 0.5,
456
- syncedBy: 3
441
+ default: 0.5
457
442
  },
458
443
  {
459
444
  name: "Vol",
@@ -462,12 +447,6 @@ var catalog_default = {
462
447
  max: 100,
463
448
  step: 1,
464
449
  default: 50
465
- },
466
- {
467
- name: "Sync",
468
- alg: 3,
469
- type: "switch",
470
- default: 0
471
450
  }
472
451
  ]
473
452
  },
@@ -491,8 +470,7 @@ var catalog_default = {
491
470
  max: 10,
492
471
  step: 0.1,
493
472
  unit: "Hz",
494
- default: 0.5,
495
- syncedBy: 4
473
+ default: 0.5
496
474
  },
497
475
  {
498
476
  name: "P.Delay",
@@ -509,12 +487,6 @@ var catalog_default = {
509
487
  max: 100,
510
488
  step: 1,
511
489
  default: 50
512
- },
513
- {
514
- name: "Sync",
515
- alg: 4,
516
- type: "switch",
517
- default: 0
518
490
  }
519
491
  ]
520
492
  },
@@ -530,14 +502,7 @@ var catalog_default = {
530
502
  max: 10,
531
503
  step: 0.1,
532
504
  unit: "Hz",
533
- default: 0.5,
534
- syncedBy: 1
535
- },
536
- {
537
- name: "Sync",
538
- alg: 1,
539
- type: "switch",
540
- default: 0
505
+ default: 0.5
541
506
  }
542
507
  ]
543
508
  },
@@ -561,14 +526,7 @@ var catalog_default = {
561
526
  max: 10,
562
527
  step: 0.1,
563
528
  unit: "Hz",
564
- default: 0.5,
565
- syncedBy: 2
566
- },
567
- {
568
- name: "Sync",
569
- alg: 2,
570
- type: "switch",
571
- default: 0
529
+ default: 0.5
572
530
  }
573
531
  ]
574
532
  },
@@ -592,14 +550,7 @@ var catalog_default = {
592
550
  max: 10,
593
551
  step: 0.1,
594
552
  unit: "Hz",
595
- default: 0.5,
596
- syncedBy: 2
597
- },
598
- {
599
- name: "Sync",
600
- alg: 2,
601
- type: "switch",
602
- default: 0
553
+ default: 0.5
603
554
  }
604
555
  ]
605
556
  },
@@ -623,14 +574,7 @@ var catalog_default = {
623
574
  max: 10,
624
575
  step: 0.1,
625
576
  unit: "Hz",
626
- default: 0.5,
627
- syncedBy: 2
628
- },
629
- {
630
- name: "Sync",
631
- alg: 2,
632
- type: "switch",
633
- default: 0
577
+ default: 0.5
634
578
  }
635
579
  ]
636
580
  },
@@ -654,8 +598,7 @@ var catalog_default = {
654
598
  max: 10,
655
599
  step: 0.1,
656
600
  unit: "Hz",
657
- default: 0.5,
658
- syncedBy: 3
601
+ default: 0.5
659
602
  },
660
603
  {
661
604
  name: "Vol",
@@ -664,12 +607,6 @@ var catalog_default = {
664
607
  max: 100,
665
608
  step: 1,
666
609
  default: 50
667
- },
668
- {
669
- name: "Sync",
670
- alg: 3,
671
- type: "switch",
672
- default: 0
673
610
  }
674
611
  ]
675
612
  },
@@ -693,8 +630,7 @@ var catalog_default = {
693
630
  max: 10,
694
631
  step: 0.1,
695
632
  unit: "Hz",
696
- default: 0.5,
697
- syncedBy: 3
633
+ default: 0.5
698
634
  },
699
635
  {
700
636
  name: "Vol",
@@ -704,12 +640,6 @@ var catalog_default = {
704
640
  step: 1,
705
641
  default: 50
706
642
  },
707
- {
708
- name: "Sync",
709
- alg: 3,
710
- type: "switch",
711
- default: 0
712
- },
713
643
  {
714
644
  name: "Bias",
715
645
  alg: 4,
@@ -2756,8 +2686,7 @@ var catalog_default = {
2756
2686
  max: 10,
2757
2687
  step: 0.1,
2758
2688
  unit: "Hz",
2759
- default: 0.5,
2760
- syncedBy: 6
2689
+ default: 0.5
2761
2690
  },
2762
2691
  {
2763
2692
  name: "Vol",
@@ -2790,12 +2719,6 @@ var catalog_default = {
2790
2719
  max: 100,
2791
2720
  step: 1,
2792
2721
  default: 60
2793
- },
2794
- {
2795
- name: "Sync",
2796
- alg: 6,
2797
- type: "switch",
2798
- default: 0
2799
2722
  }
2800
2723
  ]
2801
2724
  },
@@ -2956,8 +2879,7 @@ var catalog_default = {
2956
2879
  max: 10,
2957
2880
  step: 0.1,
2958
2881
  unit: "Hz",
2959
- default: 0.5,
2960
- syncedBy: 3
2882
+ default: 0.5
2961
2883
  },
2962
2884
  {
2963
2885
  name: "Tone",
@@ -2966,12 +2888,6 @@ var catalog_default = {
2966
2888
  max: 100,
2967
2889
  step: 1,
2968
2890
  default: 50
2969
- },
2970
- {
2971
- name: "Sync",
2972
- alg: 3,
2973
- type: "switch",
2974
- default: 0
2975
2891
  }
2976
2892
  ]
2977
2893
  },
@@ -2995,8 +2911,7 @@ var catalog_default = {
2995
2911
  max: 10,
2996
2912
  step: 0.1,
2997
2913
  unit: "Hz",
2998
- default: 0.5,
2999
- syncedBy: 3
2914
+ default: 0.5
3000
2915
  },
3001
2916
  {
3002
2917
  name: "Vol",
@@ -3005,12 +2920,6 @@ var catalog_default = {
3005
2920
  max: 100,
3006
2921
  step: 1,
3007
2922
  default: 50
3008
- },
3009
- {
3010
- name: "Sync",
3011
- alg: 3,
3012
- type: "switch",
3013
- default: 0
3014
2923
  }
3015
2924
  ]
3016
2925
  },
@@ -3034,8 +2943,7 @@ var catalog_default = {
3034
2943
  max: 10,
3035
2944
  step: 0.1,
3036
2945
  unit: "Hz",
3037
- default: 0.5,
3038
- syncedBy: 4
2946
+ default: 0.5
3039
2947
  },
3040
2948
  {
3041
2949
  name: "P.Delay",
@@ -3052,12 +2960,6 @@ var catalog_default = {
3052
2960
  max: 100,
3053
2961
  step: 1,
3054
2962
  default: 50
3055
- },
3056
- {
3057
- name: "Sync",
3058
- alg: 4,
3059
- type: "switch",
3060
- default: 0
3061
2963
  }
3062
2964
  ]
3063
2965
  },
@@ -3073,14 +2975,7 @@ var catalog_default = {
3073
2975
  max: 10,
3074
2976
  step: 0.1,
3075
2977
  unit: "Hz",
3076
- default: 0.5,
3077
- syncedBy: 1
3078
- },
3079
- {
3080
- name: "Sync",
3081
- alg: 1,
3082
- type: "switch",
3083
- default: 0
2978
+ default: 0.5
3084
2979
  }
3085
2980
  ]
3086
2981
  },
@@ -3104,14 +2999,7 @@ var catalog_default = {
3104
2999
  max: 10,
3105
3000
  step: 0.1,
3106
3001
  unit: "Hz",
3107
- default: 0.5,
3108
- syncedBy: 2
3109
- },
3110
- {
3111
- name: "Sync",
3112
- alg: 2,
3113
- type: "switch",
3114
- default: 0
3002
+ default: 0.5
3115
3003
  }
3116
3004
  ]
3117
3005
  },
@@ -3135,14 +3023,7 @@ var catalog_default = {
3135
3023
  max: 10,
3136
3024
  step: 0.1,
3137
3025
  unit: "Hz",
3138
- default: 0.5,
3139
- syncedBy: 2
3140
- },
3141
- {
3142
- name: "Sync",
3143
- alg: 2,
3144
- type: "switch",
3145
- default: 0
3026
+ default: 0.5
3146
3027
  }
3147
3028
  ]
3148
3029
  },
@@ -3166,14 +3047,7 @@ var catalog_default = {
3166
3047
  max: 10,
3167
3048
  step: 0.1,
3168
3049
  unit: "Hz",
3169
- default: 0.5,
3170
- syncedBy: 2
3171
- },
3172
- {
3173
- name: "Sync",
3174
- alg: 2,
3175
- type: "switch",
3176
- default: 0
3050
+ default: 0.5
3177
3051
  }
3178
3052
  ]
3179
3053
  },
@@ -3197,8 +3071,7 @@ var catalog_default = {
3197
3071
  max: 10,
3198
3072
  step: 0.1,
3199
3073
  unit: "Hz",
3200
- default: 0.5,
3201
- syncedBy: 3
3074
+ default: 0.5
3202
3075
  },
3203
3076
  {
3204
3077
  name: "Vol",
@@ -3207,12 +3080,6 @@ var catalog_default = {
3207
3080
  max: 100,
3208
3081
  step: 1,
3209
3082
  default: 50
3210
- },
3211
- {
3212
- name: "Sync",
3213
- alg: 3,
3214
- type: "switch",
3215
- default: 0
3216
3083
  }
3217
3084
  ]
3218
3085
  },
@@ -3236,8 +3103,7 @@ var catalog_default = {
3236
3103
  max: 10,
3237
3104
  step: 0.1,
3238
3105
  unit: "Hz",
3239
- default: 0.5,
3240
- syncedBy: 3
3106
+ default: 0.5
3241
3107
  },
3242
3108
  {
3243
3109
  name: "Vol",
@@ -3247,12 +3113,6 @@ var catalog_default = {
3247
3113
  step: 1,
3248
3114
  default: 50
3249
3115
  },
3250
- {
3251
- name: "Sync",
3252
- alg: 3,
3253
- type: "switch",
3254
- default: 0
3255
- },
3256
3116
  {
3257
3117
  name: "Bias",
3258
3118
  alg: 4,
@@ -3285,8 +3145,7 @@ var catalog_default = {
3285
3145
  max: 1e3,
3286
3146
  step: 1,
3287
3147
  unit: "ms",
3288
- default: 500,
3289
- syncedBy: 3
3148
+ default: 500
3290
3149
  },
3291
3150
  {
3292
3151
  name: "F.Back",
@@ -3295,18 +3154,6 @@ var catalog_default = {
3295
3154
  max: 100,
3296
3155
  step: 1,
3297
3156
  default: 30
3298
- },
3299
- {
3300
- name: "Sync",
3301
- alg: 3,
3302
- type: "switch",
3303
- default: 0
3304
- },
3305
- {
3306
- name: "Trail",
3307
- alg: 4,
3308
- type: "switch",
3309
- default: 0
3310
3157
  }
3311
3158
  ]
3312
3159
  },
@@ -3339,12 +3186,6 @@ var catalog_default = {
3339
3186
  max: 100,
3340
3187
  step: 1,
3341
3188
  default: 30
3342
- },
3343
- {
3344
- name: "Trail",
3345
- alg: 4,
3346
- type: "switch",
3347
- default: 0
3348
3189
  }
3349
3190
  ]
3350
3191
  },
@@ -3368,8 +3209,7 @@ var catalog_default = {
3368
3209
  max: 1e3,
3369
3210
  step: 1,
3370
3211
  unit: "ms",
3371
- default: 500,
3372
- syncedBy: 3
3212
+ default: 500
3373
3213
  },
3374
3214
  {
3375
3215
  name: "F.Back",
@@ -3378,18 +3218,6 @@ var catalog_default = {
3378
3218
  max: 100,
3379
3219
  step: 1,
3380
3220
  default: 30
3381
- },
3382
- {
3383
- name: "Sync",
3384
- alg: 3,
3385
- type: "switch",
3386
- default: 0
3387
- },
3388
- {
3389
- name: "Trail",
3390
- alg: 4,
3391
- type: "switch",
3392
- default: 0
3393
3221
  }
3394
3222
  ]
3395
3223
  },
@@ -3413,8 +3241,7 @@ var catalog_default = {
3413
3241
  max: 1e3,
3414
3242
  step: 1,
3415
3243
  unit: "ms",
3416
- default: 500,
3417
- syncedBy: 3
3244
+ default: 500
3418
3245
  },
3419
3246
  {
3420
3247
  name: "F.Back",
@@ -3423,18 +3250,6 @@ var catalog_default = {
3423
3250
  max: 100,
3424
3251
  step: 1,
3425
3252
  default: 30
3426
- },
3427
- {
3428
- name: "Sync",
3429
- alg: 3,
3430
- type: "switch",
3431
- default: 0
3432
- },
3433
- {
3434
- name: "Trail",
3435
- alg: 4,
3436
- type: "switch",
3437
- default: 0
3438
3253
  }
3439
3254
  ]
3440
3255
  },
@@ -3458,8 +3273,7 @@ var catalog_default = {
3458
3273
  max: 1e3,
3459
3274
  step: 1,
3460
3275
  unit: "ms",
3461
- default: 500,
3462
- syncedBy: 3
3276
+ default: 500
3463
3277
  },
3464
3278
  {
3465
3279
  name: "F.Back",
@@ -3468,18 +3282,6 @@ var catalog_default = {
3468
3282
  max: 100,
3469
3283
  step: 1,
3470
3284
  default: 30
3471
- },
3472
- {
3473
- name: "Sync",
3474
- alg: 3,
3475
- type: "switch",
3476
- default: 0
3477
- },
3478
- {
3479
- name: "Trail",
3480
- alg: 4,
3481
- type: "switch",
3482
- default: 0
3483
3285
  }
3484
3286
  ]
3485
3287
  },
@@ -3503,8 +3305,7 @@ var catalog_default = {
3503
3305
  max: 500,
3504
3306
  step: 1,
3505
3307
  unit: "ms",
3506
- default: 500,
3507
- syncedBy: 3
3308
+ default: 500
3508
3309
  },
3509
3310
  {
3510
3311
  name: "F.Back",
@@ -3513,18 +3314,6 @@ var catalog_default = {
3513
3314
  max: 100,
3514
3315
  step: 1,
3515
3316
  default: 30
3516
- },
3517
- {
3518
- name: "Sync",
3519
- alg: 3,
3520
- type: "switch",
3521
- default: 0
3522
- },
3523
- {
3524
- name: "Trail",
3525
- alg: 4,
3526
- type: "switch",
3527
- default: 0
3528
3317
  }
3529
3318
  ]
3530
3319
  },
@@ -3548,8 +3337,7 @@ var catalog_default = {
3548
3337
  max: 1e3,
3549
3338
  step: 1,
3550
3339
  unit: "ms",
3551
- default: 500,
3552
- syncedBy: 3
3340
+ default: 500
3553
3341
  },
3554
3342
  {
3555
3343
  name: "F.Back",
@@ -3558,18 +3346,6 @@ var catalog_default = {
3558
3346
  max: 100,
3559
3347
  step: 1,
3560
3348
  default: 30
3561
- },
3562
- {
3563
- name: "Sync",
3564
- alg: 3,
3565
- type: "switch",
3566
- default: 0
3567
- },
3568
- {
3569
- name: "Trail",
3570
- alg: 4,
3571
- type: "switch",
3572
- default: 0
3573
3349
  }
3574
3350
  ]
3575
3351
  },
@@ -3593,8 +3369,7 @@ var catalog_default = {
3593
3369
  max: 1e3,
3594
3370
  step: 1,
3595
3371
  unit: "ms",
3596
- default: 500,
3597
- syncedBy: 6
3372
+ default: 500
3598
3373
  },
3599
3374
  {
3600
3375
  name: "F.Back",
@@ -3619,18 +3394,6 @@ var catalog_default = {
3619
3394
  max: 100,
3620
3395
  step: 1,
3621
3396
  default: 50
3622
- },
3623
- {
3624
- name: "Trail",
3625
- alg: 5,
3626
- type: "switch",
3627
- default: 0
3628
- },
3629
- {
3630
- name: "Sync",
3631
- alg: 6,
3632
- type: "switch",
3633
- default: 0
3634
3397
  }
3635
3398
  ]
3636
3399
  },
@@ -3654,8 +3417,7 @@ var catalog_default = {
3654
3417
  max: 500,
3655
3418
  step: 1,
3656
3419
  unit: "ms",
3657
- default: 500,
3658
- syncedBy: 3
3420
+ default: 500
3659
3421
  },
3660
3422
  {
3661
3423
  name: "F.Back",
@@ -3664,18 +3426,6 @@ var catalog_default = {
3664
3426
  max: 100,
3665
3427
  step: 1,
3666
3428
  default: 30
3667
- },
3668
- {
3669
- name: "Sync",
3670
- alg: 3,
3671
- type: "switch",
3672
- default: 0
3673
- },
3674
- {
3675
- name: "Trail",
3676
- alg: 4,
3677
- type: "switch",
3678
- default: 0
3679
3429
  }
3680
3430
  ]
3681
3431
  }
@@ -4204,16 +3954,8 @@ function findCloneModel(code) {
4204
3954
  return modelsFor(CLONE_KEY).find((m) => (m.code & LOW_24_BITS) === (code & LOW_24_BITS));
4205
3955
  }
4206
3956
 
4207
- // ../../packages/core/src/sync.ts
4208
- var SYNC_DIVISIONS = ["1/1", "1/2", "1/2D", "1/2T", "1/4", "1/4D", "1/4T", "1/8", "1/8D", "1/8T", "1/16"];
4209
- function effectiveSpec(spec, valueOf) {
4210
- if (spec.syncedBy === void 0 || (valueOf(spec.syncedBy) ?? 0) < 0.5) return spec;
4211
- return { name: spec.name, alg: spec.alg, type: "select", options: SYNC_DIVISIONS, default: 4, syncedBy: spec.syncedBy };
4212
- }
4213
-
4214
3957
  // ../../packages/core/src/dump.ts
4215
3958
  var Tag = { VOLUME: 8193, BPM: 8194, STATES: 12289, CHAIN: 12290, EFFECTS: 12291, PARAMS: 12292 };
4216
- var FOOTSWITCH_GROUP = 3;
4217
3959
  var REQUIRED = [Tag.STATES, Tag.CHAIN, Tag.EFFECTS, Tag.PARAMS];
4218
3960
  var MIN_SIZE = /* @__PURE__ */ new Map([
4219
3961
  [Tag.STATES, 4],
@@ -4249,9 +3991,6 @@ function decodePreset(payload) {
4249
3991
  const order = readChain(tags.get(Tag.CHAIN));
4250
3992
  const volume = tags.has(Tag.VOLUME) ? view(Tag.VOLUME).getUint32(0, true) : null;
4251
3993
  const bpm = tags.has(Tag.BPM) ? view(Tag.BPM).getUint32(0, true) : null;
4252
- const switches = groups.get(FOOTSWITCH_GROUP);
4253
- const masks = switches && switches.length >= 8 ? [dataView(switches).getUint32(0, true), dataView(switches).getUint32(4, true)] : [0, 0];
4254
- const footswitchOf = (module) => masks[0] >> module & 1 ? "fs1" : masks[1] >> module & 1 ? "fs2" : null;
4255
3994
  const chain = order.map((module) => {
4256
3995
  const source = module === AMP_MODULE && ampMode === "clone" ? CLONE_MODULE : module;
4257
3996
  const spec = blockByModule(module);
@@ -4263,7 +4002,6 @@ function decodePreset(payload) {
4263
4002
  label: spec?.label ?? key.toUpperCase(),
4264
4003
  module,
4265
4004
  on: (mask >> module & 1) === 1,
4266
- footswitch: footswitchOf(module),
4267
4005
  model: model?.name ?? `0x${code.toString(16).toUpperCase().padStart(8, "0")}`,
4268
4006
  code,
4269
4007
  params: decodeParams(model, params, source)
@@ -4273,10 +4011,7 @@ function decodePreset(payload) {
4273
4011
  }
4274
4012
  function decodeParams(model, view, module) {
4275
4013
  if (!model) return [];
4276
- return model.params.filter((p) => view.byteLength >= PARAM_STRIDE * module + 4 * p.alg + 4).map((p) => {
4277
- const raw = (alg) => view.byteLength >= PARAM_STRIDE * module + 4 * alg + 4 ? view.getFloat32(PARAM_STRIDE * module + 4 * alg, true) : void 0;
4278
- return toParam(effectiveSpec(p, raw), raw(p.alg));
4279
- });
4014
+ return model.params.filter((p) => view.byteLength >= PARAM_STRIDE * module + 4 * p.alg + 4).map((p) => toParam(p, view.getFloat32(PARAM_STRIDE * module + 4 * p.alg, true)));
4280
4015
  }
4281
4016
  function toParam(p, value) {
4282
4017
  const kind = p.type ?? "number";
@@ -4485,7 +4220,7 @@ function decodeGlobals(payload) {
4485
4220
  }
4486
4221
 
4487
4222
  // ../../packages/core/src/commands.ts
4488
- var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73, FOOTSWITCH: 77 };
4223
+ var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73 };
4489
4224
  var ALLOWED_EDITS = new Set(Object.values(EditCommand));
4490
4225
  var MODULE_COUNT2 = 9;
4491
4226
  var FIXED_GROUP = [2, 3, 4, 5];
@@ -4549,16 +4284,11 @@ function editKey(sysex) {
4549
4284
  const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
4550
4285
  const command = payload[1] ?? 0;
4551
4286
  if (command === EditCommand.CHAIN) return "chain";
4552
- if (isGlobalWrite(payload)) return `global:${payload[1]}:${payload[2]}:${payload[3]}`;
4287
+ if (isGlobalWrite(payload)) return payload[1] === 17 ? `global:${payload[2]}:${payload[3]}` : `target:${payload[1]}:${payload[2]}`;
4553
4288
  if (command === EditCommand.PRESET_FIELD) return `field:${payload[2]}`;
4554
- if (command === EditCommand.FOOTSWITCH) return `footswitch:${payload[2]}:${payload[3]}`;
4555
4289
  const module = view.getUint32(2, true);
4556
4290
  return command === EditCommand.PARAM ? `${command}:${module}:${view.getUint32(6, true)}` : `${command}:${module}`;
4557
4291
  }
4558
- function setFootswitch(footswitch, module, on) {
4559
- if (!Number.isInteger(module) || module < 0 || module >= MODULE_COUNT2) throw new Error(`module must be 0..${MODULE_COUNT2 - 1}`);
4560
- return buildFrame([MessageType.SET, EditCommand.FOOTSWITCH, footswitch === "fs2" ? 1 : 0, module, on ? 1 : 0]);
4561
- }
4562
4292
  function encodeValue(spec, input) {
4563
4293
  if (spec.type === "switch") return input === true || input === 1 || input === "on" ? 1 : 0;
4564
4294
  if (spec.type === "select") {
@@ -4663,7 +4393,6 @@ function userIrSlot(code) {
4663
4393
  }
4664
4394
 
4665
4395
  // ../../packages/core/src/edit.ts
4666
- var FOOTSWITCH_CAPACITY = 3;
4667
4396
  var AMP_MODULE2 = 3;
4668
4397
  var IR_MODULE = 4;
4669
4398
  var NR_MODULE = 0;
@@ -4672,8 +4401,6 @@ function applyEdit(preset, edit) {
4672
4401
  case "volume":
4673
4402
  setPresetVolume(edit.value);
4674
4403
  return { ...preset, volume: edit.value };
4675
- case "footswitch":
4676
- return mapBlock(preset, edit.module, (b) => ({ ...b, footswitch: edit.footswitch }));
4677
4404
  case "chain": {
4678
4405
  validateChain(edit.order);
4679
4406
  const byModule = new Map(preset.chain.map((b) => [b.module, b]));
@@ -4686,15 +4413,7 @@ function applyEdit(preset, edit) {
4686
4413
  const specs = modelOf(preset, b)?.params ?? [];
4687
4414
  const spec = specs.find((p) => p.alg === edit.alg);
4688
4415
  if (!spec) throw new Error(`${b.label} (${b.model}) has no parameter in slot ${edit.alg}`);
4689
- const value = (alg) => alg === edit.alg ? edit.value : b.params.find((p) => p.alg === alg)?.value;
4690
- return {
4691
- ...b,
4692
- params: b.params.map((p) => {
4693
- const s = specs.find((x) => x.alg === p.alg);
4694
- if (!s || p.alg !== edit.alg && s.syncedBy !== edit.alg) return p;
4695
- return toParam(effectiveSpec(s, value), value(p.alg));
4696
- })
4697
- };
4416
+ return { ...b, params: b.params.map((p) => p.alg === edit.alg ? toParam(spec, edit.value) : p) };
4698
4417
  });
4699
4418
  case "model": {
4700
4419
  const clone = edit.module === AMP_MODULE2 && edit.clone === true;
@@ -4717,8 +4436,6 @@ function editToCommands(preset, edit) {
4717
4436
  switch (edit.kind) {
4718
4437
  case "volume":
4719
4438
  return [setPresetVolume(edit.value)];
4720
- case "footswitch":
4721
- return footswitchCommands(preset, edit.module, edit.footswitch);
4722
4439
  case "chain":
4723
4440
  return [setChain(edit.order)];
4724
4441
  case "on":
@@ -4761,29 +4478,8 @@ function diffPresets(from, to) {
4761
4478
  }
4762
4479
  }
4763
4480
  if (to.volume !== null && to.volume !== from.volume) edits.push({ kind: "volume", value: to.volume });
4764
- const moving = afterModels.chain.filter((b) => target.get(b.module).footswitch !== b.footswitch);
4765
- for (const b of moving) if (b.footswitch !== null) edits.push({ kind: "footswitch", module: b.module, footswitch: null });
4766
- for (const b of moving) {
4767
- const want = target.get(b.module).footswitch;
4768
- if (want !== null) edits.push({ kind: "footswitch", module: b.module, footswitch: want });
4769
- }
4770
4481
  return edits;
4771
4482
  }
4772
- function footswitchCommands(preset, module, target) {
4773
- const block2 = preset.chain.find((b) => b.module === module);
4774
- if (!block2) throw new Error(`no block with module ${module}`);
4775
- if (block2.footswitch === target) return [];
4776
- if (target !== null) {
4777
- const used = preset.chain.filter((b) => b.footswitch === target).length;
4778
- if (used >= FOOTSWITCH_CAPACITY) {
4779
- throw new Error(`${target.toUpperCase()} already switches ${FOOTSWITCH_CAPACITY} blocks; take one off it first`);
4780
- }
4781
- }
4782
- return [
4783
- ...target !== null ? [setFootswitch(target, module, true)] : [],
4784
- ...block2.footswitch !== null ? [setFootswitch(block2.footswitch, module, false)] : []
4785
- ];
4786
- }
4787
4483
  function mapBlock(preset, module, fn) {
4788
4484
  if (!preset.chain.some((b) => b.module === module)) throw new Error(`no block with module ${module}`);
4789
4485
  return { ...preset, chain: preset.chain.map((b) => b.module === module ? fn(b) : b) };
@@ -5126,6 +4822,8 @@ var PocketMasterLink = class {
5126
4822
  #drainWaiters = /* @__PURE__ */ new Set();
5127
4823
  /** Edits sent whose 14 08 acknowledge has not arrived yet; those acknowledges are consumed here. */
5128
4824
  #editAcksPending = 0;
4825
+ #requests = Promise.resolve();
4826
+ #inFlight = 0;
5129
4827
  /** Timeout restarts of the requests waiting for a reply, called as its packets arrive. */
5130
4828
  #progress = /* @__PURE__ */ new Set();
5131
4829
  #editAcksSettled = null;
@@ -5147,8 +4845,22 @@ var PocketMasterLink = class {
5147
4845
  this.#pending.forEach((cancel) => cancel());
5148
4846
  this.#listeners.clear();
5149
4847
  }
5150
- /** Sends a query and resolves with the (reassembled) reply. Retries, then rejects with a readable error. */
5151
- async request(kind) {
4848
+ /**
4849
+ * Sends a query and resolves with the (reassembled) reply. Retries, then rejects with a readable
4850
+ * error. Queries go out one at a time: replies are matched by kind and joined by packet count,
4851
+ * so two in flight could mix (a slow Bluetooth names reply overlapping the preset read).
4852
+ */
4853
+ request(kind) {
4854
+ const idle = this.#inFlight === 0;
4855
+ this.#inFlight += 1;
4856
+ const start = () => this.#requestNow(kind).finally(() => {
4857
+ this.#inFlight -= 1;
4858
+ });
4859
+ const run = idle ? start() : this.#requests.then(start);
4860
+ this.#requests = run.catch(() => void 0);
4861
+ return run;
4862
+ }
4863
+ async #requestNow(kind) {
5152
4864
  for (let attempt = 0; attempt <= REQUEST_RETRIES; attempt++) {
5153
4865
  if (this.#closed) throw new LinkClosedError();
5154
4866
  const reply2 = this.#waitFor(kind);
@@ -5687,8 +5399,7 @@ function resolveBlock(preset, input) {
5687
5399
  function resolveParam(preset, block2, input) {
5688
5400
  const params = modelOf(preset, block2)?.params ?? [];
5689
5401
  if (params.length === 0) throw new Error(`${block2.label} has an unknown model (${block2.model}); its parameters cannot be set by name`);
5690
- const spec = pick("parameter", input, params.map((p) => ({ names: [p.name], value: p, label: p.name })));
5691
- return effectiveSpec(spec, (alg) => block2.params.find((p) => p.alg === alg)?.value);
5402
+ return pick("parameter", input, params.map((p) => ({ names: [p.name], value: p, label: p.name })));
5692
5403
  }
5693
5404
  function modelChoices(blockKey, slots) {
5694
5405
  const models = modelsFor(blockKey).map((m) => {
@@ -6390,6 +6101,7 @@ async function pollDeviceToken(o, fetch2 = globalThis.fetch, clock = { sleep: (m
6390
6101
  const deadline = clock.now() + o.start.expiresIn * 1e3;
6391
6102
  while (clock.now() < deadline) {
6392
6103
  await clock.sleep(interval);
6104
+ o.signal?.throwIfAborted();
6393
6105
  const { status, body } = await postToken({ grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: o.start.deviceCode, client_id: o.clientId }, fetch2);
6394
6106
  if (status === 200) return toTokens(body, clock.now());
6395
6107
  if (body.error === "authorization_pending") continue;
@@ -7015,8 +6727,6 @@ function toEdit(preset, change2, slots) {
7015
6727
  }
7016
6728
  case "block":
7017
6729
  return { kind: "on", module: block2.module, on: change2.on };
7018
- case "footswitch":
7019
- return { kind: "footswitch", module: block2.module, footswitch: parseFootswitch(change2.switch) };
7020
6730
  case "model": {
7021
6731
  const model = resolveModel(block2.key, change2.model, slots);
7022
6732
  return { kind: "model", module: block2.module, code: model.code, clone: model.clone };
@@ -7031,12 +6741,6 @@ function toEdit(preset, change2, slots) {
7031
6741
  }
7032
6742
  }
7033
6743
  }
7034
- function parseFootswitch(input) {
7035
- const key = input.trim().toLowerCase();
7036
- if (key === "fs1" || key === "fs2") return key;
7037
- if (key === "none" || key === "") return null;
7038
- throw new Error(`switch must be FS1, FS2 or none, got "${input}"`);
7039
- }
7040
6744
  function formatPreset(index, name, preset, slots, modified) {
7041
6745
  const head = [
7042
6746
  `${presetLabel(index)} "${name}"`,
@@ -7049,8 +6753,7 @@ function formatPreset(index, name, preset, slots, modified) {
7049
6753
  const blocks = preset.chain.map((b) => {
7050
6754
  const model = blockModelLabel(b, preset.ampMode, slots.irNames, slots.profileNames);
7051
6755
  const params = b.params.map((p) => `${p.name} ${p.display}`).join(", ");
7052
- const footswitch = b.footswitch ? `[${b.footswitch.toUpperCase()}] ` : "";
7053
- return `${b.label.padEnd(width)} ${b.on ? "on " : "off"} ${footswitch}${model}${params ? `: ${params}` : ""}`;
6756
+ return `${b.label.padEnd(width)} ${b.on ? "on " : "off"} ${model}${params ? `: ${params}` : ""}`;
7054
6757
  });
7055
6758
  return [head, chain, ...blocks].join("\n");
7056
6759
  }
@@ -7107,7 +6810,7 @@ import { z } from "zod";
7107
6810
  // package.json
7108
6811
  var package_default = {
7109
6812
  name: "sonicake-pocket-master-mcp",
7110
- version: "0.12.0",
6813
+ version: "0.12.2",
7111
6814
  description: "Unofficial MCP server for the Sonicake Pocket Master: let an AI assistant build tones from a record, edit and save presets over USB MIDI.",
7112
6815
  keywords: [
7113
6816
  "mcp",
@@ -7181,12 +6884,7 @@ var change = z.discriminatedUnion("kind", [
7181
6884
  z.object({ kind: z.literal("block"), block, on: z.boolean() }),
7182
6885
  z.object({ kind: z.literal("model"), block, model: z.string().describe("Model name from list_models; for AMP, a captured profile name selects clone mode") }),
7183
6886
  z.object({ kind: z.literal("move"), block, position: z.number().int().describe("1-based position in the chain; DRV, AMP, IR and EQ move together") }),
7184
- z.object({ kind: z.literal("volume"), value: z.number().int().min(0).max(100).describe("Preset volume 0..100") }),
7185
- z.object({
7186
- kind: z.literal("footswitch"),
7187
- block,
7188
- switch: z.string().describe("FS1, FS2 or none: which footswitch toggles the block (a switch takes at most 3 blocks)")
7189
- })
6887
+ z.object({ kind: z.literal("volume"), value: z.number().int().min(0).max(100).describe("Preset volume 0..100") })
7190
6888
  ]);
7191
6889
  async function reply(tool, options, run) {
7192
6890
  const started = performance.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonicake-pocket-master-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Unofficial MCP server for the Sonicake Pocket Master: let an AI assistant build tones from a record, edit and save presets over USB MIDI.",
5
5
  "keywords": [
6
6
  "mcp",