@yeaft/webchat-agent 1.0.542 → 1.0.543

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.
Binary file
@@ -17,6 +17,6 @@
17
17
  </head>
18
18
  <body>
19
19
  <div id="app"></div>
20
- <script type="module" src="app.bundle.js?v=78f185fb"></script>
20
+ <script type="module" src="app.bundle.js?v=bb1b9484"></script>
21
21
  </body>
22
22
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.542",
3
+ "version": "1.0.543",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -6,10 +6,19 @@ import { resolveAndValidatePath } from './utils.js';
6
6
  import { sendWorkbenchResult } from './request-routing.js';
7
7
 
8
8
  const MAX_REFERENCES = 32;
9
+ const MAX_REFERENCE_LENGTH = 4096;
9
10
  const MAX_SCANNED_ENTRIES = 5000;
10
11
  const MAX_DEPTH = 10;
12
+ const URI_SCHEME = /^[A-Za-z][A-Za-z\d+.-]*:/;
13
+ const WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]/;
11
14
  const SKIP_DIRS = new Set(['.git', 'node_modules', '__pycache__', '.next', '.nuxt', 'dist', 'build', '.cache', 'bin', 'obj']);
12
15
 
16
+ function isFilesystemReference(value) {
17
+ return value.length <= MAX_REFERENCE_LENGTH
18
+ && !value.includes('\0')
19
+ && (!URI_SCHEME.test(value) || WINDOWS_ABSOLUTE_PATH.test(value));
20
+ }
21
+
13
22
  function comparable(value) {
14
23
  const normalized = String(value || '').replaceAll('\\', '/');
15
24
  return platform() === 'win32' ? normalized.toLowerCase() : normalized;
@@ -79,21 +88,22 @@ async function findUniqueBasenames(workDir, requestedPaths, {
79
88
  export async function resolveFileReferences(references, workDir, scanOptions) {
80
89
  const unique = [...new Set((Array.isArray(references) ? references : [])
81
90
  .map(value => typeof value === 'string' ? value.trim() : '')
82
- .filter(Boolean))].slice(0, MAX_REFERENCES);
91
+ .filter(value => value && isFilesystemReference(value)))].slice(0, MAX_REFERENCES);
83
92
  const root = resolve(workDir);
84
93
  const canonicalRoot = await realpath(root);
85
94
  const exactCandidates = unique.map(requestedPath => resolveAndValidatePath(requestedPath, root));
86
95
  const exactMatches = await Promise.all(exactCandidates.map(exactPath => (
87
96
  canonicalWorkspaceFile(exactPath, canonicalRoot)
88
97
  )));
89
- const unresolved = unique.filter((_path, index) => (
90
- !exactMatches[index] && isInsideWorkspace(root, exactCandidates[index])
98
+ const fallbackEligible = exactCandidates.map((exactPath, index) => (
99
+ !exactMatches[index] && isInsideWorkspace(root, exactPath)
91
100
  ));
101
+ const unresolved = unique.filter((_path, index) => fallbackEligible[index]);
92
102
  const basenameScan = await findUniqueBasenames(root, unresolved, scanOptions);
93
103
 
94
104
  const resolvedEntries = await Promise.all(unique.map(async (requestedPath, index) => {
95
105
  const matches = basenameScan.matches.get(comparable(basename(requestedPath))) || [];
96
- const fallbackPath = basenameScan.complete && matches.length === 1
106
+ const fallbackPath = fallbackEligible[index] && basenameScan.complete && matches.length === 1
97
107
  ? await canonicalWorkspaceFile(matches[0], canonicalRoot)
98
108
  : null;
99
109
  const matchedPath = exactMatches[index] || fallbackPath;