@khanglvm/relay 0.23.0 → 0.23.1
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/package.json +1 -1
- package/src/file-access.js +16 -1
- package/src/store.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanglvm/relay",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "Question boards with rich blocks (markdown, charts, mermaid, tables, code, diffs, video, sandboxed HTML), clickable local file-links, and element-level annotations for AI coding agents (Claude Code, Codex, …): ask users structured questions, present interactive visuals, collect inline comments, read answers as JSON — in a local browser board OR rendered INLINE inside the Claude & Codex apps as an MCP App (SEP-1865).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
package/src/file-access.js
CHANGED
|
@@ -112,9 +112,24 @@ export function checkReadable(access, raw, { allowDirectory = false } = {}) {
|
|
|
112
112
|
// O_NONBLOCK keeps a file swapped for a FIFO from hanging the open; the identity check below then refuses it.
|
|
113
113
|
const OPEN_FLAGS = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0);
|
|
114
114
|
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* The path the kernel holds for an open descriptor, or null where Node cannot ask (macOS, Windows).
|
|
117
|
+
* Linux keeps it in /proc/self/fd, which no rename of a parent folder can fake.
|
|
118
|
+
*/
|
|
119
|
+
function openedPath(fd) {
|
|
120
|
+
if (process.platform !== 'linux') return null;
|
|
121
|
+
try { return fs.readlinkSync(`/proc/self/fd/${fd}`); } catch { return null; }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* True when `file` still resolves to itself, inside the roots, and is the very file `fd` has open.
|
|
126
|
+
* Known open risk on macOS and Windows: the name checks below walk the path again, so a writer inside a
|
|
127
|
+
* root who swaps a parent folder for a symlink and back between those calls can still win the race.
|
|
128
|
+
*/
|
|
116
129
|
function isStillTheCheckedFile(access, file, fd) {
|
|
117
130
|
try {
|
|
131
|
+
const opened = openedPath(fd);
|
|
132
|
+
if (opened !== null && opened !== file) return false;
|
|
118
133
|
if (fs.realpathSync.native(file) !== file || !isInsideRoots(file, access.roots)) return false;
|
|
119
134
|
const open = fs.fstatSync(fd);
|
|
120
135
|
const named = fs.statSync(file);
|
package/src/store.js
CHANGED
|
@@ -62,6 +62,8 @@ export function boardFileRoots(record) {
|
|
|
62
62
|
* @param {{ fileRoots?: string[], retentionDays?: number | string | boolean }} [options] `fileRoots`: the roots the spec was read under; the live server opens only files inside them. `retentionDays`: how long old boards stay (see `resolveRetentionDays`)
|
|
63
63
|
*/
|
|
64
64
|
export function createBoard(spec, { fileRoots, retentionDays } = {}) {
|
|
65
|
+
// A bad retention setting throws here, before any file is written.
|
|
66
|
+
const days = resolveRetentionDays(retentionDays);
|
|
65
67
|
ensureDirs();
|
|
66
68
|
const record = {
|
|
67
69
|
id: newId(),
|
|
@@ -77,7 +79,7 @@ export function createBoard(spec, { fileRoots, retentionDays } = {}) {
|
|
|
77
79
|
result: null,
|
|
78
80
|
};
|
|
79
81
|
saveBoard(record);
|
|
80
|
-
pruneOldBoards(
|
|
82
|
+
pruneOldBoards(days);
|
|
81
83
|
return record;
|
|
82
84
|
}
|
|
83
85
|
|