fix(plugins): load official hosted plugins from bundled resources
This commit is contained in:
@@ -40,6 +40,8 @@ async function fixtureRoot(): Promise<{
|
||||
mkdir(path.join(skillsDir, 'grilling'), { recursive: true }),
|
||||
mkdir(path.join(skillsDir, 'agent-browser'), { recursive: true }),
|
||||
mkdir(path.join(path.dirname(skillsDir), 'coding-plugins', 'data-service', 'skills', 'data-service'), { recursive: true }),
|
||||
mkdir(path.join(path.dirname(skillsDir), 'coding-plugins', 'game-resource', 'skills', 'game-resource'), { recursive: true }),
|
||||
mkdir(path.join(path.dirname(skillsDir), 'coding-plugins', 'web-search', 'skills', 'makelore-web-search'), { recursive: true }),
|
||||
]);
|
||||
await Promise.all([
|
||||
writeFile(path.join(projectDir, '.pi', 'skills', 'untrusted-project-skill', 'SKILL.md'), 'untrusted', 'utf8'),
|
||||
@@ -51,6 +53,16 @@ async function fixtureRoot(): Promise<{
|
||||
'---\nname: data-service\n---\n',
|
||||
'utf8',
|
||||
),
|
||||
writeFile(
|
||||
path.join(path.dirname(skillsDir), 'coding-plugins', 'game-resource', 'skills', 'game-resource', 'SKILL.md'),
|
||||
'---\nname: game-resource\n---\n',
|
||||
'utf8',
|
||||
),
|
||||
writeFile(
|
||||
path.join(path.dirname(skillsDir), 'coding-plugins', 'web-search', 'skills', 'makelore-web-search', 'SKILL.md'),
|
||||
'---\nname: makelore-web-search\n---\n',
|
||||
'utf8',
|
||||
),
|
||||
]);
|
||||
return { root, userDataDir, projectDir, skillsDir };
|
||||
}
|
||||
@@ -160,15 +172,21 @@ describe('Pi managed resource loader', () => {
|
||||
projectId: 'project-1',
|
||||
agentId: 'agent-1',
|
||||
prompt: 'plugin prompt',
|
||||
skillEntries: [{ id: 'data-service', entryPath: 'skills/data-service/SKILL.md' }],
|
||||
skillEntries: [
|
||||
{ id: 'data-service', entryPath: 'skills/data-service/SKILL.md' },
|
||||
{ id: 'game-resource', entryPath: 'skills/game-resource/SKILL.md' },
|
||||
{ id: 'makelore-web-search', entryPath: 'skills/makelore-web-search/SKILL.md' },
|
||||
],
|
||||
catalogRevision: 13,
|
||||
bundledSkillsDir: fixture.skillsDir,
|
||||
revision: { provider: 1, resources: 1 },
|
||||
});
|
||||
|
||||
expect(resources.skillIds).toEqual(['data-service']);
|
||||
expect(resources.skillIds).toEqual(['data-service', 'game-resource', 'makelore-web-search']);
|
||||
expect(resources.skillPaths).toEqual([
|
||||
path.join(path.dirname(fixture.skillsDir), 'coding-plugins', 'data-service', 'skills', 'data-service', 'SKILL.md'),
|
||||
path.join(path.dirname(fixture.skillsDir), 'coding-plugins', 'game-resource', 'skills', 'game-resource', 'SKILL.md'),
|
||||
path.join(path.dirname(fixture.skillsDir), 'coding-plugins', 'web-search', 'skills', 'makelore-web-search', 'SKILL.md'),
|
||||
]);
|
||||
expect(resources.catalogRevision).toBe(13);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user