1// tabTools.mjs with the page's own modules: what both tab ends of the MCP 2// (repl/useWebSocketMCP.jsx for the dev hub, myTabs.mjs for the hosted MCP) 3// load, on the first such command, to answer it. 4import { themes } from '@strudel/codemirror'; 5import { getAudioContext, soundMap } from '@strudel/webaudio'; 6import { $strudel_log_history } from '../repl/components/useLogger.jsx'; 7import { settingsMap } from '../settings.mjs'; 8import { askJev } from './ask.mjs'; 9import { boothStore } from './boothStore.mjs'; 10import { loadListenerSong as showListenerSong, playSong, readSongs } from './client.mjs'; 11import { loadListenerSong } from './listeners.mjs'; 12import { pickByMood } from './picker.mjs'; 13import { pressReaction } from './press.mjs'; 14import { playForeign, sandbox, sandboxCycle } from './sandbox.mjs'; 15import { runTabTool as run } from './tabTools.mjs'; 16 17const deps = { 18 sounds: () => soundMap.get(), 19 askJev, 20 settings: settingsMap, 21 themes: () => Object.keys(themes), 22 consoleLog: () => $strudel_log_history.get(), 23 readSongs, 24 playSong, 25 audioRunning: () => getAudioContext().state === 'running', 26 loadListener: (id) => loadListenerSong(id), 27 showListener: (editor, song) => showListenerSong(editor, song, { play: false }), 28 foreign: () => sandbox.foreign(), 29 playForeign, 30 pickByMood, 31 booth: () => boothStore.getSnapshot().booth, 32 cycle: (editor) => sandboxCycle() ?? (editor.repl?.scheduler?.started ? editor.repl.scheduler.now() : null), 33 press: pressReaction, 34}; 35 36export const runTabTool = (editor, command) => run(editor, command, deps);