@mhingston5/conduit 1.1.3 → 1.1.4
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/dist/index.d.ts +1 -2
- package/dist/index.js +25 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
1
3
|
// src/index.ts
|
|
2
4
|
import { Command } from "commander";
|
|
3
5
|
|
|
@@ -6,6 +8,7 @@ import { z } from "zod";
|
|
|
6
8
|
import dotenv from "dotenv";
|
|
7
9
|
import fs from "fs";
|
|
8
10
|
import path from "path";
|
|
11
|
+
import crypto from "crypto";
|
|
9
12
|
import yaml from "js-yaml";
|
|
10
13
|
var originalWrite = process.stdout.write;
|
|
11
14
|
process.stdout.write = () => true;
|
|
@@ -58,7 +61,7 @@ var ConfigSchema = z.object({
|
|
|
58
61
|
"[A-Za-z0-9-_]{20,}"
|
|
59
62
|
// Default pattern from spec
|
|
60
63
|
]),
|
|
61
|
-
ipcBearerToken: z.string().optional().default(() =>
|
|
64
|
+
ipcBearerToken: z.string().optional().default(() => crypto.randomUUID()),
|
|
62
65
|
maxConcurrent: z.number().default(10),
|
|
63
66
|
denoMaxPoolSize: z.number().default(10),
|
|
64
67
|
pyodideMaxPoolSize: z.number().default(3),
|
|
@@ -192,6 +195,7 @@ function createLogger(configService) {
|
|
|
192
195
|
|
|
193
196
|
// src/transport/socket.transport.ts
|
|
194
197
|
import net from "net";
|
|
198
|
+
import fs2 from "fs";
|
|
195
199
|
import os from "os";
|
|
196
200
|
import path2 from "path";
|
|
197
201
|
|
|
@@ -245,6 +249,13 @@ var SocketTransport = class {
|
|
|
245
249
|
const socketPath = this.formatSocketPath(options.path);
|
|
246
250
|
this.logger.info({ socketPath }, "Binding to IPC socket");
|
|
247
251
|
if (os.platform() !== "win32" && path2.isAbsolute(socketPath)) {
|
|
252
|
+
try {
|
|
253
|
+
fs2.unlinkSync(socketPath);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (error.code !== "ENOENT") {
|
|
256
|
+
this.logger.warn({ err: error, socketPath }, "Failed to unlink socket before binding");
|
|
257
|
+
}
|
|
258
|
+
}
|
|
248
259
|
}
|
|
249
260
|
this.server.listen(socketPath, () => {
|
|
250
261
|
this.resolveAddress(resolve);
|
|
@@ -832,6 +843,7 @@ var RequestController = class {
|
|
|
832
843
|
}
|
|
833
844
|
}
|
|
834
845
|
async handleCallTool(params, context, id) {
|
|
846
|
+
if (!params) return this.errorResponse(id, -32602, "Missing parameters");
|
|
835
847
|
const { name, arguments: toolArgs } = params;
|
|
836
848
|
switch (name) {
|
|
837
849
|
case "mcp_execute_typescript":
|
|
@@ -845,6 +857,7 @@ var RequestController = class {
|
|
|
845
857
|
return { ...response, id };
|
|
846
858
|
}
|
|
847
859
|
async handleExecuteTypeScript(params, context, id) {
|
|
860
|
+
if (!params) return this.errorResponse(id, -32602, "Missing parameters");
|
|
848
861
|
const { code, limits, allowedTools } = params;
|
|
849
862
|
if (Array.isArray(allowedTools)) {
|
|
850
863
|
context.allowedTools = allowedTools;
|
|
@@ -864,6 +877,7 @@ var RequestController = class {
|
|
|
864
877
|
};
|
|
865
878
|
}
|
|
866
879
|
async handleExecutePython(params, context, id) {
|
|
880
|
+
if (!params) return this.errorResponse(id, -32602, "Missing parameters");
|
|
867
881
|
const { code, limits, allowedTools } = params;
|
|
868
882
|
if (Array.isArray(allowedTools)) {
|
|
869
883
|
context.allowedTools = allowedTools;
|
|
@@ -906,6 +920,7 @@ var RequestController = class {
|
|
|
906
920
|
};
|
|
907
921
|
}
|
|
908
922
|
async handleExecuteIsolate(params, context, id) {
|
|
923
|
+
if (!params) return this.errorResponse(id, -32602, "Missing parameters");
|
|
909
924
|
const { code, limits, allowedTools } = params;
|
|
910
925
|
if (Array.isArray(allowedTools)) {
|
|
911
926
|
context.allowedTools = allowedTools;
|
|
@@ -1759,7 +1774,7 @@ var SessionManager = class {
|
|
|
1759
1774
|
};
|
|
1760
1775
|
|
|
1761
1776
|
// src/core/security.service.ts
|
|
1762
|
-
import
|
|
1777
|
+
import crypto2 from "crypto";
|
|
1763
1778
|
var SecurityService = class {
|
|
1764
1779
|
logger;
|
|
1765
1780
|
ipcToken;
|
|
@@ -1789,7 +1804,7 @@ var SecurityService = class {
|
|
|
1789
1804
|
}
|
|
1790
1805
|
const expected = Buffer.from(this.ipcToken);
|
|
1791
1806
|
const actual = Buffer.from(token);
|
|
1792
|
-
if (expected.length === actual.length &&
|
|
1807
|
+
if (expected.length === actual.length && crypto2.timingSafeEqual(expected, actual)) {
|
|
1793
1808
|
return true;
|
|
1794
1809
|
}
|
|
1795
1810
|
return !!this.sessionManager.getSession(token);
|
|
@@ -1852,14 +1867,14 @@ var OtelService = class {
|
|
|
1852
1867
|
// src/executors/deno.executor.ts
|
|
1853
1868
|
import { spawn, exec } from "child_process";
|
|
1854
1869
|
import { promisify } from "util";
|
|
1855
|
-
import
|
|
1870
|
+
import fs4 from "fs";
|
|
1856
1871
|
import path4 from "path";
|
|
1857
1872
|
import { platform } from "os";
|
|
1858
1873
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1859
1874
|
|
|
1860
1875
|
// src/core/asset.utils.ts
|
|
1861
1876
|
import path3 from "path";
|
|
1862
|
-
import
|
|
1877
|
+
import fs3 from "fs";
|
|
1863
1878
|
import { fileURLToPath } from "url";
|
|
1864
1879
|
var __dirname = path3.dirname(fileURLToPath(import.meta.url));
|
|
1865
1880
|
function resolveAssetPath(filename) {
|
|
@@ -1876,7 +1891,7 @@ function resolveAssetPath(filename) {
|
|
|
1876
1891
|
path3.resolve(process.cwd(), "dist/assets", filename)
|
|
1877
1892
|
];
|
|
1878
1893
|
for (const candidate of candidates) {
|
|
1879
|
-
if (
|
|
1894
|
+
if (fs3.existsSync(candidate)) {
|
|
1880
1895
|
return candidate;
|
|
1881
1896
|
}
|
|
1882
1897
|
}
|
|
@@ -1900,7 +1915,7 @@ var DenoExecutor = class {
|
|
|
1900
1915
|
if (this.shimContent) return this.shimContent;
|
|
1901
1916
|
try {
|
|
1902
1917
|
const assetPath = resolveAssetPath("deno-shim.ts");
|
|
1903
|
-
this.shimContent =
|
|
1918
|
+
this.shimContent = fs4.readFileSync(assetPath, "utf-8");
|
|
1904
1919
|
return this.shimContent;
|
|
1905
1920
|
} catch (err) {
|
|
1906
1921
|
throw new Error(`Failed to load Deno shim: ${err.message}`);
|
|
@@ -2142,7 +2157,7 @@ var DenoExecutor = class {
|
|
|
2142
2157
|
|
|
2143
2158
|
// src/executors/pyodide.executor.ts
|
|
2144
2159
|
import { Worker } from "worker_threads";
|
|
2145
|
-
import
|
|
2160
|
+
import fs5 from "fs";
|
|
2146
2161
|
import path5 from "path";
|
|
2147
2162
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2148
2163
|
var __dirname3 = path5.dirname(fileURLToPath3(import.meta.url));
|
|
@@ -2158,7 +2173,7 @@ var PyodideExecutor = class {
|
|
|
2158
2173
|
if (this.shimContent) return this.shimContent;
|
|
2159
2174
|
try {
|
|
2160
2175
|
const assetPath = resolveAssetPath("python-shim.py");
|
|
2161
|
-
this.shimContent =
|
|
2176
|
+
this.shimContent = fs5.readFileSync(assetPath, "utf-8");
|
|
2162
2177
|
return this.shimContent;
|
|
2163
2178
|
} catch (err) {
|
|
2164
2179
|
throw new Error(`Failed to load Python shim: ${err.message}`);
|
|
@@ -2199,7 +2214,7 @@ var PyodideExecutor = class {
|
|
|
2199
2214
|
}
|
|
2200
2215
|
createWorker(limits) {
|
|
2201
2216
|
let workerPath = path5.resolve(__dirname3, "./pyodide.worker.js");
|
|
2202
|
-
if (!
|
|
2217
|
+
if (!fs5.existsSync(workerPath)) {
|
|
2203
2218
|
workerPath = path5.resolve(__dirname3, "./pyodide.worker.ts");
|
|
2204
2219
|
}
|
|
2205
2220
|
return new Worker(workerPath, {
|