fix: v2.7.4 — Changes matches JetBrains (#72), the chat says when Claude waits on a trust prompt (#73), Vietnamese Telex in Safari
- Changes (#72): a file git reports `MM` whose working copy equals HEAD again (a staged change since undone on disk) is no longer listed — JetBrains' GitChangesCollector drops it the same way. Mode-only changes stay listed. statusCounts (the dirty-tree safety checks) is unchanged. - Chat (#73): Claude Code runs no hook before a folder is trusted, so a new pane's session has no row; the chat now says the session has not started, offers Open terminal, and asks before typing a message or /model //effort into the pane (an Enter would pick the trust prompt's "No, exit"). - Terminal: Safari + macOS's own Vietnamese Telex replaces the whole word on each key (insertReplacementText), which xterm.js ignores — only each word's first letter reached the pane. The edit is now sent as DELs + the new tail. - Also: Ctrl+V pastes a screenshot into the terminal as a file path; the folder browser fallback lists files for a file field (`files=1`); the macOS native picker opens in front of the browser; a hidden tab is marked while a chat waits or once a turn ended; chat live line shows running calls, turn time and tokens, and "Done in …".
This commit is contained in:
+11
-4
@@ -35,7 +35,7 @@ const { sameOriginGuard } = require("./run");
|
||||
const { isLocalRequest } = require("../lib/same-origin");
|
||||
const scope = require("../lib/scope");
|
||||
const { writeLaneFile } = require("../lib/lane-file-write");
|
||||
const { pickPath } = require("../lib/native-dialog");
|
||||
const { pickPath, startDir } = require("../lib/native-dialog");
|
||||
const { preflight } = require("../lib/lane-preflight");
|
||||
const {
|
||||
LANES_ROOT,
|
||||
@@ -564,15 +564,20 @@ router.post("/gc", sameOriginGuard, (req, res) => {
|
||||
* expose absolute filesystem paths from a native picker, so path selection is
|
||||
* done by browsing server-side instead. Read-only; registered ahead of
|
||||
* "/:id" so the literal "browse" segment is never captured as a lane id.
|
||||
* `files=1` (a file field's fallback) lists files too, and opens `path` the
|
||||
* way the native picker would (`startDir`: `~`, a file's folder, else home).
|
||||
*/
|
||||
router.get("/browse", (req, res) => {
|
||||
// A developer browses only their own folder (by real path: a link in it
|
||||
// cannot point the listing elsewhere) — the dashboard lists with its own
|
||||
// rights, CAP_DAC_READ_SEARCH under S3, not theirs.
|
||||
const own = scope.ownFolder(req);
|
||||
const files = req.query.files === "1";
|
||||
const raw =
|
||||
typeof req.query.path === "string" && req.query.path.trim()
|
||||
? req.query.path
|
||||
? files
|
||||
? startDir(req.query.path)
|
||||
: req.query.path
|
||||
: own || os.homedir();
|
||||
const resolved = own ? lanesLib.canonicalCwd(path.resolve(raw)) : path.resolve(raw);
|
||||
if (own && !scope.folderAllowed(req, resolved, { allowHome: true })) return refuseFolder(res);
|
||||
@@ -593,12 +598,14 @@ router.get("/browse", (req, res) => {
|
||||
try {
|
||||
entries = fs
|
||||
.readdirSync(resolved, { withFileTypes: true })
|
||||
.filter((e) => e.isDirectory() && !e.name.startsWith("."))
|
||||
.filter((e) => (e.isDirectory() || (files && e.isFile())) && !e.name.startsWith("."))
|
||||
.map((e) => {
|
||||
const full = path.join(resolved, e.name);
|
||||
if (e.isFile()) return { name: e.name, path: full, isGitRepo: false, file: true };
|
||||
return { name: e.name, path: full, isGitRepo: fs.existsSync(path.join(full, ".git")) };
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
// Folders first, as every file picker lists them.
|
||||
.sort((a, b) => !!a.file - !!b.file || a.name.localeCompare(b.name));
|
||||
} catch {
|
||||
// An unreadable entry mid-listing is skipped, not a request failure.
|
||||
}
|
||||
|
||||
+17
-10
@@ -531,11 +531,19 @@ router.get("/drop/:name", (req, res) => {
|
||||
// for a link after the check): a regular file this account wrote. NOFOLLOW
|
||||
// refuses a link outright; NONBLOCK keeps a FIFO from hanging the loop.
|
||||
// S3: the requester's own drop dir, owned by their member account — so an
|
||||
// admin viewing a member's session gets the name chip, not the image.
|
||||
// admin viewing a member's session gets the name chip, not the image. An
|
||||
// admin's host-folder workspace drops into the HOST's dir (only an admin
|
||||
// may own one), and the chat's GET names no workspace: that dir too.
|
||||
const dirs = type ? [dropDir(req)] : [];
|
||||
if (dirs[0]?.member && req.user?.role === "admin" && !req.query?.laneId) {
|
||||
dirs.push({
|
||||
dir: path.join(require("../lib/claude-home").getDataDir(), "drops"),
|
||||
member: null,
|
||||
});
|
||||
}
|
||||
let fd = null;
|
||||
try {
|
||||
if (type) {
|
||||
const { dir, member } = dropDir(req);
|
||||
for (const { dir, member } of dirs) {
|
||||
try {
|
||||
fd = fs.openSync(
|
||||
path.join(dir, name),
|
||||
fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | (fs.constants.O_NONBLOCK || 0)
|
||||
@@ -546,13 +554,12 @@ router.get("/drop/:name", (req, res) => {
|
||||
: typeof process.getuid === "function"
|
||||
? process.getuid()
|
||||
: st.uid;
|
||||
if (!st.isFile() || st.uid !== uid) {
|
||||
fs.closeSync(fd);
|
||||
fd = null;
|
||||
}
|
||||
if (st.isFile() && st.uid === uid) break;
|
||||
fs.closeSync(fd);
|
||||
fd = null;
|
||||
} catch {
|
||||
/* pruned, never dropped, or a link */
|
||||
}
|
||||
} catch {
|
||||
/* pruned, never dropped, or a link */
|
||||
}
|
||||
if (fd === null) {
|
||||
return res.status(404).json({ error: { code: "ENOTFOUND", message: "no such image" } });
|
||||
|
||||
@@ -480,8 +480,10 @@ router.get("/:id/outline", (req, res) => {
|
||||
// pane's Files read preview when it lies outside the workspace (a screenshot
|
||||
// under ~/.cache, /tmp). The path is authorized only by that event, so: raster
|
||||
// types only, under a sandbox CSP with nosniff; never for a pushed session
|
||||
// (another machine's paths), and not in server mode, where a member's hook
|
||||
// could name a host-only file that this process would then read as the host.
|
||||
// (another machine's paths). In server mode only with S3, where a member's hook
|
||||
// reports sessions in its own home only (hook-auth.js): a member's session gets
|
||||
// only a file inside that home and owned by them; a host session (a trusted
|
||||
// peer's) anything. Without S3 a member's hook could name a host-only file.
|
||||
const READ_IMAGE_TYPES = {
|
||||
png: "image/png",
|
||||
jpg: "image/jpeg",
|
||||
@@ -500,12 +502,18 @@ router.get("/:id/image", async (req, res) => {
|
||||
const fail = (status, code, message) => res.status(status).json({ error: { code, message } });
|
||||
const session = stmts.getSession.get(req.params.id);
|
||||
if (!session) return fail(404, "NOT_FOUND", "Session not found");
|
||||
if (isServerMode() || String(session.source || "").startsWith("push:")) {
|
||||
const s3 = require("../lib/linux-accounts").s3Enabled();
|
||||
if ((isServerMode() && !s3) || String(session.source || "").startsWith("push:")) {
|
||||
return fail(403, "EUNSUPPORTED", "not available for this session");
|
||||
}
|
||||
const file = typeof req.query.path === "string" ? req.query.path : "";
|
||||
const type = READ_IMAGE_TYPES[path.extname(file).slice(1).toLowerCase()];
|
||||
if (!path.isAbsolute(file) || !type) return fail(400, "ENOTIMAGE", "not an image path");
|
||||
const runAs = require("../lib/run-as");
|
||||
const member = s3 ? runAs.ownerForRead(session.cwd) : null;
|
||||
if (member && !require("../lib/hook-auth").inside(member.home, file)) {
|
||||
return fail(404, "ENOTFOUND", "the session never read that image");
|
||||
}
|
||||
if (!sessionReadFile.get(session.id, file)) {
|
||||
return fail(404, "ENOTFOUND", "the session never read that image");
|
||||
}
|
||||
@@ -514,7 +522,11 @@ router.get("/:id/image", async (req, res) => {
|
||||
// NONBLOCK: a FIFO named like an image must not hang the event loop.
|
||||
fh = await fs.promises.open(file, fs.constants.O_RDONLY | (fs.constants.O_NONBLOCK || 0));
|
||||
const st = await fh.stat();
|
||||
if (!st.isFile()) return fail(404, "ENOTFOUND", "no such image");
|
||||
// A file in a member's home is read only when that member owns it (openSafe's rule).
|
||||
const fileOwner = s3 ? runAs.ownerForRead(file) : null;
|
||||
if (!st.isFile() || (fileOwner && st.uid !== fileOwner.uid)) {
|
||||
return fail(404, "ENOTFOUND", "no such image");
|
||||
}
|
||||
if (st.size > READ_IMAGE_MAX) return fail(400, "ETOOBIG", "image is larger than 20 MB");
|
||||
const buf = await fh.readFile();
|
||||
res.set({
|
||||
|
||||
Reference in New Issue
Block a user