@simpligen/mcp 0.7.0 → 0.8.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/src/studioGate.js DELETED
@@ -1,51 +0,0 @@
1
- // packages/mcp-server/src/studioGate.js
2
- // The Video Studio tools are listed only to an agent whose SimpliGen holds the studio.
3
- // Without it every film call is refused (studio_not_installed), so listing them only
4
- // invites calls that cannot work. The app answers whether it holds the studio in
5
- // /status (videoStudio.held, App 1.75.0 and newer); the gate reads that on start, every
6
- // pollMs, and whenever the agent asks get_status, and tells the client when the set changes.
7
-
8
- /**
9
- * @param {{ client: { getStatus: () => Promise<object> },
10
- * tools: Array<{ enabled: boolean }>,
11
- * notify: () => void,
12
- * pollMs?: number }} deps
13
- */
14
- export function createStudioGate({ client, tools, notify, pollMs = 60_000 }) {
15
- let held = false;
16
- let timer = null;
17
- // Hidden until the app says otherwise. Set directly so a client that is not connected
18
- // yet is not told, and a whole switch is one notification, not one per tool.
19
- for (const t of tools) t.enabled = false;
20
-
21
- const apply = (next) => {
22
- if (next === held) return;
23
- held = next;
24
- for (const t of tools) t.enabled = next;
25
- notify();
26
- };
27
-
28
- /** Read one /status answer. An app that does not report the studio does not hold it. */
29
- const observe = (status) => apply(status?.videoStudio?.held === true);
30
-
31
- /** Ask the app. A failed read (the app closed for a moment) changes nothing. */
32
- const refresh = async () => {
33
- try { observe(await client.getStatus()); } catch { /* keep what we had */ }
34
- };
35
-
36
- return {
37
- observe,
38
- refresh,
39
- start() {
40
- if (timer) return;
41
- refresh();
42
- timer = setInterval(refresh, pollMs);
43
- timer.unref?.();
44
- },
45
- stop() {
46
- clearInterval(timer);
47
- timer = null;
48
- },
49
- get held() { return held; },
50
- };
51
- }