@mthines/reaper-mcp 0.83.1 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -46
- package/bridge-ui/mcp_bridge.html +39 -39
- package/main.js +343 -251
- package/package.json +1 -1
- package/reaper/mcp_bridge.lua +20 -4
package/package.json
CHANGED
package/reaper/mcp_bridge.lua
CHANGED
|
@@ -4763,6 +4763,11 @@ local function update_config()
|
|
|
4763
4763
|
if not text then return nil end
|
|
4764
4764
|
local conf = {}
|
|
4765
4765
|
for key, value in text:gmatch("([%w_]+)=([^\r\n]*)") do conf[key] = value end
|
|
4766
|
+
-- An npm install (mode=npm) updates through `node <cli> update`; a clone through its scripts/update.sh
|
|
4767
|
+
if conf.mode == "npm" then
|
|
4768
|
+
if not conf.cli or conf.cli == "" or not file_exists(conf.cli) then return nil end
|
|
4769
|
+
return conf
|
|
4770
|
+
end
|
|
4766
4771
|
if not conf.repo or conf.repo == "" or not file_exists(conf.repo .. "/scripts/update.sh") then return nil end
|
|
4767
4772
|
return conf
|
|
4768
4773
|
end
|
|
@@ -4787,7 +4792,14 @@ local function start_update(kind)
|
|
|
4787
4792
|
-- REAPER started from the Dock has a bare PATH: put the node that ran setup (and its pnpm/corepack) first
|
|
4788
4793
|
local node_dir = conf.node and conf.node:match("^(.*)/[^/]+$")
|
|
4789
4794
|
local path = (node_dir and (shell_quote(node_dir) .. ":") or "") .. "/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
4790
|
-
|
|
4795
|
+
local job
|
|
4796
|
+
if conf.mode == "npm" then
|
|
4797
|
+
if kind == "rebuild" then return end
|
|
4798
|
+
job = "PATH=" .. path .. " " .. shell_quote(conf.node or "node") .. " " .. shell_quote(conf.cli) .. " update --bridge"
|
|
4799
|
+
else
|
|
4800
|
+
job = "cd " .. shell_quote(conf.repo) .. " && PATH=" .. path .. " ./scripts/update.sh" .. (kind == "rebuild" and " --rebuild" or "")
|
|
4801
|
+
end
|
|
4802
|
+
os.execute("( " .. job .. " < /dev/null > " .. shell_quote(UPDATE_LOG)
|
|
4791
4803
|
.. " 2>&1; echo $? > " .. shell_quote(UPDATE_EXIT) .. " ) >/dev/null 2>&1 &")
|
|
4792
4804
|
update = { kind = kind, state = "running", startedAt = now_ms(), log = {} }
|
|
4793
4805
|
log_event("bridge_update_start", { kind = kind })
|
|
@@ -4827,7 +4839,8 @@ local function check_control(now)
|
|
|
4827
4839
|
local code = read_file(UPDATE_EXIT)
|
|
4828
4840
|
if not code then return end
|
|
4829
4841
|
code = tonumber(code:match("%d+"))
|
|
4830
|
-
update
|
|
4842
|
+
-- exit 3 from `reaper-mcp update --bridge`: nothing newer to install, nothing changed
|
|
4843
|
+
update.state = code == 0 and "done" or code == 3 and "current" or "failed"
|
|
4831
4844
|
if update.state == "done" then os.remove(SOURCE_CHANGES) end -- re-checked against the new install
|
|
4832
4845
|
log_event("bridge_update_end", { exitCode = code })
|
|
4833
4846
|
status_dirty = true
|
|
@@ -4839,13 +4852,14 @@ local function check_control(now)
|
|
|
4839
4852
|
end
|
|
4840
4853
|
|
|
4841
4854
|
-- What the status page may offer: published in the status feed together with the token
|
|
4842
|
-
local can_update, conf_dev, last_can_update_check = false, false, -10
|
|
4855
|
+
local can_update, conf_dev, update_source, last_can_update_check = false, false, "clone", -10
|
|
4843
4856
|
local function refresh_update_config()
|
|
4844
4857
|
local now = reaper.time_precise()
|
|
4845
4858
|
if now - last_can_update_check < 10 then return end
|
|
4846
4859
|
last_can_update_check = now
|
|
4847
4860
|
local conf = not is_windows and update_config() or nil
|
|
4848
4861
|
can_update, conf_dev = conf ~= nil, conf ~= nil and conf.dev == "1"
|
|
4862
|
+
update_source = conf ~= nil and conf.mode == "npm" and "npm" or "clone"
|
|
4849
4863
|
end
|
|
4850
4864
|
|
|
4851
4865
|
-- Developer mode: the page's toggle (cfg_dev "1"/"0") once chosen, else what setup detected (dev=1 in mcp_update.conf)
|
|
@@ -4862,7 +4876,7 @@ end
|
|
|
4862
4876
|
local SOURCE_CHECK_INTERVAL = 5
|
|
4863
4877
|
local source_changed, last_source_check = false, -SOURCE_CHECK_INTERVAL
|
|
4864
4878
|
local function check_source_changes(now)
|
|
4865
|
-
if is_windows or now - last_source_check < SOURCE_CHECK_INTERVAL or not dev_mode() or not can_update then return end
|
|
4879
|
+
if is_windows or now - last_source_check < SOURCE_CHECK_INTERVAL or not dev_mode() or not can_update or update_source == "npm" then return end
|
|
4866
4880
|
if update and update.state == "running" then return end
|
|
4867
4881
|
last_source_check = now
|
|
4868
4882
|
local changed = (read_file(SOURCE_CHANGES) or ""):match("%S") ~= nil
|
|
@@ -4885,6 +4899,8 @@ local function control_status()
|
|
|
4885
4899
|
token = control_token,
|
|
4886
4900
|
canRestart = can_restart,
|
|
4887
4901
|
canUpdate = can_update,
|
|
4902
|
+
-- Where releases come from: "npm" (an npm install updates itself) or "clone" (git pull)
|
|
4903
|
+
updateSource = update_source,
|
|
4888
4904
|
-- Developer mode: source changed since the last install, so Rebuild & reload has something to do
|
|
4889
4905
|
changed = source_changed,
|
|
4890
4906
|
update = update,
|