@xtremestuff/dsh-plugin-resolve 0.1.1 → 0.1.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.
- package/lib/index.js +36 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -96,11 +96,15 @@ function isExecutable(path) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Rewrite an MCP input schema into DSH's supported JSON-Schema subset
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
99
|
+
* Rewrite an MCP input schema into DSH's supported JSON-Schema subset
|
|
100
|
+
* (type/oneOf/properties/required/additionalProperties/items/enum/const +
|
|
101
|
+
* annotations).
|
|
102
|
+
* - `type` arrays (native server's `["integer","string"]` offset/timecode
|
|
103
|
+
* params): a single-type array collapses to that type; a true union drops
|
|
104
|
+
* `type` so the parameter is unconstrained for DSH while the MCP server
|
|
105
|
+
* validates it.
|
|
106
|
+
* - `anyOf` (pydantic emits it for `Optional[...]` params in the community
|
|
107
|
+
* server): renamed to the supported `oneOf`; branches are sanitized too.
|
|
104
108
|
* @param {unknown} node
|
|
105
109
|
* @returns {unknown} a sanitized copy of the schema node.
|
|
106
110
|
*/
|
|
@@ -112,6 +116,13 @@ function sanitizeSchema(node) {
|
|
|
112
116
|
if (supported.length === 1) out.type = supported[0]
|
|
113
117
|
else delete out.type
|
|
114
118
|
}
|
|
119
|
+
if (Array.isArray(out.anyOf)) {
|
|
120
|
+
if (!Array.isArray(out.oneOf)) out.oneOf = out.anyOf
|
|
121
|
+
delete out.anyOf
|
|
122
|
+
}
|
|
123
|
+
if (Array.isArray(out.oneOf)) {
|
|
124
|
+
out.oneOf = out.oneOf.map((branch) => sanitizeSchema(branch))
|
|
125
|
+
}
|
|
115
126
|
if (out.properties && typeof out.properties === 'object' && !Array.isArray(out.properties)) {
|
|
116
127
|
out.properties = Object.fromEntries(
|
|
117
128
|
Object.entries(out.properties).map(([key, value]) => [key, sanitizeSchema(value)]),
|
|
@@ -270,6 +281,26 @@ class StdioJsonRpc {
|
|
|
270
281
|
}
|
|
271
282
|
}
|
|
272
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Call one tool over this transport (same surface as LazyStdioServer).
|
|
286
|
+
* @param {string} toolName
|
|
287
|
+
* @param {object} [args]
|
|
288
|
+
* @param {number} [timeoutMs]
|
|
289
|
+
* @param {AbortSignal} [signal]
|
|
290
|
+
*/
|
|
291
|
+
callTool(toolName, args, timeoutMs = DEFAULT_TOOL_CALL_TIMEOUT_MS, signal) {
|
|
292
|
+
if (signal?.aborted) return Promise.reject(new Error('aborted'))
|
|
293
|
+
const promise = this.request('tools/call', { name: toolName, arguments: args ?? {} }, timeoutMs)
|
|
294
|
+
if (signal) signal.addEventListener('abort', () => {
|
|
295
|
+
// JSON-RPC has no cancel; drop the waiters so the caller's signal wins.
|
|
296
|
+
for (const [id, waiter] of [...this.pending]) {
|
|
297
|
+
this.pending.delete(id)
|
|
298
|
+
waiter.reject(new Error('aborted'))
|
|
299
|
+
}
|
|
300
|
+
}, { once: true })
|
|
301
|
+
return promise
|
|
302
|
+
}
|
|
303
|
+
|
|
273
304
|
/** Kill the child process and settle every pending request. */
|
|
274
305
|
dispose() {
|
|
275
306
|
this.closed = true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtremestuff/dsh-plugin-resolve",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DSH bundle that bridges DaVinci Resolve into DSH: registers Resolve 21.1+ native ResolveMCP (stdio) or the davinci-resolve-mcp community server with DSH's mcp-client bridge, exposing Resolve's tools as first-class agent tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|