A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Give the import's check the runtime folder on Linux
AdamPlatin1233884f11d896f
diff --git a/app/src/main.mjs b/app/src/main.mjsindex 386d45f0..408f4ac3 100644--- a/app/src/main.mjs+++ b/app/src/main.mjs@@ -550,6 +550,7 @@ async function removeMade() {const profileDir = () => join(places.dataDir, 'profiles', PROFILE)const pnpmEntry = () => join(app.getAppPath(), 'node_modules', 'pnpm', 'bin', 'pnpm.mjs')+const runtimeDir = () => app.isPackaged ? process.resourcesPath : join(here, '..', 'build', 'runtime')const hostOutput = (stream, chunk) => {logs.write('engine', chunk)rawOutput[stream](chunk)@@ -561,7 +562,7 @@ function newHost() {return new HostProcess({entry: join(here, 'host.mjs'),cwd: profileDir(),- env: { ...process.env, DSH_HOME: places.dataDir, DS_BOT_PORT: String(port), DS_BOT_APP: '1', DS_BOT_USER_DSH_HOME: userDshHome(), DS_BOT_RUNTIME_DIR: app.isPackaged ? process.resourcesPath : join(here, '..', 'build', 'runtime'), ...(places.workspace ? { DS_BOT_WORKSPACE: places.workspace } : {}) },+ env: { ...process.env, DSH_HOME: places.dataDir, DS_BOT_PORT: String(port), DS_BOT_APP: '1', DS_BOT_USER_DSH_HOME: userDshHome(), DS_BOT_RUNTIME_DIR: runtimeDir(), ...(places.workspace ? { DS_BOT_WORKSPACE: places.workspace } : {}) },pnpm: pnpmEntry(),onFailure: (error) => { if (mine === attempt) void fail(error) },output: hostOutput,@@ -572,7 +573,7 @@ function newHost() {function newCheck(home, list) {const cwd = join(home, 'profiles', CHECK_PROFILE)mkdirSync(cwd, { recursive: true })- return new HostProcess({ entry: join(here, 'host.mjs'), cwd, env: { ...process.env, DSH_HOME: home, DS_BOT_CHECK: list }, pnpm: pnpmEntry(), onFailure: () => {}, output: hostOutput })+ return new HostProcess({ entry: join(here, 'host.mjs'), cwd, env: { ...process.env, DSH_HOME: home, DS_BOT_CHECK: list, DS_BOT_RUNTIME_DIR: runtimeDir() }, pnpm: pnpmEntry(), onFailure: () => {}, output: hostOutput })}/**diff --git a/app/test/helpers/fake-host-process.mjs b/app/test/helpers/fake-host-process.mjsindex d2d846cd..cf4d9f18 100644--- a/app/test/helpers/fake-host-process.mjs+++ b/app/test/helpers/fake-host-process.mjs@@ -18,6 +18,8 @@ let openexport const state = {starts: 0,+ // The env of every Host that was started, in order.+ envs: [],stops: 0,fail: false,// The Host waits for the test to let it answer.@@ -39,6 +41,7 @@ export class HostProcess {async start() {state.starts += 1+ state.envs.push(this.#options.env)if (state.held) await gateif (state.fail) throw new Error('the Host did not start')// The check of an import's chats (DS_BOT_CHECK) reads them all.diff --git a/app/test/main-import.test.mjs b/app/test/main-import.test.mjsindex 7df20377..dc238aa2 100644--- a/app/test/main-import.test.mjs+++ b/app/test/main-import.test.mjs@@ -7,6 +7,8 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } fromimport { tmpdir } from 'node:os'import { dirname, join } from 'node:path'import { test } from 'node:test'+import { fileURLToPath } from 'node:url'+import { hostExecutable } from '../src/host-process.mjs'import { app, paths, state } from './helpers/fake-electron.mjs'import { hold, state as hostState } from './helpers/fake-host-process.mjs'import { handOff, messageBoxes, startAct, startState, startWindows, waitFor, window } from './helpers/app-harness.mjs'@@ -65,6 +67,11 @@ test('the first start offers the DSH team on the import card, copies it on cardsassert.equal(JSON.parse(readFileSync(join(paths.userData, 'locations.json'), 'utf8')).dataDir, join(home, '.ds-bot'))assert.deepEqual(messageBoxes(), [], 'no message box on the way')assert.equal(hostState.starts, 3, 'the warm engine, the chats\' check and the team\'s engine')+ // On Linux the check's Host runs from the runtime folder, as the team's does.+ const runtime = fileURLToPath(new URL('../build/runtime', import.meta.url))+ const check = hostState.envs.find(env => env.DS_BOT_CHECK)+ assert.equal(check.DS_BOT_RUNTIME_DIR, runtime)+ assert.equal(hostExecutable(check.DS_BOT_RUNTIME_DIR, 'linux'), join(runtime, 'primary-runtime', 'dependencies', 'node', 'bin', 'node'))await handOff()app.quit()await waitFor(() => state.tray?.destroyed === true, 'end the app')