mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat: vendor official hippo memory extension
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, readFile } from "node:fs/promises";
|
||||
import { chmod, mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -11,9 +11,26 @@ const hasPi = spawnSync("pi", ["--version"], { encoding: "utf8" }).status === 0;
|
||||
|
||||
test("all package extensions load together without global registration conflicts", { skip: !hasPi }, async () => {
|
||||
const packageJson = JSON.parse(await readFile(join(repositoryRoot, "package.json"), "utf8")) as {
|
||||
dependencies: Record<string, string>;
|
||||
pi: { extensions: string[] };
|
||||
};
|
||||
assert.ok(
|
||||
packageJson.pi.extensions.includes("./hippo-memory-pi/index.ts"),
|
||||
"the bundle must load the vendored official Hippo Memory extension",
|
||||
);
|
||||
assert.equal(
|
||||
packageJson.pi.extensions.some((entry) => entry.includes("pi-hermes-memory") || entry.includes("the-forge-flow")),
|
||||
false,
|
||||
"retired Hermes and third-party Hippo extensions must not be loaded",
|
||||
);
|
||||
assert.equal(packageJson.dependencies["@the-forge-flow/hippo-memory-pi"], undefined);
|
||||
assert.equal(packageJson.dependencies["@sinclair/typebox"], undefined);
|
||||
const home = await mkdtemp(join(tmpdir(), "my-pi-extension-load-"));
|
||||
const mockBin = join(home, "bin");
|
||||
await mkdir(mockBin, { recursive: true });
|
||||
const hippo = join(mockBin, "hippo");
|
||||
await writeFile(hippo, "#!/bin/sh\nprintf '%s\\n' 'Hippo Memory status'\n", "utf8");
|
||||
await chmod(hippo, 0o755);
|
||||
const args = ["--no-extensions"];
|
||||
for (const entry of packageJson.pi.extensions) args.push("-e", resolve(repositoryRoot, entry));
|
||||
args.push("--help");
|
||||
@@ -27,6 +44,7 @@ test("all package extensions load together without global registration conflicts
|
||||
XDG_CONFIG_HOME: join(home, ".config"),
|
||||
PI_CODING_AGENT_DIR: join(home, ".pi-agent"),
|
||||
MY_PI_SEARCH_CONFIG: join(home, "missing-search.env"),
|
||||
PATH: `${mockBin}:${process.env.PATH ?? ""}`,
|
||||
PI_OFFLINE: "1",
|
||||
TAVILY_API_KEY: "",
|
||||
EXA_API_KEY: "",
|
||||
|
||||
Reference in New Issue
Block a user