fix(explorer): align directory mentions with workspace-root grammar - #574
Open
bulingbuling688 wants to merge 2 commits into
Open
fix(explorer): align directory mentions with workspace-root grammar#574bulingbuling688 wants to merge 2 commits into
bulingbuling688 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #479
The explorer inserts complete directory references such as
@src/and@"my dir/", and derives file and directory tokens from the host-confirmed workspace root. Earlier fixes already added quoted file mentions, structured file chips, and directory trailing slashes; this PR addresses the two remaining gaps identified by the maintainer. It also fixes the missing separator between consecutive directory and file insertions discovered during real-host verification.The old callback interpolated directories directly and called
relativeTo(sessionCwd, path), whose outside-cwd fallback returns an absolute path. The callback now shares a validated workspace-relative insertion path. File chips retain their payload and quoted plain-text fallback. Directories retain plain-text completion behavior: normalize separators to/, place the trailing slash inside the closing quote, and reject embedded quotes and control characters. Referencing the workspace itself remains@./.Workspace authority is the public, read-only
ctx.get('workspaces').list.getSnapshot(): match the current session ID inWorkspaceView.sessionIds, then read its canonicalpath. This is the membership lookup used by the native conversation shell, without guessing a root from cwd or parent directories. The structural mirror follows published rc.1 declarations without adding a dependency or runtime import:The snapshot is read on each click. Missing service/membership, pending/loading/error snapshots, outside-workspace entries and unsafe path projections leave the draft unchanged and log the reason. There is no absolute-mention fallback. Windows drive/UNC comparisons tolerate casing and mixed separators while preserving target spelling; POSIX comparisons remain case-sensitive. The existing copy-relative-path helper is unchanged.
The rc.1 native picker uses plain text for directory drill and supports folder chips on explicit selection. Its drill formatter leaves a quote open for completion; the sidebar inserts a complete closed token as requested in #479. The host's
insertReferenceadds space after a file chip but not before it. Completed directory insertions therefore add a separator outside the token, preventing@"my dir/"@"docs/my notes.md". Plain-text joins reuse existing whitespace.insertFileReferenceitself remains byte-for-byte unchanged from the original parent commit.Regression coverage includes ordinary/spaced/nested directories, Windows drive/UNC/mixed separators, root self-reference, quotes/control characters, cwd equal to or below workspace root, a file outside cwd but inside workspace, unavailable workspace data and recovery, structured file payloads, unhandled-chip fallback, and consecutive-reference separation. Tests exercise pure functions and the rendered Sidebar callback without copying production logic or asserting source strings.
Actual local validation on latest commit
1ad9ac75068261ffcf4e595d7e2d71dfde7808bb(Linux/WSL2, Node 24.20.0):reference-mention+pathsfilessidebar-workspace-referencefileconversation-draftfilepnpm testpnpm typecheck,pnpm lint,pnpm build,pnpm check:consumer-types,git diff --checkThe original issue regressions also failed before implementation (44 failed / 12 passed when all original production changes were withdrawn), and passed after restoration. The missing system build tools were installed earlier (GNU Make 4.3, GCC/G++ 13.3), and
pnpm rebuild node-ptysucceeded. All 31 earlier node-pty failures disappeared after repairing the environment; prior branch/baseline runs had the same 31 failing test names. No test exclusions or dependency changes were used to mask the environment problem.Latest-commit real UI validation on 2026-09-07: 9 checks passed on Linux and 9 on native Windows, using the packed plugin installed by the official DSH CLI into isolated profiles. DSH was 0.1.2-rc.1 on both; Linux Node 24.20.0, Windows Node 24.19.0 /
process.platform=win32/ Windows 10.0.26200 x64. Browser automation ran in Chromium on each OS, with no host/session mocks:@"my dir/" @"docs/my notes.md"and retained one native file chip.user/messageand cleared the composer; screenshots record the resulting message display.KEEPunchanged; registration was restored.The latest combined sends used keyless profiles and establish host acceptance/rendering, not successful model execution. Earlier on commit
cb271e0, after the user configured credentials,deepseek-official / deepseek-v4-flashsuccessfully ran two real browser-submitted checks:readreturned a random verification value from a spaced-path file, andglobreturned two random child filenames from a spaced directory. Final replies exactly matched values not supplied in the prompts; both turns completed and fixture contents were unchanged. Those two model calls were not repeated on the separator follow-up commit. No API key was read or recorded.Remaining live-contract limitation: the local discovery provider searches from session header cwd, and the workspace registry filters membership to canonical cwd equality. Actual rc.1 API attempts rejected
workspaceIdplus childcwdwithgateway/bad-request, and rejected adopting an existing child-cwd session into a parent workspace withsession/conflict. Thus the differing-cwd case is covered by authoritative workspace snapshot fixtures; it is not claimed as a reproduced live rc.1 configuration. No DSH source was modified or patched to manufacture one.CI for latest commit
1ad9ac7:action_required, awaiting maintainer approval.The PR is ready for review, open and unmerged. Fork CI does not replace upstream approval or review. Version, dependencies, lockfile and release configuration are unchanged; the worktree is clean. These UI checks are browser automation, not a human manual walkthrough.