@myagentroam/node 0.9.114 → 0.9.115
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tmpdir } from 'node:os';
|
|
2
|
-
import { isAbsolute, win32 } from 'node:path';
|
|
2
|
+
import { isAbsolute, relative, resolve, win32 } from 'node:path';
|
|
3
|
+
import { realpath } from 'node:fs/promises';
|
|
3
4
|
import { listWorkspaceFiles, mutateWorkspaceFile, normalizeFilePreviewPath, readAllowedFileContentRange, readWorkspaceFileContentRange, readAllowedTextFile, readWorkspaceTextFile, writeWorkspaceTextFile, WorkspaceFileIndex } from '../workspace.js';
|
|
4
5
|
const INDEX_CACHE_LIMIT = 32;
|
|
5
6
|
export class WorkspaceFileService {
|
|
@@ -52,6 +53,19 @@ export class WorkspaceFileService {
|
|
|
52
53
|
const path = normalizeFilePreviewPath(input.path);
|
|
53
54
|
if (workspacePath !== workspace.path && isFilePreviewAbsolutePath(path))
|
|
54
55
|
throw new Error('FILE_PATH_ESCAPE');
|
|
56
|
+
if (input.previewDirectory !== undefined) {
|
|
57
|
+
if (typeof input.previewDirectory !== 'string' ||
|
|
58
|
+
isFilePreviewAbsolutePath(path) ||
|
|
59
|
+
isFilePreviewAbsolutePath(input.previewDirectory))
|
|
60
|
+
throw new Error('FILE_PATH_ESCAPE');
|
|
61
|
+
const root = await realpath(resolve(workspacePath, input.previewDirectory));
|
|
62
|
+
const target = await realpath(resolve(workspacePath, path));
|
|
63
|
+
const suffix = relative(root, target);
|
|
64
|
+
if (suffix === '..' ||
|
|
65
|
+
suffix.startsWith(`..${process.platform === 'win32' ? '\\' : '/'}`) ||
|
|
66
|
+
isAbsolute(suffix))
|
|
67
|
+
throw new Error('FILE_PATH_ESCAPE');
|
|
68
|
+
}
|
|
55
69
|
const offset = typeof input.offset === 'number' ? input.offset : 0;
|
|
56
70
|
const limit = typeof input.limit === 'number' ? input.limit : 512 * 1024;
|
|
57
71
|
return isFilePreviewAbsolutePath(path)
|
|
@@ -150,7 +150,8 @@ export class WorkspaceWorkbenchService {
|
|
|
150
150
|
const workspace = this.options.requireWorkspace(input.workspaceId);
|
|
151
151
|
const repository = await this.fileRepository(workspace, input);
|
|
152
152
|
return {
|
|
153
|
-
file: await this.options.files.readContent(workspace, input, repository)
|
|
153
|
+
file: await this.options.files.readContent(workspace, input, repository),
|
|
154
|
+
...(input.previewDirectory === undefined ? {} : { previewBoundaryVerified: true })
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
157
|
async directFileMetadata(input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.115",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"npm": "11.12.1",
|
|
31
31
|
"ws": "^8.21.3",
|
|
32
32
|
"zod": "4.4.3",
|
|
33
|
-
"@myagentroam/agent": "0.9.
|
|
34
|
-
"@myagentroam/
|
|
35
|
-
"@myagentroam/
|
|
33
|
+
"@myagentroam/agent": "0.9.115",
|
|
34
|
+
"@myagentroam/protocol": "0.9.115",
|
|
35
|
+
"@myagentroam/code-navigation": "0.9.115"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/ws": "^8.18.1"
|