@remcp/runtime 0.2.106 → 0.2.108
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/CHANGELOG.md +6 -0
- package/README.md +14 -2
- package/package.json +2 -2
- package/src/catalog.mjs +8 -0
- package/src/compact-catalog.mjs +2 -2
- package/src/config.mjs +12 -2
- package/src/documents.mjs +7 -0
- package/src/extended/browser.mjs +431 -34
- package/src/extended/catalog.mjs +11 -8
- package/src/extended/desktop.mjs +14 -10
- package/src/extended/documents.mjs +389 -69
- package/src/index.mjs +2 -2
- package/src/mcp-v2.mjs +7 -3
- package/src/policy.mjs +42 -9
- package/src/tools/files.mjs +665 -85
- package/src/tools/terminal.mjs +4 -2
- package/src/util.mjs +7 -1
package/src/tools/terminal.mjs
CHANGED
|
@@ -221,8 +221,10 @@ export async function interactWithProcessTool(args, extra = {}) {
|
|
|
221
221
|
const session = getProcessSession(pid);
|
|
222
222
|
if (!session) fail(`No ReMCP session with pid ${pid}`);
|
|
223
223
|
if (session.exited) fail(`Process ${pid} already exited`);
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
const input = typeof args.input === 'string' ? args.input : fail('input must be a string');
|
|
225
|
+
assertAllowedCommand(input);
|
|
226
|
+
const timeoutMs = clampInteger(args.timeout_ms, 1000, 0, 120000);
|
|
227
|
+
|
|
226
228
|
session.cursor = session.droppedLines + session.lines.length;
|
|
227
229
|
session.waitCursor = session.cursor;
|
|
228
230
|
session.lastPartialRead = null;
|
package/src/util.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { realpath } from 'node:fs/promises';
|
|
3
|
+
import { lstat, realpath } from 'node:fs/promises';
|
|
4
4
|
import { liveConfig, runtimeConfig } from './config.mjs';
|
|
5
5
|
|
|
6
6
|
export class ToolError extends Error {}
|
|
@@ -93,6 +93,12 @@ export async function resolveSafePath(value, field = 'path') {
|
|
|
93
93
|
const absolute = path.resolve(raw);
|
|
94
94
|
if (!runtimeConfig.allowedRoots.length) return absolute;
|
|
95
95
|
|
|
96
|
+
const leaf = await lstat(absolute).catch(error => {
|
|
97
|
+
if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') return null;
|
|
98
|
+
throw error;
|
|
99
|
+
});
|
|
100
|
+
if (leaf?.isSymbolicLink()) fail(`Path is a symbolic link: ${absolute}`);
|
|
101
|
+
|
|
96
102
|
// Canonicalize both sides before enforcing confinement. This matters on macOS where
|
|
97
103
|
// /var is a symlink to /private/var: a safe path returned by an earlier canonicalization
|
|
98
104
|
// must not be rejected merely because its lexical prefix differs from the configured root.
|