A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Map a relative link into the old data through an alias into the copy
Fei241171977b498a9f
diff --git a/app/src/move-data.mjs b/app/src/move-data.mjsindex d166fd78..1c82f187 100644--- a/app/src/move-data.mjs+++ b/app/src/move-data.mjs@@ -63,12 +63,13 @@ async function relink(source, path, roots, to) {const written = resolve(dirname(source), text)// Through another link the target can lead inside the old folder too.const physical = await realpath(written).catch(() => written)- const target = roots.some(folder => within(written, folder)) ? written : physical+ const direct = roots.some(folder => within(written, folder))+ const target = direct ? written : physicalconst root = roots.find(folder => within(target, folder))const folder = (await stat(source).catch(() => undefined))?.isDirectory() === trueconst windows = process.platform === 'win32'const inside = root === undefined ? written : join(to, relative(root, target))- await symlink(root !== undefined && !isAbsolute(text) && !(windows && folder) ? text : inside, path, folder ? (windows ? 'junction' : 'dir') : 'file')+ await symlink(direct && !isAbsolute(text) && !(windows && folder) ? text : inside, path, folder ? (windows ? 'junction' : 'dir') : 'file')}/**diff --git a/app/test/move-data.test.mjs b/app/test/move-data.test.mjsindex 95d91097..38a88ac6 100644--- a/app/test/move-data.test.mjs+++ b/app/test/move-data.test.mjs@@ -132,6 +132,7 @@ test('links in the data lead inside the copy, not back into the old folder', asyif (process.platform !== 'win32') {symlinkSync(join('..', 'sessions'), join(from, 'bot', 'relative'), 'dir')symlinkSync(join('..', '..', 'elsewhere'), join(from, 'bot', 'relative-outside'), 'dir')+ symlinkSync(join('..', '..', 'data-alias', 'sessions'), join(from, 'bot', 'relative-alias'), 'dir')}// Deeper than the old folder, so that a relative link out of it would lead elsewhere.const to = join(root, 'deeper', 'new')@@ -143,6 +144,7 @@ test('links in the data lead inside the copy, not back into the old folder', asyif (process.platform !== 'win32') {assert.equal(target('relative'), join('..', 'sessions'))assert.equal(target('relative-outside'), join(root, 'elsewhere'))+ assert.equal(target('relative-alias'), join(to, 'sessions'))}assert.equal(readFileSync(join(to, 'bot', 'absolute', 'g', 's1', 'log.jsonl'), 'utf8'), 'chat')})