@vybestack/llxprt-code-core 0.1.20-nightly.250818.90f427f5 → 0.1.21
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/README.md +31 -0
- package/dist/src/config/config.d.ts +0 -3
- package/dist/src/config/config.js +3 -10
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/core/client.js +1 -1
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +1 -1
- package/dist/src/core/coreToolScheduler.js +5 -5
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/logger.d.ts +22 -1
- package/dist/src/core/logger.js +103 -17
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/ide/constants.d.ts +6 -0
- package/dist/src/ide/constants.js +7 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +10 -10
- package/dist/src/ide/ide-client.js +69 -58
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-installer.js +5 -4
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/process-utils.d.ts +14 -0
- package/dist/src/ide/process-utils.js +57 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/openai/OpenAIProvider.js +6 -2
- package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +24 -0
- package/dist/src/services/shellExecutionService.js +43 -52
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/tools/mcp-tool.js +19 -0
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/tools.d.ts +2 -2
- package/dist/src/tools/tools.js +2 -2
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-search-invocation.d.ts +51 -0
- package/dist/src/tools/web-search-invocation.js +132 -0
- package/dist/src/tools/web-search-invocation.js.map +1 -0
- package/dist/src/tools/web-search.d.ts +6 -36
- package/dist/src/tools/web-search.js +6 -129
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +17 -10
- package/dist/src/tools/write-file.js +125 -127
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +2 -6
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/paths.d.ts +7 -0
- package/dist/src/utils/paths.js +15 -0
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/shell-utils.js +4 -2
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/workspaceContext.d.ts +13 -7
- package/dist/src/utils/workspaceContext.js +47 -55
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,21 +13,17 @@ export declare class WorkspaceContext {
|
|
|
13
13
|
private initialDirectories;
|
|
14
14
|
/**
|
|
15
15
|
* Creates a new WorkspaceContext with the given initial directory and optional additional directories.
|
|
16
|
-
* @param
|
|
16
|
+
* @param directory The initial working directory (usually cwd)
|
|
17
17
|
* @param additionalDirectories Optional array of additional directories to include
|
|
18
18
|
*/
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(directory: string, additionalDirectories?: string[]);
|
|
20
20
|
/**
|
|
21
21
|
* Adds a directory to the workspace.
|
|
22
22
|
* @param directory The directory path to add (can be relative or absolute)
|
|
23
23
|
* @param basePath Optional base path for resolving relative paths (defaults to cwd)
|
|
24
24
|
*/
|
|
25
25
|
addDirectory(directory: string, basePath?: string): void;
|
|
26
|
-
|
|
27
|
-
* Internal method to add a directory with validation.
|
|
28
|
-
*/
|
|
29
|
-
private addDirectoryInternal;
|
|
30
|
-
private addInitialDirectoryInternal;
|
|
26
|
+
private resolveAndValidateDir;
|
|
31
27
|
/**
|
|
32
28
|
* Gets a copy of all workspace directories.
|
|
33
29
|
* @returns Array of absolute directory paths
|
|
@@ -41,6 +37,12 @@ export declare class WorkspaceContext {
|
|
|
41
37
|
* @returns True if the path is within the workspace, false otherwise
|
|
42
38
|
*/
|
|
43
39
|
isPathWithinWorkspace(pathToCheck: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Fully resolves a path, including symbolic links.
|
|
42
|
+
* If the path does not exist, it returns the fully resolved path as it would be
|
|
43
|
+
* if it did exist.
|
|
44
|
+
*/
|
|
45
|
+
private fullyResolvedPath;
|
|
44
46
|
/**
|
|
45
47
|
* Checks if a path is within a given root directory.
|
|
46
48
|
* @param pathToCheck The absolute path to check
|
|
@@ -48,4 +50,8 @@ export declare class WorkspaceContext {
|
|
|
48
50
|
* @returns True if the path is within the root directory, false otherwise
|
|
49
51
|
*/
|
|
50
52
|
private isPathWithinRoot;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a file path is a symbolic link that points to a file.
|
|
55
|
+
*/
|
|
56
|
+
private isFileSymlink;
|
|
51
57
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { isNodeError } from '../utils/errors.js';
|
|
6
7
|
import * as fs from 'fs';
|
|
7
8
|
import * as path from 'path';
|
|
8
9
|
/**
|
|
@@ -11,22 +12,19 @@ import * as path from 'path';
|
|
|
11
12
|
* in a single session.
|
|
12
13
|
*/
|
|
13
14
|
export class WorkspaceContext {
|
|
14
|
-
directories;
|
|
15
|
+
directories = new Set();
|
|
15
16
|
initialDirectories;
|
|
16
17
|
/**
|
|
17
18
|
* Creates a new WorkspaceContext with the given initial directory and optional additional directories.
|
|
18
|
-
* @param
|
|
19
|
+
* @param directory The initial working directory (usually cwd)
|
|
19
20
|
* @param additionalDirectories Optional array of additional directories to include
|
|
20
21
|
*/
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.addInitialDirectoryInternal(initialDirectory);
|
|
26
|
-
for (const dir of additionalDirectories) {
|
|
27
|
-
this.addDirectoryInternal(dir);
|
|
28
|
-
this.addInitialDirectoryInternal(dir);
|
|
22
|
+
constructor(directory, additionalDirectories = []) {
|
|
23
|
+
this.addDirectory(directory);
|
|
24
|
+
for (const additionalDirectory of additionalDirectories) {
|
|
25
|
+
this.addDirectory(additionalDirectory);
|
|
29
26
|
}
|
|
27
|
+
this.initialDirectories = new Set(this.directories);
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
30
|
* Adds a directory to the workspace.
|
|
@@ -34,12 +32,9 @@ export class WorkspaceContext {
|
|
|
34
32
|
* @param basePath Optional base path for resolving relative paths (defaults to cwd)
|
|
35
33
|
*/
|
|
36
34
|
addDirectory(directory, basePath = process.cwd()) {
|
|
37
|
-
this.
|
|
35
|
+
this.directories.add(this.resolveAndValidateDir(directory, basePath));
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
* Internal method to add a directory with validation.
|
|
41
|
-
*/
|
|
42
|
-
addDirectoryInternal(directory, basePath = process.cwd()) {
|
|
37
|
+
resolveAndValidateDir(directory, basePath = process.cwd()) {
|
|
43
38
|
const absolutePath = path.isAbsolute(directory)
|
|
44
39
|
? directory
|
|
45
40
|
: path.resolve(basePath, directory);
|
|
@@ -50,34 +45,7 @@ export class WorkspaceContext {
|
|
|
50
45
|
if (!stats.isDirectory()) {
|
|
51
46
|
throw new Error(`Path is not a directory: ${absolutePath}`);
|
|
52
47
|
}
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
realPath = fs.realpathSync(absolutePath);
|
|
56
|
-
}
|
|
57
|
-
catch (_error) {
|
|
58
|
-
throw new Error(`Failed to resolve path: ${absolutePath}`);
|
|
59
|
-
}
|
|
60
|
-
this.directories.add(realPath);
|
|
61
|
-
}
|
|
62
|
-
addInitialDirectoryInternal(directory, basePath = process.cwd()) {
|
|
63
|
-
const absolutePath = path.isAbsolute(directory)
|
|
64
|
-
? directory
|
|
65
|
-
: path.resolve(basePath, directory);
|
|
66
|
-
if (!fs.existsSync(absolutePath)) {
|
|
67
|
-
throw new Error(`Directory does not exist: ${absolutePath}`);
|
|
68
|
-
}
|
|
69
|
-
const stats = fs.statSync(absolutePath);
|
|
70
|
-
if (!stats.isDirectory()) {
|
|
71
|
-
throw new Error(`Path is not a directory: ${absolutePath}`);
|
|
72
|
-
}
|
|
73
|
-
let realPath;
|
|
74
|
-
try {
|
|
75
|
-
realPath = fs.realpathSync(absolutePath);
|
|
76
|
-
}
|
|
77
|
-
catch (_error) {
|
|
78
|
-
throw new Error(`Failed to resolve path: ${absolutePath}`);
|
|
79
|
-
}
|
|
80
|
-
this.initialDirectories.add(realPath);
|
|
48
|
+
return fs.realpathSync(absolutePath);
|
|
81
49
|
}
|
|
82
50
|
/**
|
|
83
51
|
* Gets a copy of all workspace directories.
|
|
@@ -92,7 +60,7 @@ export class WorkspaceContext {
|
|
|
92
60
|
setDirectories(directories) {
|
|
93
61
|
this.directories.clear();
|
|
94
62
|
for (const dir of directories) {
|
|
95
|
-
this.
|
|
63
|
+
this.addDirectory(dir);
|
|
96
64
|
}
|
|
97
65
|
}
|
|
98
66
|
/**
|
|
@@ -102,18 +70,9 @@ export class WorkspaceContext {
|
|
|
102
70
|
*/
|
|
103
71
|
isPathWithinWorkspace(pathToCheck) {
|
|
104
72
|
try {
|
|
105
|
-
const
|
|
106
|
-
let resolvedPath = absolutePath;
|
|
107
|
-
if (fs.existsSync(absolutePath)) {
|
|
108
|
-
try {
|
|
109
|
-
resolvedPath = fs.realpathSync(absolutePath);
|
|
110
|
-
}
|
|
111
|
-
catch (_error) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
73
|
+
const fullyResolvedPath = this.fullyResolvedPath(pathToCheck);
|
|
115
74
|
for (const dir of this.directories) {
|
|
116
|
-
if (this.isPathWithinRoot(
|
|
75
|
+
if (this.isPathWithinRoot(fullyResolvedPath, dir)) {
|
|
117
76
|
return true;
|
|
118
77
|
}
|
|
119
78
|
}
|
|
@@ -123,6 +82,28 @@ export class WorkspaceContext {
|
|
|
123
82
|
return false;
|
|
124
83
|
}
|
|
125
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Fully resolves a path, including symbolic links.
|
|
87
|
+
* If the path does not exist, it returns the fully resolved path as it would be
|
|
88
|
+
* if it did exist.
|
|
89
|
+
*/
|
|
90
|
+
fullyResolvedPath(pathToCheck) {
|
|
91
|
+
try {
|
|
92
|
+
return fs.realpathSync(pathToCheck);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
if (isNodeError(e) &&
|
|
96
|
+
e.code === 'ENOENT' &&
|
|
97
|
+
e.path &&
|
|
98
|
+
// realpathSync does not set e.path correctly for symlinks to
|
|
99
|
+
// non-existent files.
|
|
100
|
+
!this.isFileSymlink(e.path)) {
|
|
101
|
+
// If it doesn't exist, e.path contains the fully resolved path.
|
|
102
|
+
return e.path;
|
|
103
|
+
}
|
|
104
|
+
throw e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
126
107
|
/**
|
|
127
108
|
* Checks if a path is within a given root directory.
|
|
128
109
|
* @param pathToCheck The absolute path to check
|
|
@@ -135,5 +116,16 @@ export class WorkspaceContext {
|
|
|
135
116
|
relative !== '..' &&
|
|
136
117
|
!path.isAbsolute(relative));
|
|
137
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Checks if a file path is a symbolic link that points to a file.
|
|
121
|
+
*/
|
|
122
|
+
isFileSymlink(filePath) {
|
|
123
|
+
try {
|
|
124
|
+
return !fs.readlinkSync(filePath).endsWith('/');
|
|
125
|
+
}
|
|
126
|
+
catch (_error) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
138
130
|
}
|
|
139
131
|
//# sourceMappingURL=workspaceContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceContext.js","sourceRoot":"","sources":["../../../src/utils/workspaceContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,O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