Protected ReadonlyaccessibleProtected ReadonlyaiProtected ReadonlyenvProtected ReadonlyfileProtected ReadonlyGITIGNORE_Protected ReadonlyloggerProtected ReadonlypreferencesProtected ReadonlyworkspaceProtecteddescribeLists the workspace root names with their locations, for error messages.
Asserts the target URI is reachable by the AI tools. Allowed when the URI is inside any workspace
root, below a root contributed by an AccessibleRootContribution, or covered by an entry of
the ai-features.workspaceFunctions.allowedExternalPaths preference. Workspace-scoped overrides of
that preference are dropped when the workspace is not trusted.
The target URI is normalized before the check so that literal ..
segments and percent-encoded equivalents (e.g. %2e%2e) are resolved
away — otherwise the path-prefix comparison would admit traversals.
Note: symlinks within allow-listed directories are NOT canonicalized before the check. Only allow-list directories whose contents you trust.
Resolves the configured external allow-list to URIs. Reads via the
trust-aware AiConfigurationService so workspace-scoped overrides are
dropped when the workspace is untrusted. Awaits the service's ready promise
so that the trust state is resolved before the first preference read.
Non-string entries, blanks, and entries that don't parse to a file://
URI are filtered out; URIs are returned in normalized form.
OptionalresourceUri: stringProtectedgetThe roots contributed by AccessibleRootContributions, normalized like the allow-list. A contribution that fails to resolve is skipped rather than allowed to fail every path check.
ProtectedgetReturns the cached .gitignore matcher for the given root, reading the file at most
once per root. A root with no (or unreadable) .gitignore is cached as undefined.
The cache is invalidated by initializeGitignoreWatcher when the .gitignore is
created, changed, or deleted, so individual exclusion checks need no filesystem RPC.
ProtectedgetReturns a mapping of root names to root URIs, in workspace order.
Root names are assigned by WorkspaceService.getRootNames: the directory basename, or for
roots sharing a basename, the shortest tail of the path that tells them apart (e.g. alice/app
and bob/app). Every root thus has a name, and names are always the ending of the real path.
Returns the root name for a given root URI, see WorkspaceService.getRootName.
Protectedinit── Initialization ──────────────────────────────────────────────────
ProtectedisProtectedisProtectedisResolves a tool argument and asserts that it may be accessed. This is the single entry point every tool uses, so that a path is subjected to the same parsing and the same boundary check no matter which tool received it.
Resolves a relative path to a URI using a deterministic, synchronous algorithm.
No filesystem I/O is performed — the agent is expected to use <rootName>/<relativePath>
format. If the path cannot be resolved deterministically, an error is thrown.
Resolution order:
ProtectedresolveIf the given separator-normalized path is ~ or starts with ~/,
expands the leading ~ against the user's home directory and returns
the resulting URI. Returns undefined if the path does not start with
~ or the home directory cannot be resolved. The remainder is
resolved in URI space to avoid Windows drive-letter round-tripping
issues with URI.fromFilePath.
ProtectedtoConverts a user-supplied allow-list entry (absolute POSIX path, Windows
drive path, ~-prefixed path, or file:// URI) into a normalized URI.
Returns undefined for invalid input (relative paths, malformed URIs).
Converts a URI to a workspace-relative path with root name prefix, see WorkspaceService.getRootPrefixedPath.
Format:
StatichasWhether the already-separator-normalized path contains .. as a path
segment (not merely as a substring of a filename like my..file.json).
StaticisWhether an already-separator-normalized path is absolute on either
platform: POSIX /foo, UNC //host/share, or Windows drive C:/foo.
StaticwithoutReturns the URI without a trailing path separator (except for a root path). This makes
directory comparisons via URI.isEqualOrParent insensitive to a trailing slash, so
an allow-list entry such as /foo/ matches the directory /foo itself, not only its
children.
Whether path comparisons should be case-sensitive on the current backend. Windows and macOS default to case-insensitive file systems (NTFS, HFS+, APFS); Linux is treated as case-sensitive. This is a heuristic — a case-sensitive APFS volume on macOS or a case-insensitive volume mounted on Linux will be misclassified, but querying the actual file system would require a backend round-trip.