feat: update webui extensions, models, and agent config
This commit is contained in:
@@ -45,12 +45,25 @@ export function createWebUiPaths(): WebUiPaths {
|
||||
};
|
||||
}
|
||||
|
||||
export function resolvePiRpcLaunch(paths: WebUiPaths): { command: string; args: string[]; mode: "dist" } {
|
||||
export type PiRpcLaunchMode = "dist" | "tsx";
|
||||
|
||||
export function resolvePiRpcLaunch(
|
||||
paths: WebUiPaths,
|
||||
): { command: string; args: string[]; mode: PiRpcLaunchMode } {
|
||||
const rpcArgs = ["--mode", "rpc"];
|
||||
if (!existsSync(paths.piCliDist)) {
|
||||
throw new Error(
|
||||
`[webui] 构建版 sproutclaw 未找到: ${paths.piCliDist}。请先运行: sproutclaw build`,
|
||||
);
|
||||
if (existsSync(paths.piCliDist)) {
|
||||
return { command: process.execPath, args: [paths.piCliDist, ...rpcArgs], mode: "dist" };
|
||||
}
|
||||
return { command: process.execPath, args: [paths.piCliDist, ...rpcArgs], mode: "dist" };
|
||||
|
||||
const tsxCli = join(paths.repoRoot, "node_modules", "tsx", "dist", "cli.mjs");
|
||||
const piCliSrc = join(paths.repoRoot, "packages", "coding-agent", "src", "cli.ts");
|
||||
if (existsSync(tsxCli) && existsSync(piCliSrc)) {
|
||||
return { command: process.execPath, args: [tsxCli, piCliSrc, ...rpcArgs], mode: "tsx" };
|
||||
}
|
||||
|
||||
const buildHint =
|
||||
process.platform === "win32"
|
||||
? "请先运行: npm run build 或 pi-built.bat"
|
||||
: "请先运行: npm run build 或 sproutclaw build";
|
||||
throw new Error(`[webui] pi 未找到: ${paths.piCliDist}。${buildHint}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user