feat(projects): add interactive AI app scaffold skill
This commit is contained in:
@@ -5,6 +5,7 @@ import { createServer, type ServerResponse } from 'node:http';
|
||||
import { createRequire } from 'node:module';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { PiAgentServerProcess } from '../../electron/coding-runtime/pi/agent-server-process';
|
||||
import { PiManagedExtensionHost } from '../../electron/coding-runtime/pi/extension-host';
|
||||
@@ -196,6 +197,33 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe('Pi Agent Server real process', () => {
|
||||
it('exposes its executable to Skill scripts', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-agent-server-environment-'));
|
||||
roots.push(root);
|
||||
const configDir = path.join(root, 'config');
|
||||
const serverPath = path.join(root, 'pi-agent-server-environment.mjs');
|
||||
await mkdir(configDir, { recursive: true });
|
||||
await writeFile(serverPath, [
|
||||
"if (process.env.MAKELORE_NODE_EXECUTABLE !== process.execPath) {",
|
||||
" throw new Error('MAKELORE_NODE_EXECUTABLE does not match the Agent Server executable');",
|
||||
'}',
|
||||
`await import(${JSON.stringify(pathToFileURL(path.resolve('resources/pi-agent-server.mjs')).href)});`,
|
||||
'',
|
||||
].join('\n'));
|
||||
const server = new PiAgentServerProcess({
|
||||
executablePath: process.execPath,
|
||||
serverPath,
|
||||
runtimeRoot: path.resolve('node_modules/@earendil-works/pi-coding-agent'),
|
||||
configDir,
|
||||
});
|
||||
|
||||
try {
|
||||
await expect(server.start()).resolves.toBeUndefined();
|
||||
} finally {
|
||||
await server.stop().catch(() => undefined);
|
||||
}
|
||||
}, 10_000);
|
||||
|
||||
it('resolves runtime packages when the server resource is outside the project module tree', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-agent-server-packaged-layout-'));
|
||||
roots.push(root);
|
||||
|
||||
Reference in New Issue
Block a user