sonicake-pocket-master-mcp 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.js +21 -4
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -4549,7 +4549,7 @@ function editKey(sysex) {
4549
4549
  const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
4550
4550
  const command = payload[1] ?? 0;
4551
4551
  if (command === EditCommand.CHAIN) return "chain";
4552
- if (isGlobalWrite(payload)) return `global:${payload[1]}:${payload[2]}:${payload[3]}`;
4552
+ if (isGlobalWrite(payload)) return payload[1] === 17 ? `global:${payload[2]}:${payload[3]}` : `target:${payload[1]}:${payload[2]}`;
4553
4553
  if (command === EditCommand.PRESET_FIELD) return `field:${payload[2]}`;
4554
4554
  if (command === EditCommand.FOOTSWITCH) return `footswitch:${payload[2]}:${payload[3]}`;
4555
4555
  const module = view.getUint32(2, true);
@@ -5126,6 +5126,8 @@ var PocketMasterLink = class {
5126
5126
  #drainWaiters = /* @__PURE__ */ new Set();
5127
5127
  /** Edits sent whose 14 08 acknowledge has not arrived yet; those acknowledges are consumed here. */
5128
5128
  #editAcksPending = 0;
5129
+ #requests = Promise.resolve();
5130
+ #inFlight = 0;
5129
5131
  /** Timeout restarts of the requests waiting for a reply, called as its packets arrive. */
5130
5132
  #progress = /* @__PURE__ */ new Set();
5131
5133
  #editAcksSettled = null;
@@ -5147,8 +5149,22 @@ var PocketMasterLink = class {
5147
5149
  this.#pending.forEach((cancel) => cancel());
5148
5150
  this.#listeners.clear();
5149
5151
  }
5150
- /** Sends a query and resolves with the (reassembled) reply. Retries, then rejects with a readable error. */
5151
- async request(kind) {
5152
+ /**
5153
+ * Sends a query and resolves with the (reassembled) reply. Retries, then rejects with a readable
5154
+ * error. Queries go out one at a time: replies are matched by kind and joined by packet count,
5155
+ * so two in flight could mix (a slow Bluetooth names reply overlapping the preset read).
5156
+ */
5157
+ request(kind) {
5158
+ const idle = this.#inFlight === 0;
5159
+ this.#inFlight += 1;
5160
+ const start = () => this.#requestNow(kind).finally(() => {
5161
+ this.#inFlight -= 1;
5162
+ });
5163
+ const run = idle ? start() : this.#requests.then(start);
5164
+ this.#requests = run.catch(() => void 0);
5165
+ return run;
5166
+ }
5167
+ async #requestNow(kind) {
5152
5168
  for (let attempt = 0; attempt <= REQUEST_RETRIES; attempt++) {
5153
5169
  if (this.#closed) throw new LinkClosedError();
5154
5170
  const reply2 = this.#waitFor(kind);
@@ -6390,6 +6406,7 @@ async function pollDeviceToken(o, fetch2 = globalThis.fetch, clock = { sleep: (m
6390
6406
  const deadline = clock.now() + o.start.expiresIn * 1e3;
6391
6407
  while (clock.now() < deadline) {
6392
6408
  await clock.sleep(interval);
6409
+ o.signal?.throwIfAborted();
6393
6410
  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
6411
  if (status === 200) return toTokens(body, clock.now());
6395
6412
  if (body.error === "authorization_pending") continue;
@@ -7107,7 +7124,7 @@ import { z } from "zod";
7107
7124
  // package.json
7108
7125
  var package_default = {
7109
7126
  name: "sonicake-pocket-master-mcp",
7110
- version: "0.12.0",
7127
+ version: "0.12.1",
7111
7128
  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
7129
  keywords: [
7113
7130
  "mcp",
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.1",
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",