Fix Pi package updates and merge feynman-model

This commit is contained in:
Advait Paliwal
2026-03-31 09:18:05 -07:00
parent aed607ce62
commit d9812cf4f2
10 changed files with 392 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
import test from "node:test";
import assert from "node:assert/strict";
import { buildPiArgs, buildPiEnv, resolvePiPaths } from "../src/pi/runtime.js";
import { applyFeynmanPackageManagerEnv, buildPiArgs, buildPiEnv, resolvePiPaths } from "../src/pi/runtime.js";
test("buildPiArgs includes configured runtime paths and prompt", () => {
const args = buildPiArgs({
@@ -70,6 +70,37 @@ test("buildPiEnv wires Feynman paths into the Pi environment", () => {
}
});
test("applyFeynmanPackageManagerEnv pins npm globals to the Feynman prefix", () => {
const previousFeynmanPrefix = process.env.FEYNMAN_NPM_PREFIX;
const previousUppercasePrefix = process.env.NPM_CONFIG_PREFIX;
const previousLowercasePrefix = process.env.npm_config_prefix;
try {
const prefix = applyFeynmanPackageManagerEnv("/home/.feynman/agent");
assert.equal(prefix, "/home/.feynman/npm-global");
assert.equal(process.env.FEYNMAN_NPM_PREFIX, "/home/.feynman/npm-global");
assert.equal(process.env.NPM_CONFIG_PREFIX, "/home/.feynman/npm-global");
assert.equal(process.env.npm_config_prefix, "/home/.feynman/npm-global");
} finally {
if (previousFeynmanPrefix === undefined) {
delete process.env.FEYNMAN_NPM_PREFIX;
} else {
process.env.FEYNMAN_NPM_PREFIX = previousFeynmanPrefix;
}
if (previousUppercasePrefix === undefined) {
delete process.env.NPM_CONFIG_PREFIX;
} else {
process.env.NPM_CONFIG_PREFIX = previousUppercasePrefix;
}
if (previousLowercasePrefix === undefined) {
delete process.env.npm_config_prefix;
} else {
process.env.npm_config_prefix = previousLowercasePrefix;
}
}
});
test("resolvePiPaths includes the Promise.withResolvers polyfill path", () => {
const paths = resolvePiPaths("/repo/feynman");