mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
feat: integrate Pi backend and Pi Web
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { DefaultResourceLoader, getAgentDir } from "@earendil-works/pi-coding-agent";
|
||||
import type { SkillInfo, SkillsResponse } from "@/lib/api-types";
|
||||
import { annotateSkillsWithInstallInfo } from "@/lib/skill-lock";
|
||||
import { getProjectTrustStatus, projectTrustReloadOptions } from "@/lib/project-trust";
|
||||
import {
|
||||
createAppSettingsManager,
|
||||
getAppResourceLoaderOptions,
|
||||
getManagedRuntimePaths,
|
||||
isManagedRuntime,
|
||||
} from "@/lib/app-runtime";
|
||||
|
||||
export async function loadSkillsWithInstallInfo(cwd: string): Promise<SkillsResponse> {
|
||||
const agentDir = getAgentDir();
|
||||
const loader = new DefaultResourceLoader({
|
||||
...getAppResourceLoaderOptions(),
|
||||
cwd,
|
||||
agentDir,
|
||||
settingsManager: createAppSettingsManager(cwd, agentDir),
|
||||
});
|
||||
await loader.reload(projectTrustReloadOptions(cwd, agentDir));
|
||||
const { skills, diagnostics } = loader.getSkills();
|
||||
const managedPaths = isManagedRuntime() ? getManagedRuntimePaths() : undefined;
|
||||
return {
|
||||
skills: annotateSkillsWithInstallInfo(skills as SkillInfo[], {
|
||||
cwd,
|
||||
agentDir,
|
||||
...(managedPaths ? { globalSkillRoots: managedPaths.managedSkillRoots } : {}),
|
||||
}),
|
||||
diagnostics,
|
||||
projectResourcesLoaded: getProjectTrustStatus(cwd, agentDir).trusted,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user