fix(memory-feedback): gate 2 hardening, commit within 5 locals
This commit is contained in:
1 parent
271172564c
commit
027e5b3c21
8 files changed
+116
-27
No files matched your search
@@ -16,11 +16,14 @@ const CONTEXT_SUFFIX = /-context$/ // tool.call attachments: <id>-context
|
||||
/** The transcript folder name of a project root. */
|
||||
export const slugOf = (root: string) => root.replace(/[^A-Za-z0-9]/g, '-')
|
||||
|
||||
const SAFE_ID = /^[A-Za-z0-9_-]+$/
|
||||
|
||||
/** The transcript of a session's main thread, or of one sub-agent
|
||||
* (`subagents/agent-<id>.jsonl`, the id the log keeps in `agent`). */
|
||||
export function sessionFiles(
|
||||
projects: string, root: string, session: string, agent: string,
|
||||
): string[] {
|
||||
if (!SAFE_ID.test(session) || !SAFE_ID.test(agent)) return []
|
||||
const dir = path.join(projects, slugOf(root))
|
||||
const file = agent === 'main'
|
||||
? path.join(dir, `${session}.jsonl`)
|
||||
|
||||
Reference in new issue
Block a user