mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-14 23:19:55 +00:00
fix(shell): allow read-only copies from internal state files
Keep the new exec guard focused on writes to history.jsonl and .dream_cursor while still allowing read-only copy operations out of those files. Made-with: Cursor
This commit is contained in:
parent
3f59bd1443
commit
5dc238c7ef
@ -66,7 +66,7 @@ class ExecTool(Tool):
|
||||
# direct writes corrupt the cursor format and crash /dream.
|
||||
r">>?\s*\S*(?:history\.jsonl|\.dream_cursor)", # > / >> redirect
|
||||
r"\btee\b[^|;&<>]*(?:history\.jsonl|\.dream_cursor)", # tee / tee -a
|
||||
r"\b(?:cp|mv)\b[^|;&<>]*(?:history\.jsonl|\.dream_cursor)", # cp/mv target
|
||||
r"\b(?:cp|mv)\b(?:\s+[^\s|;&<>]+)+\s+\S*(?:history\.jsonl|\.dream_cursor)", # cp/mv target
|
||||
r"\bdd\b[^|;&<>]*\bof=\S*(?:history\.jsonl|\.dream_cursor)", # dd of=
|
||||
r"\bsed\s+-i[^|;&<>]*(?:history\.jsonl|\.dream_cursor)", # sed -i
|
||||
]
|
||||
|
||||
@ -104,6 +104,7 @@ def test_exec_blocks_writes_to_history_jsonl(command):
|
||||
"wc -l history.jsonl",
|
||||
"tail -n 5 history.jsonl",
|
||||
"grep foo history.jsonl",
|
||||
"cp history.jsonl /tmp/history.backup",
|
||||
"ls memory/",
|
||||
"echo history.jsonl",
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user