🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { locateDshRuntime, materializeDshRuntime } from "../src/agent/host.js";
import { findAppRoot } from "../src/magpie/supervisor.js";
const dirs: string[] = [];
afterEach(() => {
for (const d of dirs.splice(0)) fs.rmSync(d, { recursive: true, force: true });
});
describe("materializeDshRuntime", () => {
it("is identity (no extract) for plain dirs", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "amb-plain-"));
dirs.push(dir);
fs.mkdirSync(path.join(dir, "node_modules", "@deepseek-ai", "dsh-sdk-client"), { recursive: true });
fs.writeFileSync(path.join(dir, "node_modules", "@deepseek-ai", "dsh-sdk-client", "package.json"), "{}");
const cache = fs.mkdtempSync(path.join(os.tmpdir(), "amb-cache-"));
dirs.push(cache);
expect(materializeDshRuntime(dir, cache)).toBe(dir);
expect(fs.readdirSync(cache)).toEqual([]);
});
it("does not extract even when path looks like an asar", () => {
const fake = path.join(os.tmpdir(), "amb-fake-dsh.asar");
const cache = fs.mkdtempSync(path.join(os.tmpdir(), "amb-cache-asar-"));
dirs.push(cache);
expect(materializeDshRuntime(fake, cache)).toBe(fake);
expect(fs.readdirSync(cache)).toEqual([]);
});
});
describe("locateDshRuntime", () => {
it("finds checkout dsh-runtime when prepared", () => {
const root = findAppRoot();
const hit = locateDshRuntime(root);
// In CI/dev after prepare-dsh; skip soft if missing
if (!hit) return;
expect(hit).toContain("dsh");
expect(fs.existsSync(path.join(hit, "node_modules", "@deepseek-ai", "dsh-sdk-client", "package.json"))).toBe(true);
});
});